-1
如何在連接fragmentssUnreachabe代碼,而抽屜式導航
private void launchFragment(int paramInt)
{
String str="Photo";
Object localObject=new Photo();
if (paramInt == 0)
{
str = "Photo";
localObject = new Photo();
if (localObject == null);
}
while(true)
{
if (getSupportFragmentManager().getBackStackEntryCount() <= 0)
{
getSupportFragmentManager().beginTransaction().replace(R.id.drawer_layout, (Fragment)localObject).addToBackStack(str).commit();
return;
//from this line its inidicates unreachable code
if (paramInt == 1)
{
str = "Activity";
localObject = new ActivityList();
break;
}
if (paramInt == 2)
{
str = "Explore Video";
localObject = new Explore();
break;
}
if (paramInt == 3)
{
str = "Profile";
localObject = new Profile();
break;
}
if (paramInt == 4)
{
str = "Upload new file";
localObject = new Upload();
break;
}
localObject = null;
str = null;
if (paramInt != 5)
break;
str = "Elements";
localObject = new Elements();
break;
}
getSupportFragmentManager().popBackStackImmediate();
}
}
你的代碼是在語句'return;'之後。當然,它無法達到。在return之前移動所有的代碼 –