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 8952421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:52:10+00:00 2026-06-15T13:52:10+00:00

For an application which I am currently building in Java for Android I am

  • 0

For an application which I am currently building in Java for Android I am looking for the following. I have a set with lets say 10 database records. For each row i want to show an activity (which is every time the same activity). The activity has some fields for each row to be updated.

Lets say for example you have a record set with contacts and now you want to loop through al 10 contacts and update the data.

Now I am not sure how this should work in android. Should I use fragments for this? How should i model this. Some pseudo code would help.

Since this is a custom app I am developing for ICS

Thanks very much

  • 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-15T13:52:12+00:00Added an answer on June 15, 2026 at 1:52 pm

    Create FragmentActivity with ViewPager.

    ViewPager uses Adapter to display same fragments with different data.

    For example, if you store in database images ids which you want to display, the code will look like this.

    public class MyActivity extends FragmentActivity {
    
    public static class MyFragment extends Fragment {
        @Override
        public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
            final ImageView content = new ImageView(getActivity());
            content.setImageResource(getArguments().getInt("img"));
    
            return content;
        }
    }
    
    private class MyPagerAdapter extends FragmentStatePagerAdapter {
        private final ArrayList<Integer> imgs;
    
        public AppTourPagerAdapter(final FragmentManager fm, final ArrayList<Integer> imgs) {
            super(fm);
            this.imgs = imgs;
        }
    
        @Override
        public int getCount() {
            return imgs.size();
        }
    
        @Override
        public Fragment getItem(final int position) {
            final MyFragment fragment = new MyFragment();
            final Bundle args = new Bundle();
            args.putInt("img", imgs.get(position));
            fragment.setArguments(args);
            return fragment;
        }
    }
    
    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.my_activity);
    
        final ViewPager pager = (ViewPager) findViewById(R.id.pager);
        final ArrayList<Integer> imgIds = ... // get values from database
        pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager(), imgIds));
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a POS web application which currently executes a java applet on page
So I have this extremely memory-intensive Java application I'm building, which builds a tree
I'm currently building a quiz application for facebook, which would have a photo uploaded
I'm currently building a simple application on Gjs , which should change the background-image
I am currently building a very dynamic table for a list application, which will
I'm currently developing an Android application which needs to receive data from a bluetooth
I am currently working on an android application which requires reading data from bluetooth
I am currently building an application for Windows Phone 7 which has to play
I have a WP7 application which consumes a Windows Azure web service. I've currently
I'm currently building a Spring MVC application. I was looking to use JSP pages

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.