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

  • SEARCH
  • Home
  • 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 9033951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:21:28+00:00 2026-06-16T08:21:28+00:00

I am using view-pager.In that I have three tabs : 1. History , 2.

  • 0

I am using view-pager.In that I have three tabs : 1. History , 2. Main , 3. Map .

I have stopwatch into main activity.When I press the start and then after stop at that time value of the stopwatch add into the sqlite DB. And into history activity I am fetching the value of stopwatch from DB and store into the listview. It’s working perfect.

But now I want the update the History activity when I swipe from the Main > History so After press the stop button,I got the last value into listview of history activity.

My question is how can I update the view on swipe the viewpager?

public class SwipeyTabsSampleActivity extends FragmentActivity {

private static final String [] TITLES = {
    "HISTORY", 
    "MAIN",
    "MAP"  

};

private SwipeyTabs mTabs;
private ViewPager mViewPager;
//Handler handler=new Handler();

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_swipeytab);

    mViewPager = (ViewPager) findViewById(R.id.viewpager);
    mTabs = (SwipeyTabs) findViewById(R.id.swipeytabs);

    SwipeyTabsPagerAdapter adapter = new SwipeyTabsPagerAdapter(this,
            getSupportFragmentManager());
    mViewPager.setAdapter(adapter);
    mTabs.setAdapter(adapter);
    mViewPager.setOnPageChangeListener(mTabs);
    mViewPager.setCurrentItem(1); 
    mViewPager.setOffscreenPageLimit(3);


}

 private class SwipeyTabsPagerAdapter extends FragmentPagerAdapter implements
        SwipeyTabsAdapter, ViewPager.OnPageChangeListener {

    private final Context mContext;
    ViewPager viewpager;



    public SwipeyTabsPagerAdapter(Context context, FragmentManager fm, ViewPager mViewPager) {
        super(fm);

        this.mContext = context;
        viewpager = mViewPager;

        //viewpager.setAdapter(this);
        viewpager.setOnPageChangeListener(this);

    }

    @Override
    public Fragment getItem(int position) {

         Fragment f = new Fragment();

        switch (position) {
        case 0:
            f = History.newInstance(position);

            break;
        case 1:
            f = Main.newInstance(position);
            break;
        case 2:
            f = Map.newInstance(position);

            break;

        }
        return f;

    }

    @Override
    public int getCount() {
        return TITLES.length;
    }


     @Override
        public void destroyItem(ViewGroup container, int position, Object object) {

            ViewPager pager = (ViewPager) container;
            View view = (View) object;

            pager.removeView(view);
        }



    public TextView getTab(final int position, SwipeyTabs root) {
        TextView view = (TextView) LayoutInflater.from(mContext).inflate(
                R.layout.swipey_tab_indicator, root, false);
        view.setText(TITLES[position]);
        view.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                mViewPager.setCurrentItem(position);

            }
        });

        return view;
    }

    @Override
    public void onPageScrollStateChanged(int state) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onPageSelected(int positiion) {
        // TODO Auto-generated method stub

    }

}

}
  • 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-16T08:21:29+00:00Added an answer on June 16, 2026 at 8:21 am

    Take one string and add the Getters and setters into your FragmentActivity class.

    Like…

    String HistoryFragment;
    
    public String getHistoryFragment() {
        return HistoryFragment;
    }
    
    
    public void setHistoryFragment(String historyFragment) {
        HistoryFragment = historyFragment;
    }
    

    Then after we can access another fragment from our current fragment by calling findFragmentByTag(<tag of target fragment>).

    For the more information check the link Communication between Fragments in ViewPager.

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

Sidebar

Related Questions

I have three view model bindings attached to a single page using the following
I am using View Pager for showing 3 Fragments in an activity(Dashboard.java). The activity
I wanna create an app that will have three view controllers. To navigate between
I have a Tab Control that contains a ListView, there are three Tabs, each
Hope you guys can help, I have a activity that has tabs, each tab
I'm developing a single-page view for a resource that contains multiple nested resources. Using
I'm using Spree 0.70. In my home page view, I have the following to
Using ASP MVC and Entity Framework. In the view, you have a page declaration
I have a page that has three divs one at the top, one at
From what I have done in past(before using knockoutjs) I would call the tabs()

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.