开发者

How do i perform an action on click of a particular link available on website?

I have an application in which i have added a menu.

Clicking on this menu opens up a website.

There is a list of links(zip files) available on this website.

开发者_如何学C

Clicking on a particular link should result in that zip file to be downloaded to the assets folder of my application.

I am able to load the website.

Code for this:

String url = "http://almondmendoza.com/android-applications/";  
Intent k = new Intent(Intent.ACTION_VIEW);  
k.setData(Uri.parse(url));  
startActivity(k);    

I am referring to the example given on this website

What i am curious to know is that whether it is possible to perform an action on click of a particular link available on website. If it is possible then how can i accomplish this task?


Use WebView to load webpage, you can recognize URL using following code

webView.setWebViewClient(new WebViewClient() { 
        public boolean shouldOverrideUrlLoading(WebView view, String url){
            webView.loadUrl(url); 
            // Here the String url hold 'Clicked URL' 
            return false; 
        } 
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜