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

The Archive Base Latest Questions

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

got a few problem here and hoping that you could help me out. Let

  • 0

got a few problem here and hoping that you could help me out.

Let me first clarify the situation:

I have a static array of Integer in which inside was a R.drawable.images. Codes are as follows

private   Integer[] imageIDs = {
            //R.drawable.medal_my_first_perxtamp,
            R.drawable.medal..._gray,
            R.drawable.medal_y...te_me_gray,
            R.drawable.medal_t...ring_gray,
            R.drawable.medal_gi...ray,
            R.drawable.medal_a..._gray,
            R.drawable.medal_se..gray,
            R.drawable.medal_p...._gray,
            R.drawable.medal_m..._gray,
            R.drawable.medal_lo.._gray,
            R.drawable.m..._gray,
            R.drawable.med..,
            R.drawable.med..on_gray
          };

Now what I am trying to do is change the value of imageIDs based on a condition so now ive added this code on getview

       sqlAdapter = new SQLiteAdapter(mContext);
        sqlAdapter.openToRead();
        List<Integer> imageIDList = Arrays.asList(imageIDs);
        String query2="Select achievementID  from achievementdata_tb where memberID = 101";
        Cursor cursor2 =sqlAdapter.read(query2);
        if (cursor2 != null && cursor2.moveToFirst()) {
            while(cursor2.moveToNext()){

                val =cursor2.getString(0);
                int val2 = Integer.parseInt(val);
                String returnDrawable = getDrawables(val);
                int intReturnDrawable = Integer.parseInt(returnDrawable);
                imageIDList.set(val2, intReturnDrawable);
            }
        }

Note that I am getting values from database(achievement_ID) and the values is (6,2,3)

So what I did is get the cursor’s item one by one and check it on a public void getDrawables consist of

        public String getDrawables(String str){
        if (str.equals("3")){
            str= "R.drawable.med...g";
        }
        else if (str.equals("2")){
            str= "R.drawable.med..._me";
        }
        else if (str.equals("6")){
            str= "R.drawable.me...._up";
        }
        return str; 
    }

See that I want to change the value of array imageIDs (which is a drawable) to another drawable image.

I dont have any error so I use debugger and found out that I am getting an error on this part int intReturnDrawable = Integer.parseInt(returnDrawable);

I am new to andriod but i know some basic functionalities..
Could you help me solve this out?

  • 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-10T19:15:02+00:00Added an answer on June 10, 2026 at 7:15 pm

    You can’t because, the return type of getDrawable() is String. And the String like "R.drawable.med...g" can’t parse to Integer.

    So change the implementation of getDrawable() return proper int value ..

    Instead do something like,

    public int getDrawables(String str){
            int value = 0;
            if (str.equals("3")){
                value = R.drawable.med...g;
            }
            else if (str.equals("2")){
                value = R.drawable.med..._me;
            }
            else if (str.equals("6")){
               value = R.drawable.me...._up;
            }
            return value; 
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Got a few problem here. I have created a arrays of EditText and it
Here's the situation: I have a web-based ticket application, multiple users. One problem that
I've got a few controllers here at work that contain methods I can use
Hello fellow programmers, got a few problem here. I am adding a user control
I can't figure out what's happening here. I've got a few lists set up,
I got an interesting problem: file1.csv has a few hundred rows like: Code,DTime 1,2010-12-26
I have probem / strange question, i got algorithm with few for loops and
i have form in drupal which uploads images and has got few checkboxes in
So I have googled whole day, got few answers how to do this, and
I got a few WCFs that are running on an intranet on IIS 7.

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.