我一直沒有編程很久,我被困在一個RSS訂閱源問題,我已經編程了一個rss訂閱到我的應用程序,我無法得到URL傳遞給瀏覽器打開我不斷收到geturl上的錯誤並獲取intent行我希望這段代碼執行的是geturl,並在webview中打開鏈接,這是我目前爲止的內容;製作一個RSS訂閱點擊
這是我RssActivity代碼
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<JSONObject> jobs = new ArrayList<JSONObject>();
try {
jobs = RssReader.getLatestRssFeed();
} catch (Exception e) {
Log.e("RSS ERROR", "Error loading RSS Feed Stream >> " + e.getMessage() + " //" + e.toString());
}
adapter = new RssListAdapter(this,jobs);
setListAdapter(adapter);
}@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
if (position == 2) {
adapter.getItem(position).getUrl().toString();
Intent intent = new Intent(this, Webb.class);
startActivity(intent);}
}}
這是我的網頁視圖;
public class Webb extends Activity ProgressDialog progressBar; public WebView webview; private static final String TAG =「Main」;
@Override
public void onStart()
{
super.onStart();
CookieSyncManager.getInstance().sync();
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle extras = this.getIntent().getExtras();
extras (Intent.putExtra("url", Url));
setContentView(R.layout.browser1);
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().startSync();
webview = (WebView) findViewById(R.id.webview);
webview.loadUrl(getIntent.getStringExtra("url"));
webview.setWebViewClient(new testClient());
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
]可能的重複[Making a RSS feed clickable](http://stackoverflow.com/questions/6087470/making-a-rss-feed-clickable) – kcoppock 2011-05-22 16:15:35