I want to create listview. I got the value from the JSON. Here I got the value from the json into listview but i can\'t get the onItemclickListener method. Why this is
Use This:
contests_listView.setOnItemClickListener(new AdapaterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int position, long id) {
Intent in1 = new Intent(Activites_Activity.this, Activity_display.class);
startActivity(in1);
}
});
Try this :
contests_listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
String item = (String) contests_listView.getItemAtPosition(position);
Toast.makeText(this,"You selected : " + item,Toast.LENGTH_SHORT).show();
}
});
Try this code:
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Toast.makeText(this, "message", Toast.LENGTH_LONG).show();
}