0

私のアプリでは、Intent.setClassNameまたはsetComponentを使用して、別のパッケージでアクティビティを開始する必要があります。Intent intent = new Intent(getApplicationContext()、org.iustb.knowledebase.animation.transparent.MainTransparentActivity.class);のようにIntent.setClassを使用しても問題はありません。Webでこの問題を解決するための提案は、AndroidManifestのターゲットアクティビティにまたはandroid:exported = "true"を追加することですが、機能しません。誰か助けてくれる人はいますか?
私は以下のコードを書きました:

Intent intent = new Intent();
intent.setClassName(cursor.getString(pIndex), cursor.getString(cIndex));
startActivity(intent);

ターゲットアクティビティのマニフェストファイル設定:

<activity android:name="org.iustb.knowledebase.animation.transparent.MainTransparentActivity"
                android:exported="true"></activity>
4

2 に答える 2

0

返される値が正しいことを確認しましたcursorか?

の最初のパラメータは、アクティビティが開始されたパッケージではなく、アプリケーションパッケージsetClassName()名である必要があります。

アプリケーションパッケージが次のようになっていると仮定しますがcom.testandroid、パッケージから他のアクティビティを開始するcom.testandroid.other場合、コードは次のようになります。

intent.setClassName("com.testandroid", "com.testandroid.other.OtherActivity");
于 2012-08-13T08:37:22.060 に答える