English 中文(简体)
about 意向行动
原标题:about android intent action

Current I am working in intent; however, I got some problems.

这就是说,我有两点,即A和B。 B的午餐场是甲状腺:发射Mode=“singleTop”。

现在,我想通过A到B的意向,他说“card/roid”(一条 director路)。 之后,A将完成,B将创建/继承/加入。 B将首次收到显示我所希望的“card/roid”的意图。

然后,我向发射商报到家子,然后开放A,然后又通过新的数据,即“card/Mu”,到B。 然而,问题发生时,B将得不到“card/Mu”,而B的意图数据仍然是“card/And”。

I expect the second time A pass the data to B, the onNewintent method will be called in B. Are there any wrongs? How can I pass the correct data to B in the second time?

@Override
public void onCreate(Bundle savedInstanceState) {
    onNewIntent(getIntent());
}

@Override
public void onNewIntent(Intent intent)
{
    Log.i("TAG", intent.getStringExtra("path"));
}

我知道,我应该超越新Intent。 B将首次采用Create方法。 第二次,我期待它采用新的Intent方法;然而,它却进入了恢复的方法。

问题回答

。 活动B 只打上<代码>的第二次和更多的时间。 活动B开始。

您可以通过做如下事情重新制定原有的<代码>Intent。

@Override
protected void onNewIntent(Intent intent) {
    setIntent(intent);
}

@Override
protected void onResume() {
    super.onResume();
    handleIntent(getIntent());
}

private void handleIntent(Intent intent) {
    // The intent parameter here will be the original `Intent` the first
    // time Activity B is started. It will be the new Intent after that
    // as onNewIntent(...) re-writes it with the call to setIntent(...)
}




相关问题
Android - ListView fling gesture triggers context menu

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, ...

AsyncTask and error handling on Android

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 ...

Android intent filter for a particular file extension?

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 ...

Android & Web: What is the equivalent style for the web?

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 ...

TiledLayer equivalent in Android [duplicate]

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?

Using Repo with Msysgit

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 ...

Android "single top" launch mode and onNewIntent method

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 ...

From Web Development to Android Development

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 ...

热门标签