How to send url to Intent in Android

This code will open the link in your Android browser. We suppose you have an Activity and you did the correct imports :

 

String url = "http://www.tutoref.com";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);

 

The necessary imports are:

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

 

You like this content ? Share it with you entourage !

Leave a Reply

Your email address will not be published.