2017-08-24 5 views
0

アプリのリストを示すコードを作成しようとしています。ユーザーは削除するアプリを選択できます。私は私がオンラインに見てきたものに基づいて、このコードを書いた:Intent {act = android.intent.action.DELETE}を処理するためのアクティビティが見つかりません

appListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { 
      @Override 
      public void onItemClick(AdapterView<?> parent, View view, int position, long id) { 
       Uri packageUri = Uri.parse(names.get(position)); 
       Intent uninstallIntent = 
         new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri); 
       startActivity(uninstallIntent); 
      } 
     }); 

しかし、私はこの例外を取得しています何らかの理由:

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.UNINSTALL_PACKAGE dat=com.ivuu } 

のAndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?> 

<uses-permission android:name="android.permission.INSTALL_PACKAGES" 

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:roundIcon="@mipmap/ic_launcher_round" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 
    <activity android:name=".Main"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

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

私はアンドロイドにかなり新しいですし、私は私が

おかげ

+0

アンインストール権限も追加します。 –

答えて

1

をしないのです何がスキームを持っていない私に教えてください...これで一日を過ごしました。 Uripackage:...の形式である必要があります。...はアプリケーションID /パッケージ名です。

+0

それは、ありがとう! –

関連する問題