简体   繁体   中英

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

I have a question about my rss feed. My rss feed is working just fine, but it opens the feed in an Android Browser. 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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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