开发者

Browser: Open Default Home Page

开发者 https://www.devze.com 2023-04-05 05:53 出处:网络
Does anybody know how to open the default home page in Android? If I use this code, the browser will open www.google.com

Does anybody know how to open the default home page in Android? If I use this code, the browser will open www.google.com

Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(i);

but, how can I instruct the browser to open the home page?

Do I need to get the home page from the Browser开发者_JS百科 settings (how??) first or it just a matter of adding a flag to the intent?


According to this link, this is what you need to do:

String packageName = "com.android.browser"; 
String className = "com.android.browser.BrowserActivity"; 
Intent internetIntent = new Intent(Intent.ACTION_VIEW);
internetIntent.addCategory(Intent.CATEGORY_LAUNCHER); 
internetIntent.setClassName(packageName, className); 
mHomeActivity.startActivity(internetIntent);
0

精彩评论

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