Reputation: 1430
I have searched and searched and searched for hours on this and can't find a solution that makes any sense for my problem. I am simply trying to open a web page from inside my android application. Should be simple, but I keep getting the No Activity found error and the app crashes. My code is extremely simple for this...
AboutActivity
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
Button appsButton = findViewById(R.id.about_button);
appsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(Keys.MARKET_LINK));
intent.setPackage(getPackageName());
startActivity(intent);
}
});
}
in my Keys class...
public static final String MARKET_LINK = "https://play.google.com/store/apps/dev?id=<MY ID>";
Every time I click the "aboutButton" in the app I get the error...
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://play.google.com/...
Everything I have found online all say the exact same thing... Your url didn't contain the "http://" part so it failed, but you can see my url does contain the "https://" part of the url. It is a complete URL, I can type it into a browser window and the page opens up perfectly. I don't understant how it can not have an activity to handle an Intent.ACTION_VIEW. I have no idea where to go now since everything online says add "http://" to the url and it will work, but it doesn't. Also, I do have the
<uses-permission android:name="android.permission.INTERNET />
in my manifest file. Any help would be appreciated, it is driving me insane. Thank you
Upvotes: 0
Views: 164
Reputation: 1121
You are targeting a specific package with
intent.setPackage(getPackageName());
So the system is looking for an intent filter within your app to handle the intent. If you remove this it will look through other apps on the device and find browsers which should allow you to open them.
Upvotes: 2