I'm trying to put in a Toast the selected value from ListView.
listView1.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> a, View v, int pos, long id){
// Now you have the id, you can set the background colour.
Toast.makeText(getBaseContext(),((TextView)v).getText(), Toast.LENGTH_LONG).show();
}
});
The error I get:
Error: android.widget.LinearLayout cannot be cast to android.widget.TextView