I tried to open a webpage on clicking a button. But, Its not working. This is my code:
ImageButton fbButton = (ImageButton) findViewById(R.id.fb);
fbButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent viewIntent = new Intent("Intent.ACTION_VIEW", Uri.parse("http://www.facebook.com"));
startActivity(viewIntent);
}
});
Its always going to catch statement.
And Here it is Manifest file permission code:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Error Log:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.krish.me, PID: 4532
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=Intent.ACTION_VIEW dat=http://www.facebook.com }
Thank you in Advance :)