简体   繁体   English

Android Rss Feed(在不在浏览器中的应用程序内打开)

[英]Android Rss Feed (open inside an app not in a browser)

I have a question about my rss feed. 我对我的RSS Feed有疑问。 My rss feed is working just fine, but it opens the feed in an Android Browser. 我的RSS Feed运行正常,但它会在Android浏览器中打开Feed。 I am wondering is there a way to open it inside an app not in a browser? 我想知道有没有办法在不在浏览器中的应用程序中打开它? (if it opens in a browser, there is no point for me to build this) (如果它在浏览器中打开,我就没有意义构建它)

This is the lines I believe it opens in a browser 这是我认为它在浏览器中打开的行

@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);
}

You Have to create New Activity to receive RSS feed 您必须创建新活动才能接收RSS源

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()));
}

in EbookDescriptionActivity.class you can receive the link and handle it in your layout 在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");
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM