パート2...
public void selectUpLayout()
{
try
{
if((appContext.nCurrentLayoutID == R.layout.fragment_levelhome) || (appContext.nCurrentLayoutID == R.layout.fragment_level1_2) || (appContext.nCurrentLayoutID == R.layout.fragment_level1_3) || (appContext.nCurrentLayoutID == R.layout.fragment_level1_4) || (appContext.nCurrentLayoutID == R.layout.fragment_level1_4_1) || (appContext.nCurrentLayoutID == R.layout.fragment_level1_4_2))
showLayoutHome();
else if((appContext.nCurrentLayoutID == R.layout.fragment_level1_3_1) || (appContext.nCurrentLayoutID == R.layout.fragment_level1_3_1_1) || (appContext.nCurrentLayoutID == R.layout.fragment_level1_3_2) || (appContext.nCurrentLayoutID == R.layout.fragment_level1_3_2_1) || (appContext.nCurrentLayoutID == R.layout.fragment_level1_3_3) || (appContext.nCurrentLayoutID == R.layout.fragment_level1_3_3_1))
showLayoutLevel1_3();
else if((appContext.nCurrentLayoutID == R.layout.fragment_level1_2_1) || (appContext.nCurrentLayoutID == R.layout.fragment_level1_2_2) ||(appContext.nCurrentLayoutID == R.layout.fragment_level1_2_3))
showLayoutLevel1_2();
updateActionBar();
}
catch(Exception e)
{
appContext.showMessage("Error","[selectUpLayout]: "+e.toString());
}
}
private void updateActionBar()
{
try
{
if(mActionBar != null)
{
if(appContext.nCurrentLayoutID == R.layout.fragment_levelhome)
{
mActionBar.setTitle("levelhome");
mActionBar.setSubtitle("levelhome");
mActionBar.setHomeButtonEnabled(false);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_2)
{
mActionBar.setTitle("fragment_level1_2");
mActionBar.setSubtitle("fragment_level1_2");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_3)
{
mActionBar.setTitle("fragment_level1_3");
mActionBar.setSubtitle("fragment_level1_3");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_4)
{
mActionBar.setTitle("fragment_level1_4");
mActionBar.setSubtitle("fragment_level1_4");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_2_1)
{
mActionBar.setTitle("Level1_2_1");
mActionBar.setSubtitle("Level1_2_1");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_2_2)
{
mActionBar.setTitle("Level1_2_2");
mActionBar.setSubtitle("Level1_2_2");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_2_3)
{
mActionBar.setTitle("Level1_2_3");
mActionBar.setSubtitle("Level1_2_3");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_3_1)
{
mActionBar.setTitle("Level1_3_1");
mActionBar.setSubtitle("Level1_3_1");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_3_1_1)
{
mActionBar.setTitle("Level1_3_1_1");
mActionBar.setSubtitle("Level1_3_1_1");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_3_2)
{
mActionBar.setTitle("Level1_3_2");
mActionBar.setSubtitle("Level1_3_2");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_3_2_1)
{
mActionBar.setTitle("Level1_3_2_1");
mActionBar.setSubtitle("Level1_3_2_1");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_3_3)
{
mActionBar.setTitle("Level1_3_3");
mActionBar.setSubtitle("Level1_3_3");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_3_3_1)
{
mActionBar.setTitle("Level1_3_3_1");
mActionBar.setSubtitle("Level1_3_3_1");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_4_1)
{
mActionBar.setTitle("Level1_4_1");
mActionBar.setSubtitle("Level1_4_1");
mActionBar.setHomeButtonEnabled(true);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_4_2)
{
mActionBar.setTitle("Level1_4_2");
mActionBar.setSubtitle("Level1_4_2");
mActionBar.setHomeButtonEnabled(true);
}
}
}
catch(Exception e)
{
appContext.showMessage("Error","[AddTab]: "+e.toString());
}
}
private void showLayoutHome()
{
try
{
if(mActionBar != null)
{
if(appContext.nCurrentLayoutID == 0)
{
appContext.nCurrentLayoutID = R.layout.fragment_levelhome;
addTab(tabLevelHome,-1);
addTab(tabLevel1_2, -1);
addTab(tabLevel1_3,-1);
addTab(tabLevel1_4, -1);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_2)
{
appContext.nCurrentLayoutID = R.layout.fragment_levelhome;
removeTab(mActionBar.getTabAt(3));
removeTab(mActionBar.getTabAt(2));
addTab(tabLevel1_3,-1);
addTab(tabLevel1_4, -1);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_3)
{
appContext.nCurrentLayoutID = R.layout.fragment_levelhome;
removeTab(mActionBar.getTabAt(4));
removeTab(mActionBar.getTabAt(3));
removeTab(mActionBar.getTabAt(2));
removeTab(mActionBar.getTabAt(1));
addTab(tabLevel1_2, -1);
addTab(tabLevel1_3,-1);
addTab(tabLevel1_4, -1);
}
else if((appContext.nCurrentLayoutID == R.layout.fragment_level1_4) || (appContext.nCurrentLayoutID == R.layout.fragment_level1_4_1))
{
appContext.nCurrentLayoutID = R.layout.fragment_levelhome;
removeTab(mActionBar.getTabAt(3));
removeTab(mActionBar.getTabAt(2));
addTab(tabLevel1_2,1);
addTab(tabLevel1_3, 2);
}
else if(appContext.nCurrentLayoutID == R.layout.fragment_level1_4_2)
{
if(mActionBar.getTabAt(1).getText() == " Level1_2")
{
appContext.nCurrentLayoutID = R.layout.fragment_levelhome;
removeTab(mActionBar.getTabAt(3));
removeTab(mActionBar.getTabAt(2));
addTab(tabLevel1_3,-1);
addTab(tabLevel1_4, -1);
}
else
{
appContext.nCurrentLayoutID = R.layout.fragment_levelhome;
removeTab(mActionBar.getTabAt(3));
removeTab(mActionBar.getTabAt(2));
addTab(tabLevel1_2,1);
addTab(tabLevel1_3, 2);
}
}
}
}
catch(Exception e)
{
appContext.showMessage("Error","[showLayoutHome]: "+e.toString());
}
}
private void showLayoutLevel1_2()
{
try
{
if(mActionBar != null)
{
if(appContext.nCurrentLayoutID == R.layout.fragment_levelhome)
{
appContext.nCurrentLayoutID = R.layout.fragment_level1_2;
removeTab(mActionBar.getTabAt(3));
removeTab(mActionBar.getTabAt(2));
addTab(tabLevel1_2_1,-1);
addTab(tabLevel1_4_2, -1);
}
else
{
appContext.nCurrentLayoutID = R.layout.fragment_level1_2;
removeTab(mActionBar.getTabAt(3));
removeTab(mActionBar.getTabAt(2));
addTab(tabLevelHome,0);
addTab(tabLevel1_4_2, -1);
}
}
}
catch(Exception e)
{
appContext.showMessage("Error","[showLayoutLevel1_2]: "+e.toString());
}
}
private void showLayoutLevel1_3()
{
try
{
if(mActionBar != null)
{
if(appContext.nCurrentLayoutID == R.layout.fragment_levelhome)
{
appContext.nCurrentLayoutID = R.layout.fragment_level1_3;
removeTab(mActionBar.getTabAt(3));
removeTab(mActionBar.getTabAt(1));
addTab(tabLevel1_3_1, -1);
addTab(tabLevel1_3_2,-1);
addTab(tabLevel1_3_3, -1);
}
else
{
appContext.nCurrentLayoutID = R.layout.fragment_level1_3;
removeTab(mActionBar.getTabAt(2));
removeTab(mActionBar.getTabAt(1));
addTab(tabLevelHome,0);
addTab(tabLevel1_3_1, -1);
addTab(tabLevel1_3_2,-1);
addTab(tabLevel1_3_3, -1);
}
}
}
catch(Exception e)
{
appContext.showMessage("Error","[showLayoutLevel1_3]: "+e.toString());
}
}
private void showLayoutLevel1_4()
{
try
{
if(mActionBar != null)
{
appContext.nCurrentLayoutID = R.layout.fragment_level1_4;
removeTab(mActionBar.getTabAt(2));
removeTab(mActionBar.getTabAt(1));
addTab(tabLevel1_4_1,-1);
addTab(tabLevel1_4_2, -1);
}
}
catch(Exception e)
{
appContext.showMessage("Error","[showLayoutLevel1_4]: "+e.toString());
}
}
private void showLayoutLevel1_2_1()
{
try
{
if(mActionBar != null)
{
appContext.nCurrentLayoutID = R.layout.fragment_level1_2_1;
removeTab(mActionBar.getTabAt(3));
removeTab(mActionBar.getTabAt(0));
addTab(tabLevel1_2_2,-1);
addTab(tabLevel1_2_3, -1);
}
}
catch(Exception e)
{
appContext.showMessage("Error","[showLayoutLevel1_2_1]: "+e.toString());
}
}
private void showLayoutLevel1_3_1()
{
try
{
if(mActionBar != null)
{
appContext.nCurrentLayoutID = R.layout.fragment_level1_3_1;
removeTab(mActionBar.getTabAt(4));
removeTab(mActionBar.getTabAt(3));
removeTab(mActionBar.getTabAt(0));
addTab(tabLevel1_3_1_1, -1);
}
}
catch(Exception e)
{
appContext.showMessage("Error","[showLayoutLevel1_3_1]: "+e.toString());
}
}
private void showLayoutLevel1_3_2()
{
try
{
if(mActionBar != null)
{
appContext.nCurrentLayoutID = R.layout.fragment_level1_3_2;
removeTab(mActionBar.getTabAt(4));
removeTab(mActionBar.getTabAt(2));
removeTab(mActionBar.getTabAt(0));
addTab(tabLevel1_3_2_1, -1);
}
}
catch(Exception e)
{
appContext.showMessage("Error","[showLayoutLevel1_3_2]: "+e.toString());
}
}
private void showLayoutLevel1_3_3()
{
try
{
if(mActionBar != null)
{
appContext.nCurrentLayoutID = R.layout.fragment_level1_3_3;
removeTab(mActionBar.getTabAt(3));
removeTab(mActionBar.getTabAt(2));
removeTab(mActionBar.getTabAt(0));
addTab(tabLevel1_3_3_1,-1);
}
}
catch(Exception e)
{
appContext.showMessage("Error","[showLayoutLevel1_3_3]: "+e.toString());
}
}
}