Detecting click event on listview control in android
I have an application to be developed in android. It has two tabs in it. I am using tabactivity to achieve the same. One of the tab, consist of listview so i have extended listactivity.
But now the problem is, how can i get the click event notification on listview.
At the same time , whenver there is a change event in tab,i should be notified f开发者_如何学Cor the same,
so how should i implement the same..
public class xyz extends TabActivity implements OnTabChangeListener
{
@Override
public void onCreate(Bundle savedInstanceState)
{
}
public void setOnTabChangedListener(TabHost.OnTabChangeListener l)
{
String arg0="girish";
l.onTabChanged(arg0);
Toast.makeText(getApplicationContext(),"Tabchanged",Toast.LENGTH_LONG).show();
}
@Override
public void onTabChanged(String tabId)
{
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(),"Tab changed1",Toast.LENGTH_LONG).show();
}
}
Rgds
Robert Sharma
I'm not entirely sure I understand what you're asking, but calling setOnItemClickListener() on your ListView should do the trick.
Similarly, for the tabs issue you should be able to call setOnTabChangedListener() on your TabHost.
精彩评论