我想有一個可以只從其他特定activites在我的應用程序推出的活動,而不是從別人Android的保護活動作爲內部類
目前,這個工程:
public abstract class Launcher extends Activity {
protected static boolean flag = true;
protected abstract void Launch();
public static class myPrivateActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(flag)
finish();
setContentView(R.layout.main);
}
}
}
public class SpecialActivity extends Launcher {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.newlayout);
}
@Override
protected void Launch {
flag = false;
Intent i = new Intent(Intent.ACTION_VIEW);
String name = myPrivateActivity.class.getName();
i.setClassName(this, name);
startActivity(i);
//finish();
}
}
在Android清單
<activity android:name=".Launcher$myPrivateActivity"
android:label="Private?">
不過,我想知道,如果與使用國旗相比,re是更好的解決方案嗎?