Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8522649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:11:02+00:00 2026-06-11T07:11:02+00:00

so I have run now with this problem when trying to use FragmentStatePagerAdapter with

  • 0

so I have run now with this problem when trying to use FragmentStatePagerAdapter with the Loader API but no values are set in the UI I mean when the onLoadFinished() is done and set the values to the TextView, ImageView and changeCursor to my Adapter it does not reflect it, I see the UI as I set it in XML.

Let’s see if I can explained the issue clearly.

I have a list and when a item is tap will get you to a detail view of this. When an item is selected two elements are sent to the detail, ids array and the position of the item selected.

listView.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
                Intent intent = new Intent(ActionConstant.DETAIL);

                intent.putExtra("ids", ids);
                intent.putExtra("position", position);
                startActivity(intent);
            }
        });

So in the DetailActivity there is a ViewPager which has a FragmentStatePagerAdapter that uses the ids and the position to load the proper data.

@Override
    public void onCreate(Bundle savedIntanceState) {

        super.onCreate(savedIntanceState);
        setContentView(R.layout.detail);
        ids = getIntent().getLongArrayExtra("ids");
        int currentIndex = getIntent().getIntExtra("position",-1);

        mPagerAdapter = new DetailPagerAdapter(getSupportFragmentManager());

        // Set up the ViewPager, attaching the adapter.
        mViewPager = (ViewPager) findViewById(R.id.pager);

        mViewPager.setAdapter(mPagerAdapter);
        mViewPager.setCurrentItem(currentIndex);

    }

And the DetailPagerAdapter override getItem and getCount (which return ids.length)

        @Override
        public Fragment getItem(int i) {
            return DetailFragment.newInstance(ids[i]);
        }

Now in the DetailFragment the newInstance does this

public static DetailFragment newInstance(long id) {
DetailFragment f = new DetailFragment();

    // Supply num input as an argument.
    Bundle args = new Bundle();
    args.putLong("_id", id);
    f.setArguments(args);

    return f;
}

and When onLoadFinished is call.

@Override
    public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {

        if (loader.getId() == 1)
            adapter.changeCursor(cursor);
        else if (loader.getId() == 2) {
            if (!cursor.moveToNext())
                return;

            textName.setText(cursor.getString(cursor.getColumnIndexOrThrow(TraderColumns.NAME)));


    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:11:03+00:00Added an answer on June 11, 2026 at 7:11 am

    Eureka, What was happening was fairly trivial and makes a lots of sense, I had in my onResume() of the Fragment

    getActivity().getSupportLoaderManager().restartLoader(CONTACT_REQUEST, null, this);
    
    getActivity().getSupportLoaderManager().restartLoader(TRADER_DETAIL_REQUEST, null, this);
    

    So this would use the supportLoader manager of the activity and since is one instance it got all my views mess up. instead I use:

    getLoaderManager().restartLoader(CONTACT_REQUEST, null, this);

    getLoaderManager().restartLoader(TRADER_DETAIL_REQUEST, null, this);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have followed this tutorial here as mentioned exactly I now try to run
I have the following query, now the strange thing is if I run this
I'm trying to understand how this functional reactive programming works, and I have run
I have run into another problem in relation to a site I am trying
This problem has got me stumped for a few days now. I have a
I have been trying to find a good solution to this problem for a
I'm trying to use flymake to run pyflakes, as suggested here This works fine
I've been working on this problem for 7 hours now, and I still have
I'm writing a PHP framework right now, and have run into somewhat of a
We have a script right now which our Windows users run on a Linux

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.