Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS entry content not showing #1

Open
ghost opened this issue Apr 5, 2013 · 9 comments
Open

RSS entry content not showing #1

ghost opened this issue Apr 5, 2013 · 9 comments
Assignees

Comments

@ghost
Copy link

ghost commented Apr 5, 2013

After I updated the node names for my RSS feed, I get the entries in list view.
But selecting one entry only shows an empty details page.

Checking the sources, I found that the item_id is passed to a new ArticleDetailFragment activity

detailIntent.putExtra(ArticleDetailFragment.ARG_ITEM_ID, id);

which creates a new fragment setting the item_id as String

arguments.putString(ArticleDetailFragment.ARG_ITEM_ID,getIntent().getStringExtra(ArticleDetailFragment.ARG_ITEM_ID));

but the fragment only sets displayedArticle if the Article.KEY is set and I can't find where it handles the item_id.
Am I wrong? Solution for this?

@ghost ghost assigned robhinds Apr 15, 2013
@eRGoon
Copy link

eRGoon commented Apr 17, 2013

I did the following:
In ArticleListActivity:

        //load article details to main panel
        Bundle arguments = new Bundle();
        arguments.putSerializable (Article.KEY, selected);

        if (mTwoPane) {
            ArticleDetailFragment fragment = new ArticleDetailFragment();

            fragment.setArguments(arguments);

            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.article_detail_container, fragment)
                    .commit();

        } else {
            Intent detailIntent = new Intent(this, ArticleDetailActivity.class);

            detailIntent.putExtra("arguments", arguments);

            startActivity(detailIntent);
        }

in ArticleDetailActivity:

        if (savedInstanceState == null) {
            Bundle arguments = getIntent().getBundleExtra("arguments");
            ArticleDetailFragment fragment = new ArticleDetailFragment();

            fragment.setArguments(arguments);

            getSupportFragmentManager().beginTransaction()
                    .add(R.id.article_detail_container, fragment)
                    .commit();
        }

@davidedesio
Copy link

Dear eRGoon,
your code create another issue in ArticleDetailFragment pointing out a NullPointerException on line:

ArticleListFragment fragment = (ArticleListFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.article_list);

Any idea to solve this?

@eRGoon
Copy link

eRGoon commented May 28, 2013

Hi BeDave,

are you sure about this? I cannot find such line in ArticleDetailFragment.

@davidedesio
Copy link

Yep, i'm pretty sure about this.
Search for "onOptionsItemSelected(MenuItem item)" method and look in
"else if (id == R.id.actionbar_markunread)" statement.
It controls the behavior of mark as unread button in article detail
view.

@koesie10
Copy link

koesie10 commented Jun 7, 2013

Indeed, the fragment cannot be found. If I just get the fragment it already returns null.

ArticleListFragment fragment = (ArticleListFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.article_list);

However, it only does so when running in a one pane layout. If you are on a tablet, it doesn't happen when you mark it as unread. Unfortunately, I've not been able to fix it, so my solution is removing the menu item on one-pane layouts using this:
In ArticleListActivity:

    private static boolean mTwoPane; // change to static

    public static boolean isTwoPane() {
        return mTwoPane;
    }

In ArticleDetailFragment:

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.detailmenu, menu);
        if (!ArticleListActivity.isTwoPane()) { // add this
            menu.removeItem(R.id.actionbar_markunread);
        }
    }

    // if you want extra security

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (id == R.id.actionbar_saveoffline) {
            Toast.makeText(getActivity().getApplicationContext(),
                    R.string.saved_for_offline, Toast.LENGTH_LONG).show();
            return true;
        } else if (id == R.id.actionbar_markunread) {
            db.openToWrite();
            db.markAsUnread(displayedArticle.getGuid());
            db.close();
            displayedArticle.setRead(false);
            try {
                ArticleListAdapter adapter = (ArticleListAdapter) ((ArticleListFragment) getActivity()
                        .getSupportFragmentManager().findFragmentById(
                                R.id.article_list)).getListAdapter();
                adapter.notifyDataSetChanged();
            } catch (NullPointerException e) {
            }
            return true;
        } else {
            return super.onOptionsItemSelected(item);
        }
    }

@bgupta55
Copy link

@eRGoon Solution worked for me, Thank You !!

@randhika
Copy link

not working buddy..

@andrejonn31
Copy link

As for me, i didnt get any feeds in the list view at all even after leaving it for a few minutes. i have used the rss feeds of NYT, http://rss.nytimes.com/services/xml/rss/nyt/World.xml, Aljazeera: http://www.aljazeera.com/xml/rss/all.xml, still the samething. i am stuck here

@pengjfcn
Copy link

pengjfcn commented Mar 8, 2016

while after loading about 15sec , the app has stopped,why ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants