我尝试使用该法典,从家长活动中开始多项活动:
for (int i=0; i<NUM_ACTIVITIES; i++)
{
Intent intent = new Intent(this, MyActivity.class);
startActivity(intent);
}
然而,根据我在<代码>MyActative.onCreate()上的记录,实际上只创造了1项活动。 这些行为是否有望? 如果是的话,发动多重活动的适当途径是什么?
我尝试使用该法典,从家长活动中开始多项活动:
for (int i=0; i<NUM_ACTIVITIES; i++)
{
Intent intent = new Intent(this, MyActivity.class);
startActivity(intent);
}
然而,根据我在<代码>MyActative.onCreate()上的记录,实际上只创造了1项活动。 这些行为是否有望? 如果是的话,发动多重活动的适当途径是什么?
你可以同时开展多项活动。 你们是否试图让他们走到一起?
实现这一点的一个途径是开展每一项活动,以便取得结果:
Intent intent = new Intent(this, MyActivity.class);
startActivityForResult(intent, 0);
如果你使用请求书,跟踪活动何时进行。 接着,在积极恢复中,你可以开始下一步工作:
protected void onActivityResult (int requestCode, int resultCode, Intent data) {
if (requestCode < NUM_ACTIVITIES) {
Intent intent = new Intent(this, MyActivity.class);
startActivityForResult(intent, requestCode + 1);
}
}
Edit: If you want to have some of the activities immediatly in the background, you can chain them together by calling startActivity in each Activity s onCreate. If you start a new Activity in onCreate before creating any views, the activity will never be visible.
protected void onCreate (Bundle savedInstanceState) {
int numLeft = getIntent().getIntExtra("numLeft");
if (numLeft > 0) {
Intent intent = new Intent(this, MyActivity.class);
intent.putExtra("numLeft", numLeft - 1);
startActivity(intent);
}
}
这应当完成你想要的 st。
I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...
I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...
I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...
I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...
To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?
When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...
I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...
I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...