Hi,
I have a TabActivity with two tabs. They have the same listview.
I have a listener that when I change of tab the listview loads differents
things, by a custom adapter.
I'm tying to implement click event for list item but i found that it was not
responding.
the listener of the tabhost is:
tabhost.setOnTabChangedListener(new OnTabChangeListener() {
@Override
public void onTabChanged(String arg0) {
Log.d("PRUEBA", "------" + tabhost.getCurrentTab());
final int actualTab = tabhost.getCurrentTab();
if (actualTab == 0 ){
Log.d("PRUEBA", "Cargamos el primer canal");
getRSS("http://www.miguiatv.com/rss/tve1.xml");
}
if (actualTab == 1 ){
Log.d("PRUEBA", "Cargamos el segundo canal");
getRSS("http://www.miguiatv.com/rss/la2.xml");
}
}
});
The custom adapter is:
class listaAdaptador extends ArrayAdapter<String> {
listaAdaptador() {
// super(tele.this, R.layout.row, R.id.programa, urls);
super(tele.this, R.layout.row, R.id.programa);
}
public View getView(int position, View convertView,
ViewGroup parent) {
View row=super.getView(position, convertView, parent);
ImageView icon=(ImageView)row.findViewById(R.id.icon);
if (tabhost.getCurrentTab() == 0){
Log.d("PRUEBA", "Cargamos el primer canal");
icon.setImageResource(R.drawable.la1);
}
if (tabhost.getCurrentTab() == 1){
Log.d("PRUEBA", "Cargamos el segundo canal");
icon.setImageResource(R.drawable.la2);
}
return(row);
}
}
The listener that doesnt works is:
list.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int
position, long id) {
Log.d("PRUEBA", "Entramos en ..." + position);
}
});
Could you help me please?
Many thanks and sorry for my english!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en