我有一个用于 rss 阅读器的 android 应用程序。
它读取 URL 并在列表视图中显示信息。现在我尝试单击项目时在 webview 中显示链接但没有用。
这是代码示例。
谢谢你的帮助。
public class RssReaderActivity extends Activity implements AsyncTaskCompletionListener{
private ListView listview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.rss_reader);
listview=(ListView)findViewById(R.id.rssfeed_listview);
if(Utility.determineConnectivity(this))
new RssFeedAsyncTask(this).execute(Utility.url);
else
Toast.makeText(this, "No Internet Connection", Toast.LENGTH_SHORT).show();
listview.setVerticalFadingEdgeEnabled(true);
listview.setOnItemClickListener(onItemClickListener);
}
private OnItemClickListener onItemClickListener = new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
RssFeedStructure data = (RssFeedStructure) listview.getItemAtPosition(arg2);
postInfo.putString("content", data.getUrl().toString());
Toast.makeText(getApplicationContext(), data.getUrl().toString(), Toast.LENGTH_SHORT).show();
Intent postviewIntent = new Intent(getApplicationContext(), DisPlayWebPageActivity.class);
postviewIntent.putExtras(postInfo);
startActivity(postviewIntent);
}
};
@Override
public void onTaskComplete(List<RssFeedStructure> result) {
RssReaderListAdapter _adapter= new RssReaderListAdapter(RssReaderActivity.this,
result);
listview.setAdapter(_adapter);
}