今天在应用中动态生成WebView,然后设置要显示的html数据,结果运行后,点击网页的链接出现了错误:
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want
网上没找到答案,后来自己找到哪里出了问题。我开始这样创建WebView
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want
网上没找到答案,后来自己找到哪里出了问题。我开始这样创建WebView
WebView wv = new WebView(getApplecation());
改成:
WebView wv = new WebView(MainActivity.this);
这样就好了,可以点击链接在默认浏览器中浏览。
具体原因还不是很清楚,先知道怎么解决问题吧。