找不到处理Intent的Activity

时间:2013-07-20 10:14:23

标签: android

我有以下代码:

public  class MainActivity extends Activity {
/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Button mybutton=(Button)findViewById(R.id.button);
    mybutton.setOnClickListener(new View.OnClickListener() 
    {
        @Override
        public void onClick(View v) {
           Button mybutton=(Button)findViewById(R.id.button);
           mybutton.setText("Been Click");
           Intent myIntent=new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory().getAbsolutePath()));
            startActivity(myIntent);

        }
    });



}

}

我的清单如下:

          <intent-filter>

            <category android:name="android.intent.category.LAUNCHER"/>
            <category android:name="android.intent.category.DEFAULT" />
            <action android:name="android.intent.action.MAIN"/>
            <action android:name="android.intent.ACTION_MEDIA_MOUNTED"/>
            <action android:name="android.intent.action.MEDIA_EJECT" />
            <action android:name="android.intent.ACTION_MEDIA_SCANNER_SCAN_FILE"/>
            <data android:scheme="file"/>
        </intent-filter>
    </activity>
</application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/>

但是,当我单击按钮时,logcat会收到致命异常

ERROR/AndroidRuntime(16212): FATAL EXCEPTION: main
    android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.MEDIA_MOUNTED dat=file:///storage/sdcard0 }

我不知道如何找到处理Intent问题的No Activity。

如果你知道,请告诉我,非常感谢!

0 个答案:

没有答案