My android app works on landscape mode. I have a listview that contains some items. The problem is the setOnItemClickListener is called only when I click the name of the item. I mean that if I select the row where is not the name of item the item is not select and setOnItemClickListener is not called. What should I do?
Please help me. Thanks in advance..
Here is my code :
MyListView = (ListView) findViewById(R.id.MyListView);
MyListView.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, playlists));
MyListView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View v, int position,
long id) {
System.out.println("list touch "+ playlists[position]+" si id "+idPlaylist[position]);
dialogwait = ProgressDialog.show(Playlist.this, "Loading...","Please wait..", true);
Intent i = new Intent(getBaseContext(), ViewPlaylist.class);
i.putExtra("id",idPlaylist[position]);
i.putExtra("timer",timerPlaylist[position]);
startActivity(i);
finish();
}
});
The problem was that I had
android:layout_width="wrap_content"at ListView. This is the corect code for ListView :