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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:02:59+00:00 2026-06-18T06:02:59+00:00

I have been for the past several hours trying to do something that I

  • 0

I have been for the past several hours trying to do something that I think should be trivial. I keep reading answers on stackoverflow but its not jiving with me. people show examples of ArrayAdapters accepting string ArrayLists on stackoverflow. This is just not working for me.

Populating a ListView using an ArrayList?

I am trying to understand what is going on here. If I am dealing with an arraylist of type String that means that the only thing I can bind the data to is a textview and certainly not a listview unless I create my own custom link adapter class? This just seems like I am missing some information. I would thing this problem would be so common a solution would have been made. My code is below and I am getting the “E/ArrayAdapter(5106): You must supply a resource ID for a TextView” error.

public class Favorites extends Activity{
UserFunctions userFunctions  = new UserFunctions();

ArrayAdapter<String> arrayAdapter1;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.favoritespage);
    arrayAdapter1 = new ArrayAdapter<String>(Favorites.this,android.R.layout.activity_list_item);
    new DownloadDataTask().execute();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_main_screen, menu);
    return true;
}

   private class DownloadDataTask extends AsyncTask<JSONArray, JSONArray, ArrayList<String> > {


        @Override
        protected ArrayList<String> doInBackground(JSONArray... params) {
            JSONArray json = userFunctions.ziplistrequest("39", "-74", "50");
            ArrayList<String> zipcodes = new ArrayList<String>();
            for(int i=0; i < json.length() ; i++) {
                JSONObject jarray = null;
                try {
                    jarray = json.getJSONObject(i);
                    String zip = jarray.getString("ZIPCODE");
                    zipcodes.add(zip);
                    arrayAdapter1.add(zip);
                    Log.d(zip,"Output");
                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return zipcodes;
        }   
        protected void onPostExecute(ArrayList<String> result){
            ListView listView = (ListView) findViewById(R.id.list);
            arrayAdapter1.addAll(result);
            listView.setAdapter(arrayAdapter1);
        }
    }

}

  • 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-18T06:03:00+00:00Added an answer on June 18, 2026 at 6:03 am

    Try using android.R.layout.simple_list_item1 instead of ‘android.R.layout.activity_list_item`

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

Sidebar

Related Questions

I realize that this question may have been asked several times in the past,
I know there have been several questions in the past regarding things that compile
There have been several questions over the past few days about the proper use
I have been trying for the past two days now to implement Admob ads
I have been searching for the past through days, trying to figure out how
There have been a couple of threads on this topic in the past that
Over the past several years I have been using the naming convention of FirstNameTxt
I have been trying to set up OpenCV for the past few days with
For the past several days I've been trying to send confirmation emails from my
I've been working on this for the past several days and have been stuck.

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.