I want to load a web page after pressing a button how it is possible in android?
            Asked
            
        
        
            Active
            
        
            Viewed 509 times
        
    2
            
            
        - 
                    possible duplicate of [Android: Sending an Intent to Browser to open specific URL](http://stackoverflow.com/questions/3004515/android-sending-an-intent-to-browser-to-open-specific-url) – Vladimir Ivanov May 23 '11 at 11:22
1 Answers
3
            Either you have to write a clicklistener for the button and inside onClick() give the below code :
Uri uri = Uri.parse(give ur website address over here);
startActivity(new Intent(Intent.ACTION_VIEW, uri));
Or in the layout file for the button tag, you give the property android:onClick and give its value as the method name.
For eg:
android:onClick="openWebsite"
and in activity give:
public void openWebsite(View view) {
    Uri uri = Uri.parse(give ur website address over here);
    startActivity(new Intent(Intent.ACTION_VIEW, uri));
}
 
    
    
        Anju
        
- 9,379
- 14
- 55
- 94
 
    