简体   繁体   English

调用onCreate()方法而不是onNewIntent()

[英]onCreate() method is called instead of onNewIntent()

I am developing an application where i have integrated Twitter in TabActivity. 我正在开发一个应用程序,我在TabActivity中集成了Twitter。 I have not created another activity, I am calling intent from TabActivity(Where we add all tabs), If I call intent from another activity it shows black screen. 我没有创建另一个活动,我从TabActivity调用intent(我们添加所有选项卡),如果我从另一个活动调用intent它显示黑屏。 For this i call intent from TabActivity. 为此我从TabActivity调用intent。 Now it is not showing black screen but it is not returning to onNewIntent Function, instead of this onCreate of TabActivity is called. 现在它没有显示黑屏,但它没有返回onNewIntent函数,而是调用了onCreate of TabActivity。

          <activity android:name=".guide.Tab_Custom"      android:windowSoftInputMode="adjustPan">
 <intent-filter><action android:name="android.intent.action.VIEW" /><category   ndroid:name="android.intent.category.DEFAULT" /><category android:name="android.intent.category.BROWSABLE" /><data android:scheme="x-oauthflow-twitter" android:host="callback" /></intent-filter>    </activity>

Here is code of calling intent: 这是调用意图的代码:

try {
            final String url = provider.retrieveRequestToken(consumer, Twitter_Constants_Key.OAUTH_CALLBACK_URL);
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_FROM_BACKGROUND);
            context.startActivity(intent);
        } catch (Exception e) {
            Log.e(TAG, "Error during OAUth retrieve request token", e);
        }

Any idea will be appreciated. 任何想法将不胜感激。

Thanks 谢谢

onNewIntent() can be called only if there is an activity already running. 只有在已经运行的活动时才能调用onNewIntent()。 Otherwise, onCreate() needs to be called to instantiate the activity. 否则,需要调用onCreate()来实例化活动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM