Android: No Activity Found To Handle Intent Error? How It Will Resolve


Answer :

Add the below to your manifest:

  <activity   android:name=".AppPreferenceActivity" android:label="@string/app_name">        <intent-filter>         <action android:name="com.scytec.datamobile.vd.gui.android.AppPreferenceActivity" />          <category android:name="android.intent.category.DEFAULT" />        </intent-filter>      </activity> 

in my case, i was sure that the action is correct, but i was passing wrong URL, i passed the website link without the http:// in it's beginning, so it caused the same issue, here is my manifest (part of it)

<activity         android:name=".MyBrowser"         android:label="MyBrowser Activity" >         <intent-filter>             <action android:name="android.intent.action.VIEW" />             <action android:name="com.dsociety.activities.MyBrowser" />              <category android:name="android.intent.category.DEFAULT" />              <data android:scheme="http" />         </intent-filter>     </activity> 

when i code the following, the same Exception is thrown at run time :

Intent intent = new Intent(); intent.setAction("com.dsociety.activities.MyBrowser"); intent.setData(Uri.parse("www.google.com"));    // should be http://www.google.com startActivity(intent); 

Generally to avoid this kind of exceptions, you will need to surround your code by try and catch like this

try{  // your intent here  } catch (ActivityNotFoundException e) { // show message to user  } 

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?