Note that there are some explanatory texts on larger screens.

plurals
  1. POUser credential dialog does not dismiss, but is waiting for other service
    primarykey
    data
    text
    <p>I have a problem with a dialog where the user can enter password and username. This dialog does not dismiss once the user hat entered the data and clicks OK. </p> <p>Here is the dialog:</p> <pre><code>private void askUserCredentials(String pWarning) { // starting the user credentials Log.v(tag, "askUserCredentials started "); // create the new dialog final Dialog dialogCredentials = new Dialog(this); //Set the content view to our xml layout dialogCredentials.setContentView(R.layout.dialog_login); // if there is a warning if (pWarning != null) { // show it instead of the regular text TextView dialogDescription = (TextView) dialogCredentials .findViewById(R.id.dialog_cred_description); dialogDescription.setText(pWarning); // also set it to red //dialogDescription.setTextColor(R.color.text_headline_main); } // Set the title of the dialog. this space is always drawn even if blank // so might as well use it dialogCredentials .setTitle(getString(R.string.LABEL_DIALOG_CREDENTIALS)); // get password and username String lUsername = SharedPrefHandler.getPrefString( getApplicationContext(), SharedPrefHandler.USER_NAME); String lPassword = SharedPrefHandler.getPrefString( getApplicationContext(), SharedPrefHandler.USER_PASSWORD); // to get the values later set the reference to the fields final EditText txtPassword = (EditText) dialogCredentials .findViewById(R.id.edit_text_password); final EditText txtUsername = (EditText) dialogCredentials .findViewById(R.id.edit_text_username); // preset the values if (lUsername != null) txtUsername.setText(lUsername); if (lPassword != null) txtPassword.setText(lPassword); // Allow the dialog to be cancelable dialogCredentials.setCancelable(true); Button okButton = (Button) dialogCredentials .findViewById(R.id.dialog_cred_butt_OK); Button canceButton = (Button) dialogCredentials .findViewById(R.id.dialog_cred_butt_cancel); okButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Log.v(tag, "Got some data - username:" + txtUsername.getText().toString() + "-Password: " + txtPassword.getText().toString()); //close the dialog dialogCredentials.dismiss(); // store them to the users settings SharedPrefHandler.storeSharedPref(getApplicationContext(), txtUsername.getText().toString(), SharedPrefHandler.USER_NAME); SharedPrefHandler.storeSharedPref(getApplicationContext(), txtPassword.getText().toString(), SharedPrefHandler.USER_PASSWORD); guiStatusMessage.setText("#Bitte warten."); //Start the sync in case the user just entered the credentials startSynchronisation(); Log.i(tag,"started synch!"); //gets called after the function was executed } }); // close the dialog if canceled canceButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialogCredentials.dismiss(); } }); dialogCredentials.show(); } </code></pre> <p>Once the user has entered the credentials the OK button is hit. Everything works, but the command "startSynchronisation()" might take a while and the dialog does not get dismissed. The synchonisation is being run in a another services so it is fully unclear why the dialog is waiting for it.</p> <pre><code>private void startSynchronisation() { try { if (myServerServiceBound &amp;&amp; myServerService != null) myServerService.IgetUserData(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } </code></pre> <p>Help very much appreciated. It must be architectual problem since I have a similar problem at another piece of code as well. There the Optionsmenue does not get closed.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload