这是我的代码,我正在尝试从 RSS 提要加载解析的数据。但我仅使用 google.com 测试我的应用程序,但出现错误。
public class WebsiteOpen extends Activity {
WebView web;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_website_open);
Intent intent = getIntent();
String message = intent.getStringExtra("rss-url");
web = (WebView) findViewById(R.id.webView1);
web.getSettings().setJavaScriptEnabled(true);
web.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
Toast.makeText(WebsiteOpen.this, description,
Toast.LENGTH_SHORT).show();
}
});
web.loadUrl("http://google.com");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.website_open, menu);
return true;
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
web.saveState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
web.restoreState(savedInstanceState);
}
}
这是我的清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.itcuties.multicategoryrssreader"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_dilc"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.itcuties.multicategoryrssreader.RssTabsActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.itcuties.multicategoryrssreader.RssChannelActivity" />
<activity android:name="com.itcuties.multicategoryrssreader.Upfm" />
<activity
android:name="com.itcuties.multicategoryrssreader.listeners.WebsiteOpen"
android:label="@string/title_activity_website_open"
android:configChanges="orientation|screenSize" >
</activity>
</application>
</manifest>
请帮帮我。谢谢你。