I have the following class in my program:
public class RZoom extends Activity {
private ArrayList<FItem> m_FItems;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fchooser);
TextView tvName = (TextView)findViewById(R.id.txtTitleShow);
m_fItems = ((ArrayList<FItem>)this.getIntent().getSerializableExtra("fItems"));
tvName.setText(this.getIntent().getExtras().getString("RName"));
ListView lv = (ListView)findViewById(R.id.listView1);
FItemAdapter adapter = new FItemAdapter(this, R.layout.row, m_FItems);
lv.setAdapter(adapter);
}
}
This class displays a custom Listview and everything works fine. My questions are:
-
How do I capture an item click on the Listview? All the examples I’ve seen seem to inherit ListActivity instead of Activity, like I’m doing.
-
Is there a way to iterate through the items in the listview and set the background color of the item to Red, depending on the actual item? (In other words, I want to programmically highlight an item depending on the actual item)
Any help would be appreciated!
1 Answer