我创建了一个应用程序,只需打开Web浏览器并转到特定网站。但是,在第一次运行后,如果我再去另一个应用程序并再次运行应用程序,除黑屏外我什么也得不到。我知道我可以从网络浏览器中找到该页面,但是我不知道是否有一种方法可以在启动应用程序时将内容恢复,并且用户可以从他/她停止的位置重新开始工作。从Android应用程序中打开Web浏览器
这里是我的代码:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/** setup the url and start a browser with
* the hotmial.com and return to the user
* */
String url = "http://www.hotmail.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
谢谢你们
谢谢Bryan,但将我的意图转移到onstart会导致每次启动时显示相同的网页。比如说,如果我正在发送电子邮件的过程中,我会去听我的音乐,当我回来开始我的应用程序时,则会丢失我的电子邮件。所以我需要的是回到中断前的位置,而不是新的页面。 – Raymond 2010-11-04 16:23:13