How can I get the current page's url of the web browser?

by Dorothy » Wed, 16 Apr 2008 13:52:39 GMT


Sponsored Links
 Hi all,

Could someone tell me how to access the current page's content or url
of the web browser from another android application?

Thanks a lot. :)

D
--~--~---------~--~----~------------~-------~--~----~



How can I get the current page's url of the web browser?

by Megha Joshi » Thu, 17 Apr 2008 19:00:20 GMT


 Hi,

You can use WebView's getUrl() method to retrieve a URL for the current
page:
 http://code.google.com/android/reference/android/webkit/WebView.html #getUrl()< http://code.google.com/android/reference/android/webkit/WebView.html #getUrl%28%29>

Thanks,
Megha





--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


How can I get the current page's url of the web browser?

by Dorothy » Fri, 18 Apr 2008 12:12:46 GMT


 I've tried:

String[] mColumnStrings =
        { Browser.SearchColumns._ID,
                Browser.SearchColumns.URL,
                Browser.SearchColumns._COUNT,
                Browser.SearchColumns.DATE
        };

Cursor c = getContentResolver().query(Browser.SEARCHES_URI,
        mColumnStrings, null, null, null);

But the return is always null, I don't understand...

Someone can help me?

Thanks

D
--~--~---------~--~----~------------~-------~--~----~



How can I get the current page's url of the web browser?

by Dorothy » Fri, 18 Apr 2008 15:06:48 GMT


 Hi, Megha

It seems to me that WebView is to create a new browser in a
application. That's not exactly what I want.
I wonder if I can get the current page from the default web browser, I
want my application just to listen to the default browser and to do
something when the current page interests me. Will that be possible?
I've found android.provider.Browser, but I didn't find the way to get
the current uri yet.

Thanks,

D
--~--~---------~--~----~------------~-------~--~----~



How can I get the current page's url of the web browser?

by Megha Joshi » Fri, 18 Apr 2008 18:59:34 GMT


 Hi,

It is not possible to get information from one application to another,
unless exposed by contentproviders, due to security concerns.
Browser.SEARCHES_URI only returns strings the user puts in the GOTO box and
picks Google Search. To get all the urls visited, you could use
Browser.BOOKMARKS_URI.

Thanks,
Megha





--~--~---------~--~----~------------~-------~--~----~



How can I get the current page's url of the web browser?

by Dorothy » Mon, 21 Apr 2008 08:22:44 GMT


 Thanks Megha, it's very nice of you.

Hv a nice day :)
--~--~---------~--~----~------------~-------~--~----~



How can I get the current page's url of the web browser?

by Dorothy » Mon, 21 Apr 2008 08:25:38 GMT


 Thanks Megha, that's very nice of you.

Hv a nice day :)
--~--~---------~--~----~------------~-------~--~----~