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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:10:08+00:00 2026-05-24T17:10:08+00:00

In my app I have 2 tabs. Each tab showing a different Activity. In

  • 0

In my app I have 2 tabs. Each tab showing a different Activity.

In activity_1 I manage a global array of strings – add and delete options are available.

In activity_2 I have an AlertDialog.
The dialog is created by calling the Activity’s dialog’s functions: onCreateDialog, onPrepareDialog.
The dialog shows a multiple-choice list and the list’s source is the global array that activity_1 manages.

The problem: I would like to display the updated list in the dialog of activity_2, according to the changes made to the global array in activity_1. The problem is that the list is created in onCreateDialog, and this method gets called only once in the activity’s lifecycle.

For example: If the global array contains: [“Banana”, “Orange”] and in activity_1 I’ve just added: “Apple”, and I clicked tab #2, I would like activity_2 to open the dialog and display in the dialog list: [“Banana”, “Orange”, “Apple”].

I’ve tried to repopulate the list in: onPrepareDialog but with no success, it’s just allowing me to decide which of the list items will be checked or not. Should I extend AlertDialog?

Any help will be appreciated.

  • 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-24T17:10:10+00:00Added an answer on May 24, 2026 at 5:10 pm

    You can use DialogInterface.OnShowListener to update the dialog content every time it gets displayed.

    Edit:
    You will have to implement a listadpater and set the adapter to the builder.

    In onPrepareDialog, get the listview mAlertdlg.getListView() and call notifyDatasetChanged() on its adapter. Or just set the adapter once again mAlertdlg.getListView().setAdapter(list)

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

Sidebar

Related Questions

I have two tabs on my app that handle different flows. For each tab
I have a Tab bar App with four tabs. Each tab loads the same
I have an app that has 2 tabs. Each tab loads an xml file
I have an app with several different tabs. The first of these tabs should
Here's my problem: I've have an application with tabs. in each tab I have
I have a web app with Tabs for Messages and Contacts (think gmail). Each
I have an application with various tabs (on a tabhost), each tab is an
I have an app with Tab Bar. Each Tab starts to request some data
I have an app with a tab bar. Each tab has its own view
I have a tabhost with some tabs, and each tab have implemented the method

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.