I want to open the links shared by apps like firefox or youtube in my webview. whenever i press the share button, it launches my app, but it never loads the url-
// get URL from browsable intent filter
TextView uri = (TextView) findViewById(R.id.urlField);
// get the url
url = getIntent().getStringExtra(Intent.EXTRA_TEXT);
Uri data = getIntent().getData();
if (data == null) {
uri.setText("");
} else {
uri.setText(getIntent().getData().toString());
fadeout();
}
// }
webView = (WebView) findViewById(R.id.webView);
// Load URL from Browsable intent filter if there is a valid URL pasted
if (uri.length() > 0)
webView.loadUrl(url);
else
// dont load
manifest
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
<data android:mimeType="image/*" />
</intent-filter>