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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:00:55+00:00 2026-05-19T05:00:55+00:00

my problem seems simple but I can not manage to find an answer here.

  • 0

my problem seems simple but I can not manage to find an answer here.

I have different activities in one application. Activities start each other.
I have a “main-screen” that shows all the different available levels, user clicks on a level and that activity is lunched, when user finishes that level, he can press the back-button to go to the main-screen and start another level.
When back-button is pressed I would like to re-draw the “main-screen” again, since this time the thumb for the completed level will be different to show that it is completed.

So how do I run a re-draw on a activity upon back-button pressed?
(I suppose I should put some code in the Activity.onResume method)

(I use SharedPreferences to save the state of finished levels)

The main-screen activity is basically this:

    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.maps);

SharedPreferences settings = getSharedPreferences((getResources().getString(R.string.PREFS_HI)),0); /**/ GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ImageAdapter(this,(settings.getBoolean("level_1_finished", false)))); /**/ gridview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { //Open the map which was clicked on, if there is one if(position+1 > 1){ Toast.makeText(maps.this, "Level " + (position+1) + " is not yet available!", Toast.LENGTH_SHORT).show(); }else{ Toast.makeText(maps.this, "Opening Level " + (position+1), Toast.LENGTH_SHORT).show(); Intent myIntent = new Intent(v.getContext(), Tutorial2D.class); startActivity(myIntent); } } }); }

ImageAdapter then uses the boolean true/false to choose the source of the image, either the unfinished thumb or the finished level thumb.

  • 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-05-19T05:00:55+00:00Added an answer on May 19, 2026 at 5:00 am

    First put your GridView objet as a class member. Then override the onResume() method in which you can re-set the grid view adapter based on what the user did.

    private GridView gridview;
    @Override
    protected void onResume() {
        super.onResume();
        gridview.setAdapter(/* your new ImageAdapter here */);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may be better suited to Server Fault, but it seems more of a
We have a huge ASP.NET web application which needs to be deployed to LIVE
I have setup PostgreSQL on a VPS I own - the software that accesses
I'm trying to write a simple Python script for my mobile phone to periodically
I've just come across a pretty strange problem with VS2010 and Script#, which most
I'm currently looking for a js library that can encode text in qr codes.
I'm writing a managed cloud stack (on top of hardware-level cloud providers like EC2),
I'm trying to convince an EditText -view to only use the SoftKeyboard that I
After searching around for months on and off I finally decided to post this

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.