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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:19:28+00:00 2026-06-12T22:19:28+00:00

I need a little help to understand how can I change my current implementation

  • 0

I need a little help to understand how can I change my current implementation of ViewFlow to android v4.ViewPager. Till now I was populating my views from ArayLists<?> with data. Now I need to use the same way I was doing it (if it’s possible) and use ViewPager from Android SDK. Any suggestions would be great to understand how it’s working, because the examples that I found over internet are using tabs and etc. but I don’t need tabs.

Here is how I was using my adapter before :

public class WebViewAdapter extends BaseAdapter  {

private Activity activity;
private ArrayList<String> name;
private ArrayList<String> date;
private ArrayList<String> bodies;
private static LayoutInflater inflater = null;

public WebViewAdapter(Activity a, ArrayList<String> names, ArrayList<String> dates, ArrayList<String> body) {
    this.activity = a;
    this.name = names;
    this.date = dates;
    this.bodies = body;
    inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

public int getCount() {
    return name.size();
}

public Object getItem(int position) {
    return position;
}

public long getItemId(int position) {
    return position;
}

public static class ViewHolder {
    public TextView title, date;
    public WebView body;
}

public View getView(int position, View convertView, ViewGroup parent) {
    View vi = convertView;
    ViewHolder holder;
    if (convertView == null) {
        vi = inflater.inflate(R.layout.article_layout, null);
        holder = new ViewHolder();
        holder.title = (TextView) vi.findViewById(R.id.article_title);
        holder.date = (TextView) vi.findViewById(R.id.date);
        holder.body = (WebView) vi.findViewById(R.id.body);


        vi.setTag(holder);
    } else
        holder = (ViewHolder) vi.getTag();
        holder.title.setText(name.get(position).toString());
        holder.date.setText(date.get(position).toString());
        holder.body.loadDataWithBaseURL(null, bodies.get(position).toString(), "text/html", "utf-8", null);

    return vi;
}

}

And I was using it like this :

WebViewAdapter adapter = new WebViewAdapter(this, titles, dates, bodies);
viewFlow.setAdapter(adapter, pos);

Now I need the same result with the ViewPager implementation, because I am moving all my project to use Fragments and stuff from the new SDK API.

Any advices / suggestions / help how can I achieve this?

  • 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-12T22:19:29+00:00Added an answer on June 12, 2026 at 10:19 pm

    Instead of your adapter implement FragmentPagerAdapter. Invflate ViewPager as you did with ViewFlow and set the created adapter on it.
    Everything is pretty the same. The only difference – An adapter instatiates fragements and the fragments inflates views.

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

Sidebar

Related Questions

I need a little help with Android Shared Preferences. I'm trying to put a
Can someone help me understand JSONP a little better? I have a json file
I need a little help understanding how classes work in Actionscript 3. I understand
I need little help for url rewriting in wordpress. basically what i need: mydomain.com/mysomewordpresspost
I would need little help here. I'm trying to get the git respository from
Need a little help with a SQL / ActiveRecord query. Let's say I have
Need a little help with my jquery here I want all my button with
I need a little help with an if statement in php. I'm trying to
I need a little help setting up a HTTP Post in C#. I appreciate
I need a little help getting this script doing what I want it to.

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.