1

我正在尝试按照代码在我的应用程序中使用 twitter,但它没有提供任何活动来处理 OAuthRequestTokenTask 类中的意图

我的代码是

@Override
protected Void doInBackground(Void... params) 
{

    try {
        Log.i(TAG, "Retrieving request token from Google servers");
        final String url = provider.retrieveRequestToken(consumer, Constants.CALLBACK_URL);
        Log.i(TAG, "Popping a browser with the authorize URL : " + 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);
        Log.i(TAG, "before start Context= " + context.toString());
        context.startActivity(intent);
        Log.i(TAG, "after start Context= " + context.toString());
    } catch (Exception e) {
        Log.e(TAG, "Error during OAUth retrieve request token", e);
    }

    return null;
}

它在开始活动时出错。当我使用 log.i 来跟踪上下文时,它也会打印正确的一个(PrepareRequestTokenActivity)。

我的清单是

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.supra.saiapp"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET"/>

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity android:name="PrepareRequestTokenActivity" android:launchMode="singleTask">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="x-oauthflow-twitter" android:host="callback" />
        </intent-filter>
    </activity>

    <activity android:name="RegisterActivity"></activity>
    <activity android:name="ContinueActivity"></activity>
    <activity android:name="TabActivity"></activity>
    <activity android:name="TabGroupActivity"></activity>
    <activity android:name="TabGroup1Activity"></activity>
    <activity android:name="TabGroup2Activity"></activity>
    <activity android:name="TabGroup3Activity"></activity>
    <activity android:name="TabGroup4Activity"></activity>
    <activity android:name="TabGroup5Activity"></activity>
    <activity android:name="AboutusActivity"></activity>
    <activity android:name="PictureGalleryActivity"></activity>
    <activity android:name="FullImageActivity"></activity>
    <activity android:name="StoriesListActivity"></activity>
    <activity android:name="StoryActivity"></activity>
    <activity android:name="FavoriteActivity"></activity>
    <activity android:name="MyAccountActivity"></activity>
    <activity android:name="ShareOnFacebook"></activity>




  </application>

错误是

android.content.ActivityNotFoundException: No Activity found to handle Intent {      act=android.intent.action.VIEW dat= https://api.twitter.com/oauth/authorize?oauth_token=7IeCQcKtUWXsP9IH6ftseF8HAGnA5IDRp0WcZqxqM flg=0x60000004 }

请帮忙...

4

2 回答 2

1

使用此演示进行 Twitter 集成...

https://github.com/lorensiuswlt/AndroidTwitter

于 2012-11-09T06:26:57.890 回答
0

你改变了这个实体

  <activity android:name="PrepareRequestTokenActivity"

  <activity android:name=".PrepareRequestTokenActivity"
于 2012-11-14T10:13:28.650 回答