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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:23:54+00:00 2026-06-05T22:23:54+00:00

I have some problem. Dialog.dismiss() does not work. I want to input ip, username,

  • 0

I have some problem. Dialog.dismiss() does not work.
I want to input ip, username, password to login WinServer 2003. When I clicked Submit button, the dialog can’t be closed. To be noted, my Thread-socket able to retrieve messages from Server and send messages back to Server. The Dialog can only be closed When the Thread-socket got error.

 public void onCreate(Bundle savedInstanceState) {      
    super.onCreate(savedInstanceState);
    setContentView(R.layout.jiemian);

    netInit();
    JieMianActivity.jiemian = this;
    LayoutInflater factory = LayoutInflater.from(JieMianActivity.this);  

    View view = factory.inflate(R.layout.login, null);  

    dialog02 = new AlertDialog.Builder(JieMianActivity.this)  
         .setIcon(android.R.drawable.btn_star)  
         .setTitle("login")  
           .setView(view)  
           .setPositiveButton("submit", onclickButton)  
           .setNegativeButton("cancel",  onclickButton).create();  
    dialog02.show(); 
}

private OnClickListener onclickButton = new OnClickListener() {

    @Override  
    public void onClick(DialogInterface dialog, int which) {  
        Log.v("which", which+"");
        switch(which){
        case Dialog.BUTTON_POSITIVE:
            dialog.dismiss();//doesn't work , cann't close dialog.
            EditText ip = (EditText) findViewById(R.id.ip);

            EditText username = (EditText) findViewById(R.id.username);

            EditText password = (EditText) findViewById(R.id.password);

            new Connect(JieMianActivity.jiemian).run();//do some socket thing
            break;
        case Dialog.BUTTON_NEGATIVE:
            dialog.dismiss();
            JieMianActivity.jiemian.finish();
            break;
        }
    }
};

This is my Thread:

 class Connect extends Thread{
    private JieMianActivity jiemain;
    public Connect(JieMianActivity jiemian){
        this.jiemain = jiemian;
    }

    public void run(){
        //Process.setThreadPriority(Process.THREAD_PRIORITY_LOWEST);
        try {
            Display display = getWindowManager().getDefaultDisplay();
            InputStream is = getResources().getAssets().open(
                    connect2RDP.mapFile);

            sfv = (SurfaceView) findViewById(R.id.surfaceView);

            sfh = sfv.getHolder();
            sfh.addCallback(JieMianActivity.jiemian);

            if (conn.connect("192.168.10.134", "Adminstrator", "123",
                    display.getWidth(), display.getHeight(), 3389, is)) {
                Log.v("login", "success");  

                //dialog02.dismiss();
                Log.v("login", "ok");

                canvas = new MyCanvas();
                canvas.setRop(new RasterOp());
                canvas.setHeight(Options.height);
                canvas.setWidth(Options.width);
                canvas.setRight(Options.width - 1);
                canvas.setBottom(Options.height - 1);
                canvas.setBackstore(new WrappedImage(Options.width,
                        Options.height, JieMianActivity.jiemian));
                canvas.setJiemian(JieMianActivity.jiemian);
                canvas.setSurView(sfv);
                canvas.setSurHolder(sfh);
                conn.doconnect(JieMianActivity.jiemian);// 启动RDP

                // init();
            }
        } catch (OrderException e) {

        } catch (Exception e) {

        }
    }
};
  • 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-05T22:23:57+00:00Added an answer on June 5, 2026 at 10:23 pm

    You need to change your code to start a Thread, You need to call the method start() – that will execute the run() method written in that Thread.

    So,
    Invoke Connect.start() instead of Connect.run() inside your onClick handler.

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

Sidebar

Related Questions

I have a dialog which performs some validation (below). Thee problem is, the dialog
I have an interesting/annoying problem with some VBScripts running on Windows 2003 Server (they
I have to write an applet that brings up a password dialog. The problem
I have a jQuery UI Dialog containing some checkboxes. I want to conditionally set
I have a problem with slashes! I have some jQuery for handling generic dialogs
I have some problem to get the utf-8 string from PHP using jQuery $.load()
I have some problem with the cursor when using JOprionPane. I set a cursor
I have some problem with this mongoid. It's my first time to use mongoDB,
I have some problem with MySQL Workbench in that I sometimes can't set foreign
I have some problem in my JDBC code. I am trying to connect through

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.