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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:21:41+00:00 2026-06-06T02:21:41+00:00

I’ve just asked a question about an hour ago, while waiting for replies, I’ve

  • 0

I’ve just asked a question about an hour ago, while waiting for replies, I’ve thought maybe I can achieve what I want differently. I was thinking of changing the image but it would be better if I could perhaps overlay something over the top of complete levels in the gridview i.e a small tick icon
At the moment, when a level has been completed I am storing that with sharedpreferences

So I have a gridView layout to display images that represent levels. Let’s just say for this example I have 20 levels. When one level is complete is it possible to overlay the tick icon or somehow highlight the level image. Maybe change the border of the image??

Here are the image arrays I use

int[] imageIDs = {
   R.drawable.one,
   R.drawable.two,
   R.drawable.three,
   R.drawable.four,
   R.drawable.five,
   R.drawable.six
   etc.......

and then I have my code to set the images in gridView. Obviously there is more code in between.

public View getView(int position, View convertView, ViewGroup parent) 
{
   ImageView imageView;
   if (convertView == null) {
       imageView = new ImageView(context);
       imageView.setLayoutParams(new GridView.LayoutParams(140, 140));
       imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
       imageView.setPadding(5, 5, 5, 5);
   } else {
       imageView = (ImageView) convertView;
   }
   imageView.setImageResource(imageIDs[position]);
   return imageView;

would it be possible to do any of the above, even the border method would be fine.
Thanks for any help


When the level is open, I am using a switch case to do other tasks as well as change the item string to the name of the image it represents.

    switch(question){
    case 0:
        iv.setImageResource(R.drawable.one);
        item = imageOne;
                    answer1 = "one"         

    break;
    case 1:
        iv.setImageResource(R.drawable.two);
        item = imageTwo;
                    answer1 = "two"
    break;
    default:
    break;
    }

I’m then calling that string to save a boolean with the name of image

final boolean answerStatusCase = preferences.getBoolean(item, false);
final SharedPreferences.Editor editor = preferences.edit();

Button checkAnswer = (Button) findViewById(R.id.bCheckAnswer);
    checkAnswer.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            String yourAnswerCheck = yourAnswerReview.toString();

            if (yourAnswerCheck.equals(answer1)) {
                Toast.makeText(getBaseContext(), "That's correct", 2000).show();

                    editor.putBoolean(item, true);
                    editor.commit();    

            }else{
                Toast.makeText(getBaseContext(), "That's incorrect", 2000).show();
            }

        }

    });
  • 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-06T02:21:42+00:00Added an answer on June 6, 2026 at 2:21 am

    Yeah, definitely possible. I’d say you could simply subclass ImageView and handle the drawing in the onDraw(Canvas) method. For example (and this is just a quickie, in practice I’d probably handle drawing it at different sizes and a fixed offset in dip for different canvas sizes):

    public class MarkableImageView extends ImageView {
        private boolean checked = true;
    
        public MarkableImageView(Context context) {
            super(context);
        }
    
        public MarkableImageView(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        public MarkableImageView(Context context, AttributeSet attrs, int defStyle) {
            super(context, attrs, defStyle);
        }
    
        public void setChecked(boolean checked) {
            this.checked = checked;
            invalidate();
        }
    
        public boolean isChecked() {
            return checked;
        }
    
        @Override
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            if(checked) {
                Bitmap check = BitmapFactory.decodeResource(
                        getResources(), R.drawable.check);
                int width = check.getWidth();
                int height = check.getHeight();
                int margin = 15;
                int x = canvas.getWidth() - width - margin;
                int y = canvas.getHeight() - height - margin;
                canvas.drawBitmap(check, x, y, new Paint());
            }
        }
    }
    

    example

    EDIT: Then your code would be something like:

    public View getView(int position, View convertView, ViewGroup parent) 
    {
       MarkableImageView imageView;
       if (convertView == null) {
           imageView = new MarkableImageView(context);
           imageView.setLayoutParams(new GridView.LayoutParams(140, 140));
           imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
           imageView.setPadding(5, 5, 5, 5);
       } else {
           imageView = (MarkableImageView) convertView;
       }
       imageView.setImageResource(imageIDs[position]);
       imageView.setChecked(shouldBeChecked);
       return imageView;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
i want to parse a xhtml file and display in UITableView. what is the

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.