How to know whether the List View is Active or not?
Hai dude, I developed an application which intially displayed Games Listview , suppose if the user clicks the football elemnet in that games listview, then the football listview opens ,in that if user selected the particular player listview, then it is di开发者_如何学JAVAsplayed, my problem is i want 2 know which listview is in active.
Can any one help me regarding on this?
if(tabHost.getCurrentTab() == 2)
{
Log.v("I m Here Boss","0");
if(findViewById(R.id.bars_school_details).getVisibility() == View.VISIBLE)
{
Log.v("I m Here Boss","1");
findViewById(R.id.bars_school_details).setVisibility(View.GONE);
findViewById(R.id.bars_list).setVisibility(View.GONE);
findViewById(R.id.bars).setVisibility(View.VISIBLE);
}
else if(findViewById(R.id.bars_list).getVisibility() == View.VISIBLE)
{
Log.v("I m Here Boss","2");
findViewById(R.id.bars_school_details).setVisibility(View.VISIBLE);
findViewById(R.id.bars_list).setVisibility(View.GONE);
findViewById(R.id.bars).setVisibility(View.GONE);
}
}
Finally I got solution for this, i changed my code as
try {
if(tabHost.getCurrentTab() == 2)
{
try{
if(BS_.lv_bardate.getVisibility() == View.VISIBLE)
{
BS_Bars.lv_bardate.setVisibility(View.GONE);
BS_Bars.lv_barlist.setVisibility(View.GONE);
BS_Main.tv.setText("Schools");
BS_Bars.lv.setVisibility(View.VISIBLE);
}
if(BS_Bars.lv_barlist.getVisibility() == View.VISIBLE)
{
BS_Bars.lv_bardate.setVisibility(View.VISIBLE);
BS_Main.tv.setText("Dates");
BS_Bars.lv_barlist.setVisibility(View.GONE);
BS_Bars.lv.setVisibility(View.GONE);
}
if(BS_Bars.sv.getVisibility() == View.VISIBLE)
{
BS_Bars.lv_bardate.setVisibility(View.GONE);
BS_Bars.lv_barlist.setVisibility(View.VISIBLE);
BS_Bars.lv.setVisibility(View.GONE);
}
if(BS_Bars.lv.getVisibility() == View.VISIBLE)
{
// BS_Bars.lv_bardate.setVisibility(View.GONE);
// BS_Bars.lv_barlist.setVisibility(View.GONE);
// BS_Bars.lv.setVisibility(View.GONE);
finish();
}
}
catch(Exception e)
{
Log.v("BSMain","Error in Bar Module Back Button");
}
}
精彩评论