开发者

Browser: Open Default Home Page

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜