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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:50:42+00:00 2026-06-05T04:50:42+00:00

This is My main Class public class EndlessAdapterDemo extends Activity { private ListView mListView;

  • 0

This is My main Class

public class EndlessAdapterDemo extends Activity  {

    private ListView mListView;
    private ProgressDialog dialog;
    private OutletsXmlHandler mOutletXmlHandler;
    private FetchAndParseData getDownloadedData;
    private OutletListAdapter mOutletListAdapter;
    public InputStream inputStream;
    private ArrayList<Outlets> outletList;


  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.list_tab);


    mListView = (ListView) findViewById(R.id.listView1);
    mOutletXmlHandler = new OutletsXmlHandler();
    dialog = new ProgressDialog(this);
    dialog.setMessage("Loading");
    dialog.setCancelable(false);

    new MyTask().execute();  
  }
}



    **And in MyTask class i am doing following**

        public class MyTask extends AsyncTask<Void, Void, Void> {

            @Override
            protected void onPreExecute() {

                super.onPreExecute();
                dialog.show();
            }

        @Override
        protected Void doInBackground(Void... params) {

            try {                           
                getDownloadedData = (FetchAndParseData) new FetchAndParseData().execute("http://184.106.222.195/zootapi/index.php/api/outlets/searchoutlets/token/something/cityid/83/parameters/&cu=American&s=Air$Conditioned");

                inputStream = getDownloadedData.get();
                XmlUtilities.parseAndLoadData(inputStream , mOutletXmlHandler);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ExecutionException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }


            return null;
        }

        @Override
        protected void onPostExecute(Void result) {         
            super.onPostExecute(result);

            outletList = Project.getOutletList();//Project.getOutletList();             
            mListView.setAdapter(new DemoAdapter(outletList));

            if(dialog.isShowing()){
                dialog.dismiss();
            }

        }
    }


**Now in this Demo Adpapter i am extending it with EndlessAdpater**


 class DemoAdapter extends EndlessAdapter {
    private RotateAnimation rotate=null;

    DemoAdapter(ArrayList<Outlets> outletList) {
      super(new OutletListAdapter(EndlessAdapterDemo.this, outletList));

      rotate=new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF,
                                  0.5f, Animation.RELATIVE_TO_SELF,
                                  0.5f);
      rotate.setDuration(600);
      rotate.setRepeatMode(Animation.RESTART);
      rotate.setRepeatCount(Animation.INFINITE);
    }

    @Override
    protected View getPendingView(ViewGroup parent) {
      View row=getLayoutInflater().inflate(R.layout.row, null);

      View child=row.findViewById(android.R.id.text1);

      child.setVisibility(View.GONE);

      child=row.findViewById(R.id.throbber);
      child.setVisibility(View.VISIBLE);
      child.startAnimation(rotate);

      return(row);
    }

    @Override
    protected boolean cacheInBackground() {
        try {                           
            getDownloadedData = (FetchAndParseData) new FetchAndParseData().execute("http://184.106.222.195/zootapi/index.php/api/outlets/fetchoutlets/token/something/cityid/76/verticalid/1");

            inputStream = getDownloadedData.get();
            XmlUtilities.parseAndLoadData(inputStream , mOutletXmlHandler);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ExecutionException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

      return true;
    }

    @Override
    protected void appendCachedData() {

        outletList = Project.getOutletList();//Project.getOutletList();             
        mListView.setAdapter(new DemoAdapter(outletList));
   }
  }

**Now in this Source Code when the list reaches at the end the data is loaded successfully into the list view from web service bt previous data had been lost..

can anyone please help me… i am in deep trouble in 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-05T04:50:43+00:00Added an answer on June 5, 2026 at 4:50 am

    You are creating a new DemoAdapter each time.

    Change your appendCachedData to get the wrappered adapter and then add your extra elements to it:

    @Override
    protected void appendCachedData() {
        OutletListAdapter adptr = (OutletListAdapter) getWrappedAdapter();
        if (outletList!=null) {
            for (<T> addThis : outletList) {
                adptr.add(addThis);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class main extends Activity { EditText username,password1; Button sub; String uname,pass; @Override public
I have a class like this: public class A { public static void main()
My coworker did this experiment: public class DoubleDemo { public static void main(String[] args)
Take a look at this code: public class Test { public static void main(String...
in java we can do this: public class A{ public static void main(String...str){ B
Does anyone know why this doesn't compile? public class ArrayCompare{ public static void main
This is my main class code: public static void main(String[] args) { JFrame f=
I have this simple interface/class: public abstract class Message {} public class Message1 extends
Hi Friends i have written an Activity like below. SplashScreen.java public class SplashScreen extends
This is the class I am trying instantiate into my main class: public class

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.