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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:05:11+00:00 2026-06-01T21:05:11+00:00

In our Android app, I have an activity that has a gridview that displays

  • 0

In our Android app, I have an activity that has a gridview that displays bitmaps. When one is clicked on, it calls my custom implementation of AdapterView.OnItemClickListener, where it creates a new intent and calls startActivity(intent). Once I get into the new activity and press the back button, the application either displays the screen of the previous Activity but there is no interacting with it at all, or if it takes a little while to go back to the previous activity (due to breakpoints), then it only shows a black screen. Here is some source from the Activity that eventually launches the new one.

protected void onPause() {
    super.onPause();
    character_dbms.CloseDatabase();
    character_dbms = null;
}

protected void onResume() {
super.onResume();
if(character_dbms == null)
{
    character_dbms = new CharacterDBMS(this);
}
radio_group.setOnCheckedChangeListener(new RadioGroupListener());
character_selection_listener = new GridViewItemListener();
charactergrid.setOnItemClickListener(character_selection_listener);

}

Here is the override of the function that launches the new activity

public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    // TODO Auto-generated method stub
    LinearLayout selectedview = (LinearLayout)arg1;
    Intent hi = new Intent(LessonActivity.this, WhiteboardActivity.class);
    MandarinCharacter temp = (MandarinCharacter)adapter.getItem(arg2);



    hi.putExtra("CharacterID", temp.GetID());
    startActivity(hi);
}

There is nothing special going on the the launched activity, just initializes variables. If you need anymore information or source, please ask, as I am happy to provide it.

onCreate()

public void onCreate(Bundle savedInstanceState){
      super.onCreate(savedInstanceState);
      setContentView(R.layout.lessons);
   // LinearLayout 
      radio_holder = (LinearLayout)this.findViewById(R.id.linearLayout2);
      //RadioGroup 
      radio_listener = new RadioGroupListener();
      radio_group = new RadioGroup(this);
      radio_group.setOnCheckedChangeListener(radio_listener);
      radio_holder.addView(radio_group);

      charactergrid = (GridView)findViewById(R.id.gridView1);
      character_selection_listener = new GridViewItemListener();

      character_dbms = new CharacterDBMS(this.getApplicationContext());

      int numberoflessons = character_dbms.GetNumberOfLessons();

      radio_buttons = new RadioButton[numberoflessons];
      for(int iter = 0; iter < numberoflessons; iter++)
      {
          radio_buttons[iter] = new RadioButton(this);
          radio_buttons[iter].setText(character_dbms.GetLessonName(iter + 1));
          radio_buttons[iter].setId(iter);
          radio_buttons[iter].setTextColor(R.color.Black);
          radio_group.addView(radio_buttons[iter]);
      }
      String first_lesson_name = character_dbms.GetLessonName(1);
     charactergrid.setOnItemClickListener(character_selection_listener);


   }   
  • 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-01T21:05:12+00:00Added an answer on June 1, 2026 at 9:05 pm

    It seems like this block of code should be in your onCreate() method. The Activity is still alive in the background after onResume() is called, so you shouldn’t need to reset the click listeners here.

    radio_group.setOnCheckedChangeListener(new RadioGroupListener());
    character_selection_listener = new GridViewItemListener();
    charactergrid.setOnItemClickListener(character_selection_listener);
    

    Also, this might simply be dead code, but you never use the arg1 variable in onPause().

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

Sidebar

Related Questions

Ok, currently I have a view in my android app that displays a list
Im using an ant build file that has been generated by android. Our Android
We have been getting a new error in our Android app since beginning of
Here I create one project that will track our current location. But I have
I'm working on an App that needs to have a custom ringtone for certain
We have an Android app that periodically polls for data and updates the display.
We're designing an Android app that has a lot of data (customers, products, orders...),
im wondering if we can develop our android app in any computer we use
I want to implement an android app which compares recorded audio files with our
Our ASP.NET 3.5 website running on IIS 6 has two teams that are adding

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.