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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:27:06+00:00 2026-06-17T11:27:06+00:00

I am wondering how I go about (if it is possible) creating a modal

  • 0

I am wondering how I go about (if it is possible) creating a modal popup in a mono for droid application.

Scenario: The application talks to the customers hosted web server (so this location will be different customer to customer). To use the app the user must specify the connection string of their web server. So when the application starts and it hits the main activity, the first task I do is check if there is a connection string set in the devices application settings. If not I want to throw up a simple modal popup that allows the user to specify a connection to their server.

I dont really want to start a normal activity because the user will be able to click the back button and just go back to the main menu and the app is than in an invalid state because it doesnt know what server to talk to.

Any ideas on how I go about this?

Or should I be structuring the activity chain so that the connection string is entered on the first activity so that if they click back it actually goes out of the app?

Im a little confused.

Thanks in advance

  • 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-17T11:27:07+00:00Added an answer on June 17, 2026 at 11:27 am

    This is possible with AlertDialog. It can create dialogs for simple input with lists, checkboxes, yes/no buttons and custom views.

    There is a sample in the Xamarin Sample Repository for different type of dialogs and in the bottom you can find one where a custom view with a username and password field has been added.

    So first define your custom view you want to put in the AlertDialog. alert_dialog_connection_entry.xml and is a Layout:

    Somewhere in your activity add the code:

    var connection_string_view = LayoutInflater.Inflate(Resource.Layout.alert_dialog_connection_entry, null);
    
    var builder = new AlertDialog.Builder(this);
    builder.SetTitle("Connection String");
    builder.SetView(connection_string_view);
    builder.SetPositiveButton("OK", OkClicked);
    builder.SetNegativeButton("Cancel", CancelClicked);
    builder.Create();
    builder.Show();
    

    Add some handlers for the buttons:

    private void CancelClicked(object sender, DialogClickEventArgs dialogClickEventArgs)
    {
        //Todo
    }
    
    private void OkClicked(object sender, DialogClickEventArgs dialogClickEventArgs)
    {
        var dialog = sender as AlertDialog;
    
        if (null != dialog)
        {
            var connectionEdit = dialog.FindViewById(Resource.Id.connectionstring_edit) as EditText;
    
    
            if (null != connectionEdit)
                Console.WriteLine("Connection String: {0}", connectionEdit.Text);
        }
    }
    

    That should be it. You should be able to put any kind of custom view in the dialog.

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

Sidebar

Related Questions

I was wondering about creating fake URL queries in a web application. When you
I'm wondering if it's possible/how I would go about creating something like this in
I was wondering if this is possible. I was thinking of creating a server
i'm wondering about this possibility. Is it possible to make our code written in
I was wondering if this was possible, and if so how I'd go about
I'm creating a PHP website which involves users signing up, and I'm wondering about
I'm creating a web application that will use multiple types of users (e.g. Admin,
Possible Duplicate: Reference: Comparing PHP's print and echo I am wondering about the practical
Just wondering about the performance impact of copying very large php variables. For example
Just wondering about this code below... when I turn off my internet connection and

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.