I am getting an ActivityNotFoundException
in the following code:
Main.java
Intent intent = new Intent();
intent.setAction(\"com.tes
I have some addition to the @Tom Pace answer. The answer is completely right, but to make it more clear:
ActivityNotFoundException
occurs because of absence of
Because when Android OS see this in the manifest file, understands that this activity can receive intent.
The point ActivityNotFoundException
thrown is that, when activity(intent-creator-activity) tries to create intent for other activity(intent-receiver-activity), Android OS sees there is intent for receiver activity but receiver activity does not receive anyone. Then Android OS returns null or empty intent to intent-creator-activity. And startActivity
throws that exception.
I have found a code from android developers to avoid this exception:
// Verify the original intent will resolve to at least one activity
if (sendIntent.resolveActivity(getPackageManager()) != null) {
startActivity(chooser);
}
Android Developers: Intent Filters