簡體   English   中英

Android Rss Feed(在不在瀏覽器中的應用程序內打開)

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

我對我的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);
}

您必須創建新活動才能接收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()));
}

在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