-6

So I'm making a app that views certain surveys on the device, but the thing is that the device doesn't want to load the webview. How would I go about changing the button to instead open the survey link in google?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

2 Answers2

0
Button.setOnClickListener(new OnClickListener() {
    @Override 
    public void onClick(View v) {
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_VIEW);
        intent.addCategory(Intent.CATEGORY_BROWSABLE);
        intent.setData(Uri.parse("http://www.yourURL.com"));
        startActivity(intent);
    }
});
V-rund Puro-hit
  • 5,518
  • 9
  • 31
  • 50
Manish Ahire
  • 550
  • 4
  • 19
0

On Button click (onClick) set this event:

Uri link = Uri.parse("http://www.yourwebsite.xx"); 
Intent intent = new Intent(Intent.ACTION_VIEW, link);
startActivity(intent);

This will open you URL.

arst3k
  • 976
  • 2
  • 8
  • 18