0

I want to open a new activity and pass it a URI of local html file(which is in the assets of the project):

public void onClick(View v) { Intent i = new Intent("com.appstudio.android.MY_ACTION",Uri.parse("file:///android_asset/sfaradi_mazon.html")); MainActivity.this.startActivity(i); } 

And this is how i declared the responding activity in the Manifest:

<activity android:name="BlessingActivity"> <intent-filter> <action android:name="com.appstudio.android.MY_ACTION"/> <data android:mimeType="text/html"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> 

But for some reason the app is crashing at startActivity(Action, Uri).

I'm getting an ActivityNotFoundException. No Activity was found to handle the intent

Any ideas?

Thanks!

4
  • Please post a log of the error! (called LOGCAT) We cannot guess the error you are experiencing. Commented Sep 26, 2011 at 22:01
  • how can i find it inside the thousands of messages in the LogCat? Commented Sep 26, 2011 at 22:13
  • Clear the output before you provoke the crash and set the log level to "error". If not already doing so, run on an emulator -- there's much less log spam going on compared to a real device. Commented Sep 26, 2011 at 22:21
  • Search for the activity name... Commented Sep 26, 2011 at 22:24

1 Answer 1

3

You have specified a MIME type in the <intent-filter> but do not have it in the corresponding Intent. Either remove the <data> element or call setDataAndType() on the Intent instead of supplying the Uri in the constructor.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.