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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:51:51+00:00 2026-06-08T10:51:51+00:00

Im trying to solve this problem for about 2 hours. So Im glad for

  • 0

Im trying to solve this problem for about 2 hours. So Im glad for every possible answer.
Ive got a custom ListViewAdapter and it takes his content from an Array. But I have 19 Arrays and I want to change the Content(therefor the Array) based on which date the User clicks(there is a Calendar on the top with 19 Dates).
Here is a picture:

enter image description here

So by default ervy time you open the App the content from the “date_1” Array will be shown(for the 25. in the calender). And when you click on an other date the content from the Array belonging to this date will be shown(e.g. 26. -> date_2, 27. date_3 and so on).
Every Array has to get load from the resources and is saved in a single Array Variable.

So my problem:
I can’t change the Array. Here is my code:

// this is the Array Variable:

   String[] day_chosen;
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.calender);
          [...]
            prepareArrayLits();
            lview3 = (ListView) findViewById(R.id.listView1);

            adapter = new ListViewCustomAdapter(this, itemList);
            lview3.setAdapter(adapter);

            lview3.setOnItemClickListener(this);

        }

        public void onItemClick1(AdapterView<?> arg0, View arg1, int position, long id) {
            // TODO Auto-generated method stub

        }

        /* Method used to prepare the ArrayList,
         */

        public void prepareArrayLits()
        {
            // this is where the Arrays get loaded from the resource:
             day_chosen = getResources().getStringArray(R.array.date_1);

//this Array is not relvant:
            String[] sports = getResources().getStringArray(R.array.sports_array);


            itemList = new ArrayList<Object>();
             for (int counter = 0; counter < day_chosen.length; counter+=4){


                 int Intparser = Integer.parseInt(day_chosen[counter+1]);


                 AddObjectToList(imgid(Intparser),  sports[Intparser],day_chosen[counter],day_chosen[counter+3], backgroundbox(Intparser)) ;
             }


        }

        // Add one item into the Array List
        public void AddObjectToList(int image, String title, String desc, String time, int backbox)
        {

            bean = new ItemBean();
            bean.setBackBox(backbox);
            bean.setTime(time);
            bean.setDescription(desc);
            bean.setImage(image);
            bean.setTitle(title);
            itemList.add(bean);
        }

       [...]
        }

        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            // TODO Auto-generated method stub

        }

// the onClick Events for every date:
        public void onClick(View v) {
            // TODO Auto-generated method stub




              switch(v.getId()){

              case R.id.d_1 :
// I tried to change the Array from here(But it didn't work):
                  day_chosen = getResources().getStringArray(R.array.date_1);


                  break;

              case R.id.d_2 :
                  day_chosen = getResources().getStringArray(R.array.date_2);

                  break;
              [...]

        }



    }

What have I tried:

  • I set up a Global Class but it didn’t work

  • I tried to set up getters and setters. But also didn’t work

I don’t know how to solve this. Every possible solution is appreciated, Thanks.

  • 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-08T10:51:53+00:00Added an answer on June 8, 2026 at 10:51 am

    I don’t know how you exactly implements your Adapter but did you call yourAdapter.notifyDataSetChanged() when your list content is changed?

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

Sidebar

Related Questions

I don't understand anything about IIS, but am trying to solve this problem of
I have been trying to solve this problem all day but haven't got any
I've been trying to solve this problem for about a week now. I posted
there's this problem about line crossings I saw somewhere and was trying to solve.
since I'm trying to solve this problem for some days, I thought about giving
I've been trying to think since HOURS about this TopCoder problem and couldn't come
Trying to solve this problem . I would like to learn how the bootstrapper
I am trying to solve this problem http://www.spoj.pl/problems/PEBBMOV/ . I think I have the
I'm trying to solve this problem in a pure-functional way, without using set! .
I was trying to solve this problem - http://www.spoj.pl/problems/LISA/ I thought of Greedy initially,

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.