I hope these can give you an idea
@SimpleFunction(description = "")
public void Add(){
String[] myData = {"Visual Basic .NET", "Java", "Ruby"};
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(context, 17367043, myData);
listView.setAdapter(arrayAdapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
ItemClicked(position);
}
});
}
@SimpleEvent(description = "")
public void ItemClicked(int position) {
EventDispatcher.dispatchEvent(this, "ItemClicked", position);
}
Buy me a coffee
2 Likes
Thanks all of you and speacial thanks to @TIMAI2 or @Salman_Dev
1 Like
@Salman_Devwhen I use this code with some changes this give me error
popup.setOnMenuItemClickListener (PopupMenu.OnMenuItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
OnClick(position);
}
});
@SimpleEvent(description = "")
public void OnClick(int position) {
EventDispatcher.dispatchEvent(this, "Onclick", position);
}
Error
Started Compiling Project Popup
Buildfile: /compiler/android/build.xml
javac:
[mkdir] Created dir: /compiler/android/build/zjiyT/classes
[javac] Compiling 1 source file to /compiler/android/build/zjiyT/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] /compiler/android/src/zjiyT/com/faraz/popup/Popup.java:59: error: expected
[javac] popup.setOnMenuItemClickListener (PopupMenu.OnMenuItemClickListener() {
[javac] ^
[javac] /compiler/android/src/zjiyT/com/faraz/popup/Popup.java:59: error: expected
[javac] popup.setOnMenuItemClickListener (PopupMenu.OnMenuItemClickListener() {
[javac] ^
[javac] /compiler/android/src/zjiyT/com/faraz/popup/Popup.java:59: error: ';' expected
[javac] popup.setOnMenuItemClickListener (PopupMenu.OnMenuItemClickListener() {
[javac] ^
[javac] /compiler/android/src/zjiyT/com/faraz/popup/Popup.java:61: error: ';' expected
[javac] public void onItemClick(AdapterView parent, View view, int position, long id) {
[javac] ^
[javac] /compiler/android/src/zjiyT/com/faraz/popup/Popup.java:61: error: ';' expected
[javac] public void onItemClick(AdapterView parent, View view, int position, long id) {
[javac] ^
[javac] /compiler/android/src/zjiyT/com/faraz/popup/Popup.java:61: error: not a statement
[javac] public void onItemClick(AdapterView parent, View view, int position, long id) {
[javac] ^
[javac] /compiler/android/src/zjiyT/com/faraz/popup/Popup.java:61: error: ';' expected
[javac] public void onItemClick(AdapterView parent, View view, int position, long id) {
[javac] ^
[javac] /compiler/android/src/zjiyT/com/faraz/popup/Popup.java:61: error: expected
[javac] public void onItemClick(AdapterView parent, View view, int position, long id) {
[javac] ^
[javac] /compiler/android/src/zjiyT/com/faraz/popup/Popup.java:61: error: not a statement
[javac] public void onItemClick(AdapterView parent, View view, int position, long id) {
[javac] ^
[javac] /compiler/android/src/zjiyT/com/faraz/popup/Popup.java:61: error: ';' expected
[javac] public void onItemClick(AdapterView parent, View view, int position, long id) {
[javac] ^
[javac] /compiler/android/src/zjiyT/com/faraz/popup/Popup.java:64: error: illegal start of type
[javac] });
[javac] ^
[javac] 11 errors
[javac] 1 warning
You are just copy pasting the code.
As I said, you just pasted the code, the code is not even inside any method function.
1 Like
that code was for listview you copied and pasted it in popupmenu code it is totally wrong
2 Likes
@Faraz_Firoz just my opinion, learn basics, if you think you know basics, you are wrong, you cant learn it all in some weeks, its a time taking and lifetime useful thing, I myself spent many months with support of @Aarush_Kumar , @newbiedeveloper , @Pradevel to learn basics and now, I know it
human mind can be slow but, once it learns, nothing is impossible
7 Likes
I once learned table upto 20 but now I have forgotten it
3 Likes
Amen. I often joke that your knowledge is inversely proportional to the number of degrees you hold. In high school, you know everything, and by the time you have a Ph.D., you know absolutely nothing .
11 Likes
true, world is full of endless knowledge and you yourself prove yourself as an idol for many people even me
1 Like
Really ? I have 0 degrees . What you think ? How knowledgeable person I am ?
4 Likes
That's why it's a joke...
6 Likes
TIMAI2
August 14, 2021, 8:59am
50
"Experience is the only genuine knowledge "
5 Likes
I need a help from you. Can you tell this sentence to my Teacher ?
No More Home Works
2 Likes
At the end, this topic is became wonderful
5 Likes