I want to open the page ya.ru in the native browser. That's what I have
list.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
String url = "http://ya.ru";
Intent intent1 = new Intent(Intent.ACTION_VIEW);
intent1.setData(Uri.parse(url));
startActivity(intent1);
}
});
Could you tell me what I should write in uses-permissions
except
<uses-permission android:name="android.permission.INTERNET" />
or is there anything wrong in the code?
Try
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.ya.ru"));
startActivity(intent);
And in AndroidManifest.xml you have to write:
<uses-permission android:name="android.permission.INTERNET" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.