Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: How to load url in android webview intercepted from from intent?


I am completely new to android and java so pardon if asking something trivial. I have a Webview app which opens fine whenever someone clicks my website url from google search or from email. I have put following Code [Code 1] in AndroidManifest.xml . This is working really well. Whenever i click url of my website on android, the app opens.

Problem is I am not able to get the url from the Intent and load that in the webview app. For example when a user click on a link, it opens the app and launches the default in webview element. This is happening because i have not yet passed the data (url) received from intent and load that url in the webview.

I have the code to receive the intent and load webview [Code 2] but it is not working. The app crashed every time I open the app using intent (by clicking link from google search). I don't know where to put that code whether in or in some other file. It's a small code, please let me know what i am doing wrong.

[Code 1] ----------------------



[Code 1] ------------------------

[Code 2] ------------------------

Uri data = getIntent().getData();
String scheme = data.getScheme();
String fullPath = data.getEncodedSchemeSpecificPart();

combine = scheme+"://"+fullPath;

String url = null;
url = combine;

[Code 2] ------------------------

Declared combine as 'String combine = null;' at the start of the file.

I got this [Code 2] from StackOverflow itself but i am not getting where should i put this, in which file, under what function.

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered

This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: How to load url in android webview intercepted from from intent?


Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription