0

I'm searching for a way to give the user the chance to get to a link of a website easily. Therefore I want to sent an Intent, to open youtube and let the user search the link. But there's no way to get the webpages the user visited once the intent was sent. I also tried to embed a Webbrowser but with the following code, the device just opens the browser... What else can I do to let the User brwose and then give me the link?

WebView engine = (WebView) findViewById(R.id.web_engine);  
engine.loadUrl("http://www.youtube.com");
engine.getSettings().setJavaScriptEnabled(true);  

<WebView android:id="@+id/web_engine"  
             android:layout_width="fill_parent"  
             android:layout_height="wrap_content"  
            />
user1200226
  • 67
  • 2
  • 9

1 Answers1

1

To my knowledge, there are not Android "link content providers". What I mean is, you generally give a link to a content browser (or the system), and have it do the hard work. The browser then handles all remaining links it encounters and knows how to handle. If you reach a content link that multiple programs handle and there is no default, then it will ask you how you wish to handle it. There is nothing that you can ask for links.

To do what you want, you need another method of feeding your application new content.

Let's assume you're making a youtube downloader.

Consider registering you application to recieve all youtube video view intents. Then, when the user clicks a video link, they have the option to open it with your downloader. When it's done, you can create an explicit intent to have the YouTube App (or the normal video app) play the newely downloaded video.

You might check this answer for more details.

If you're heartset on having the user browse for links in a webview then passing them back to your App, you might consider binding a JavaScript interface to your webview as explained here.

The other option is always copy and paste (=

Community
  • 1
  • 1
dcow
  • 7,765
  • 3
  • 45
  • 65