我对我的RSS Feed有疑问。我的RSS Feed运行正常,但它会在Android浏览器中打开Feed。我想知道有没有办法在不在浏览器中的应用程序中打开它? (如果它在浏览器中打开,我没有必要构建它)
这是我认为它在浏览器中打开的行
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
RssAdapter adapter = (RssAdapter) parent.getAdapter();
RssItem item = (RssItem) adapter.getItem(position);
Uri uri = Uri.parse(item.getLink());
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
答案 0 :(得分:2)
您必须创建新活动才能接收RSS Feed
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
LinearLayout linearLayout = (LinearLayout)arg1;
TextView textView = (TextView)linearLayout.findViewById(R.id.eBooksTitle);
startActivity(new Intent(MainActivity.this, EbookDescriptionActivity.class)
.putExtra("link_to_load", textView.getTag().toString()));
}
在EbookDescriptionActivity.class中,您可以收到链接并在布局中处理它
String web_link;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ebooks_details_activity);
web_link = getIntent().getExtras().getString("link_to_load");
}