This is my code so far. This is working but it only shows the very first value I have in the listView , not the selecting item by the user. Please halp me with this. This is really important.
unitListView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
unitListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// selected item
TextView t1 = (TextView) findViewById(R.id.lblLUnitName);
String name=t1.getText().toString();
// String a= (String) unitListView.getItemAtPosition(position);
// touchpressed=position;
Toast.makeText(getApplicationContext(), "Selected Item :" +name, Toast.LENGTH_SHORT).show();
}
});
0 comments:
Post a Comment