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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:01:49+00:00 2026-06-13T17:01:49+00:00

I’ve extended Application and declared a public ArrayList there that I use to hold

  • 0

I’ve extended Application and declared a public ArrayList there that I use to hold data (I know it’s not as a Singleton in android should be, but it was the only thing I could make work).

The problem :
When I display my CreateNewObject dialog and press OK I get the following error.

Error:

10-30 10:20:19.069: E/AndroidRuntime(632): java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(16908298, class android.widget.ListView) with Adapter(class com.nuclear.gfr.adapter.PatientAdapter)]

My code:

public class NewPatientDialog extends DialogFragment {

    private static final String TAG = "NUKClear";

    OnNewPatientlistener listener;

    private NewPatientDialog() {

    }

    public interface OnNewPatientlistener {
        public void OnNewPatient(Patient newPatient);
    }

    public void addPatientAction(Patient patient) {
        OnNewPatientlistener activity = (OnNewPatientlistener) getActivity();
        activity.OnNewPatient(patient);
    }

    public static NewPatientDialog newInstance(String title) {
        NewPatientDialog frag = new NewPatientDialog();
        Bundle args = new Bundle();
        args.putString("title", title);
        frag.setArguments(args);
        return frag;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        String title = getArguments().getString("title");

        LayoutInflater inflater = (LayoutInflater) getActivity()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        final View newPatient = inflater.inflate(R.layout.new_patient_dialog,
                null);
        Log.d(TAG, "Creating dialog for new patientinput...");
        return new AlertDialog.Builder(getActivity())
                .setIcon(R.drawable.alert_dialog_icon)
                .setTitle(title)
                .setView(newPatient)
                .setPositiveButton(R.string.alert_dialog_ok,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int whichButton) {
                                final EditText name = (EditText) newPatient
                                        .findViewById(R.id.name_edit);
                                final EditText ssn = (EditText) newPatient
                                        .findViewById(R.id.ssn_edit);
                                final EditText accnum = (EditText) newPatient
                                        .findViewById(R.id.accnr_edit);

                                final Patient patient = new Patient(ssn.getText()
                                        .toString(), name.getText().toString(),
                                        new Study(SimpleDateFormat
                                                .getDateInstance().toString(),
                                                accnum.getText().toString()));

                                addPatientAction(patient); 

                                DatabaseHelper db = new DatabaseHelper(
                                        getActivity());
                                db.addPatientStudy(patient);

                                /*DataManager dm = new DataManager(getActivity()
                                        .getBaseContext());
                                dm.addPatient(patient);*/

                                /*
                                 * PatientManager pm = new
                                 * PatientManager(getActivity
                                 * ().getBaseContext()); pm.add(patient);
                                 */

                                // Interfacecallback
                                /*
                                 * OnNewPatientlistener activity =
                                 * (OnNewPatientlistener) getActivity();
                                 * activity.OnNewPatient(patient);
                                 */

                            }
                        })
                .setNegativeButton(R.string.alert_dialog_cancel,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int whichButton) {
                                dismiss();
                            }
                        }).create();

    }
}

Can anyone explain why this happens and how to circumvent this?

  • 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-13T17:01:50+00:00Added an answer on June 13, 2026 at 5:01 pm

    Adding…

    runOnUiThread(new Runnable() {
                  public void run() {
                      GFRApplication.dPatients.add(newPatient);
                  }
                });
    

    …did the trick.

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

Sidebar

Related Questions

I know there's a lot of other questions out there that deal with this
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into

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.