How to add A TextView Dynamically in the ListView Items Android?
Use this code i hope this is what u want
public void showstatesList() {
listView = (ListView) findViewById(R.id.list);
String[] statesList = {"listItem 1", "listItem 2", "listItem 3"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, statesList);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
int itemPosition = position;
String itemValue = (String) listView.getItemAtPosition(position);
// Toast.makeText(getApplicationContext(),
// "Position :"+itemPosition+" ListItem : " +itemValue , Toast.LENGTH_LONG)
// .show();
}
});
}