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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:26:47+00:00 2026-05-22T03:26:47+00:00

How come the AlertDialog that has the title Location was saved to file doesn’t

  • 0

How come the AlertDialog that has the title “Location was saved to file” doesn’t show up? It is the one that should be displayed after the user presses Okay on the first dialog.

I think it has something to do with threads, but I’m not sure.

       SimpleDateFormat timeStampFormat = new SimpleDateFormat("MMMMM-dd-yyyy");


        final EditText input = new EditText(EncounterActivity.this);
        input.setWidth(75);
        input.setText("Bear-Encounter-GPS-" + timeStampFormat.format(new Date()) + ".txt");

        new AlertDialog.Builder(EncounterActivity.this)
        .setTitle("Save GPS Location")
        .setMessage("Please enter a filename")
        .setView(input)
        .setIcon(R.drawable.gps)
        .setPositiveButton("Save", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                try { 
                    File root = Environment.getExternalStorageDirectory();
                    if (root.canWrite()){
                        File fn = new File(root, input.getText().toString());
                        FileWriter gpxwriter = new FileWriter(fn);
                        BufferedWriter out = new BufferedWriter(gpxwriter);
                        out.write(ll.toUTMRef().toString());
                        out.close();



                        AlertDialog.Builder builder = new AlertDialog.Builder(EncounterActivity.this);
                        builder.setIcon(R.drawable.gps);
                        builder.setTitle("Location was saved to file");
                        builder.setMessage("Your GPS coordinates were saved to " + fn.getAbsolutePath())
                               .setPositiveButton("Okay", new DialogInterface.OnClickListener() {
                                   public void onClick(DialogInterface dialog, int id) {

                                   }
                               });
                        AlertDialog alert = builder.create();
                        alert.show();

                    }
                } catch (IOException e) {
                    //ProfitBandit.alert(Shipment.this, "Couldn't write the file.");
                    Log.v("IOException", "Could not write file " + e.getMessage());
                }
            }
        }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                // Do nothing.
            }
        }).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-05-22T03:26:47+00:00Added an answer on May 22, 2026 at 3:26 am

    You CAN display an alert dialog from an alert dialog if you use the pattern showDialog(int) getInstanceSomeDialog and onCreateDialog(int) for both dialogs. So in my aboutAlertDialog I have:

        builder.setPositiveButton("View EULA", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {               //cancels itself?
            showDialog(DIALOG_EULA_SHOW);
        }       
    });
    

    which in turn displays an EULA in yet another AlertDialog. OR you could just toss up a Toast as in:

    Toast.makeText(Main.this,"Location Saved.", Toast.LENGTH_SHORT).show();
    

    where Main is the activity class.

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

Sidebar

Related Questions

I come from Chrome extensions, so I'm used to defining when a file should
After reading some statistics about my app I saw that it takes over one
How come every object appears to be marked new, instead of just objects that
I come from a .net background so the empty classes (models) that I'm seeing
I come from a Java/Eclipse background and I fear that I am spoiled by
How come that ⌽(⍒'Hello') is 1 2 4 3 5 when ⍋'Hello' is 1
I come here from this topic Where user has exactly the same problem. I
I've been working on this application but have come across a problem that I
How come when I use the following code, clicking on Click Here doesn't trigger
How come this doesn't work (operating on an empty select list <select id=requestTypes></select> $(function()

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.