package com.example.myapplication; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ListView; public class PlayerActivity2 extends AppCompatActivity { ListView simpleList; String SerialNo[] = {"1", "2", "3", "4", "5", "6","7","8","9","10"}; int flags[] = {R.drawable.image1, R.drawable.image2, R.drawable.image3, R.drawable.image4, R.drawable.image5, R.drawable.image6, R.drawable.image7, R.drawable.image8, R.drawable.image9, R.drawable.image10}; String Names[] = {"mmm", "nnn", "aaa.", "bbb", "ccc", "ddd","eee jk"," ijk","Virgil jk","gil jklk"}; String Score[] = {"1", "2","3", "5", "4", "3","5","5","5","5"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity2); simpleList = (ListView)findViewById(R.id.simpleListView); //ArrayAdapter arrayAdapter = new ArrayAdapter(this, R.layout.activity_listview, R.id.textView, countryList); //simpleList.setAdapter(arrayAdapter); CustomAdapter customAdapter = new CustomAdapter(getApplicationContext(),simpleList,SerialNo, flags,Names, Score); simpleList.setAdapter(customAdapter); } Button exitButton = findViewById(R.id.exitButton); exitButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); // Finish the activity and return to the previous activity } }); } in this android app code this Button exitButton = findViewById(R.id.exitButton); exitButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); // Finish the activity and return to the previous activity } }); } the "seteventclick" is wrong ,whats wrong with it and how to fix it ,
package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
public class PlayerActivity2 extends AppCompatActivity {
ListView simpleList;
String SerialNo[] = {"1", "2", "3", "4", "5", "6","7","8","9","10"};
int flags[] = {R.drawable.image1, R.drawable.image2, R.drawable.image3, R.drawable.image4, R.drawable.image5, R.drawable.image6, R.drawable.image7, R.drawable.image8, R.drawable.image9, R.drawable.image10};
String Names[] = {"mmm", "nnn", "aaa.", "bbb", "ccc", "ddd","eee jk"," ijk","Virgil jk","gil jklk"};
String Score[] = {"1", "2","3", "5", "4", "3","5","5","5","5"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity2);
simpleList = (ListView)findViewById(R.id.simpleListView);
//ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, R.layout.activity_listview, R.id.textView, countryList);
//simpleList.setAdapter(arrayAdapter);
CustomAdapter customAdapter = new CustomAdapter(getApplicationContext(),simpleList,SerialNo, flags,Names, Score);
simpleList.setAdapter(customAdapter);
}
Button exitButton = findViewById(R.id.exitButton);
exitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish(); // Finish the activity and return to the previous activity
}
});
}
in this android app code
this
Button exitButton = findViewById(R.id.exitButton);
exitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish(); // Finish the activity and return to the previous activity
}
});
}
the "seteventclick" is wrong ,whats wrong with it and how to fix it ,


Step by step
Solved in 2 steps









