Example usage for android.view.inputmethod InputMethodManager RESULT_HIDDEN

List of usage examples for android.view.inputmethod InputMethodManager RESULT_HIDDEN

Introduction

In this page you can find the example usage for android.view.inputmethod InputMethodManager RESULT_HIDDEN.

Prototype

int RESULT_HIDDEN

To view the source code for android.view.inputmethod InputMethodManager RESULT_HIDDEN.

Click Source Link

Document

Flag for the ResultReceiver result code from #showSoftInput(View,int,ResultReceiver) and #hideSoftInputFromWindow(IBinder,int,ResultReceiver) : the state of the soft input window changed from shown to hidden.

Usage

From source file:edu.missouri.niaaa.pain.activity.AdminManageActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "OnCreate!!~~~");

    ctx = this;//from www  . j  a  v  a2 s  . c o  m
    // Setup the window
    //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    // Set result CANCELED in case the user backs out
    setResult(Activity.RESULT_CANCELED);

    ////////////////////////////////////////////////////////////////////

    tabHost = getTabHost();
    LayoutInflater.from(this).inflate(R.layout.activity_admin_manage, tabHost.getTabContentView(), true);
    tabHost.addTab(tabHost.newTabSpec("Assign ID").setIndicator("Assign ID", null).setContent(R.id.tab_assign));
    tabHost.addTab(tabHost.newTabSpec("Remove ID").setIndicator("Remove ID", null).setContent(R.id.tab_logoff));

    setContentView(tabHost);

    shp = getSharedPreferences(Util.SP_LOGIN, Context.MODE_PRIVATE);
    editor = shp.edit();
    asID = (EditText) findViewById(R.id.assigned_ID);
    deasID = (EditText) findViewById(R.id.deassigned_ID);
    AssignButton = (Button) findViewById(R.id.btn_assign);
    RemoveButton = (Button) findViewById(R.id.btn_remove);

    imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE);
    //imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN);

    //imm.showSoftInput(asID, InputMethodManager.RESULT_SHOWN);
    imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, InputMethodManager.RESULT_HIDDEN);

    asID.setFocusable(true);
    asID.setFocusableInTouchMode(true);

    asID.requestFocus();

    setListeners();

    DialadminPin = AdminPinSetDialog(this);
    DialadminPin.show();

    setHints();
}

From source file:edu.missouri.niaaa.ema.activity.AdminManageActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "OnCreate!!~~~");

    ctx = this;/*  w  ww. jav  a  2  s . c  o  m*/
    // Setup the window
    //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    // Set result CANCELED incase the user backs out
    setResult(Activity.RESULT_CANCELED);

    ////////////////////////////////////////////////////////////////////

    tabHost = getTabHost();
    LayoutInflater.from(this).inflate(R.layout.activity_admin_manage, tabHost.getTabContentView(), true);
    tabHost.addTab(tabHost.newTabSpec("Assign ID").setIndicator("Assign ID", null).setContent(R.id.tab_assign));
    tabHost.addTab(tabHost.newTabSpec("Remove ID").setIndicator("Remove ID", null).setContent(R.id.tab_logoff));

    setContentView(tabHost);

    shp = getSharedPreferences(Utilities.SP_LOGIN, Context.MODE_PRIVATE);
    editor = shp.edit();
    asID = (EditText) findViewById(R.id.assigned_ID);
    deasID = (EditText) findViewById(R.id.deassigned_ID);
    AssignButton = (Button) findViewById(R.id.btn_assign);
    RemoveButton = (Button) findViewById(R.id.btn_remove);

    imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE);
    //imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN);

    //imm.showSoftInput(asID, InputMethodManager.RESULT_SHOWN); 
    imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, InputMethodManager.RESULT_HIDDEN);

    asID.setFocusable(true);
    asID.setFocusableInTouchMode(true);

    asID.requestFocus();

    setListeners();

    DialadminPin = AdminPinSetDialog(this);
    DialadminPin.show();

    setHints();
}

From source file:edu.missouri.bas.activities.AdminManageActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "OnCreate!!~~~");

    ctx = this;/*from  w  w w  .  j a v a 2 s  . co m*/
    // Setup the window
    //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    // Set result CANCELED incase the user backs out
    //setResult(Activity.RESULT_CANCELED);

    ////////////////////////////////////////////////////////////////////

    tabHost = getTabHost();
    LayoutInflater.from(this).inflate(R.layout.activity_admin_manage, tabHost.getTabContentView(), true);
    tabHost.addTab(tabHost.newTabSpec("Assign ID").setIndicator("Assign ID", null).setContent(R.id.tab_assign));
    tabHost.addTab(tabHost.newTabSpec("Remove ID").setIndicator("Remove ID", null).setContent(R.id.tab_logoff));

    setContentView(tabHost);

    shp = getSharedPreferences("PINLOGIN", Context.MODE_PRIVATE);
    editor = shp.edit();
    bedTime = ctx.getSharedPreferences(SensorService.BED_TIME, MODE_PRIVATE);
    editor2 = bedTime.edit();
    asID = (EditText) findViewById(R.id.assigned_ID);
    deasID = (EditText) findViewById(R.id.deassigned_ID);
    AssignButton = (Button) findViewById(R.id.btn_assign);
    RemoveButton = (Button) findViewById(R.id.btn_remove);

    imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE);
    //imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN);

    //imm.showSoftInput(asID, InputMethodManager.RESULT_SHOWN); 
    imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, InputMethodManager.RESULT_HIDDEN);

    asID.setFocusable(true);
    asID.setFocusableInTouchMode(true);

    asID.requestFocus();

    setListeners();

    Dialog adminPin = AdminPinDialog(this);
    adminPin.show();

    setResult(9);
    setHints();
}

From source file:edu.missouri.niaaa.pain.activity.AdminManageActivity.java

private void setListeners() {
    // TODO Auto-generated method stub
    Log.d(TAG, "Ontabchangedlistener!!~~~");
    tabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override/*from w  ww  . j a v a  2s  . c o m*/
        public void onTabChanged(String arg0) {
            // TODO Auto-generated method stub
            Log.d(TAG, "~~" + arg0);

            setHints();

            if (arg0.equals("Assign ID")) {
                imm.toggleSoftInput(0, InputMethodManager.RESULT_HIDDEN);

                Log.d(TAG, "assign id ");

            } else {

                imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN);
                imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);

                Log.d(TAG, "deassign id");

            }
        }

    });

    AssignButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Log.d(TAG, "assign btn " + asID.getText().toString());

            //editor.putString(ASID, asID.getText().toString());
            //format check

            //editor.putString(ASPWD, "");
            //editor.commit();
            //setHints();

            /*              check network*/

            /*              prepare params for server*/
            String asedID = asID.getText().toString();
            Log.d(TAG, "get from edittext is " + asedID);

            String data = null;
            try {
                data = Util.encryption(AdminManageActivity.this, asedID + "," + "2");
            } catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

            HttpPost request = new HttpPost(Util.VALIDATE_ADDRESS);

            List<NameValuePair> params = new ArrayList<NameValuePair>();

            params.add(new BasicNameValuePair("data", data));

            //              //file_name
            //              params.add(new BasicNameValuePair("userID",asedID));
            //              //function
            //              params.add(new BasicNameValuePair("pre","2"));
            //              //data
            //              //params.add(new BasicNameValuePair("password",""));

            /*              check identity*/

            try {
                request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));

                HttpResponse response = new DefaultHttpClient().execute(request);
                if (response.getStatusLine().getStatusCode() == 200) {
                    String result = EntityUtils.toString(response.getEntity());
                    Log.d("~~~~~~~~~~http post result2 ", result);

                    if (result.equals("UserIDIsNotSet")) {
                        //add in web page first

                        String s1 = getString(R.string.assign_id_null);
                        assignFailDialog(ctx, s1).show();

                    } else if (result.equals("UserIDIsUsed")) {
                        String s2 = getString(R.string.assing_id_exist) + asedID;
                        assignConfirmDialog(ctx, s2, true).show();

                    } else if (result.equals("UserIDIsNotActive")) {
                        //assign
                        String s3 = getString(R.string.assign_id_new) + asedID;
                        assignConfirmDialog(ctx, s3, false).show();

                    } else {
                        String s4 = getString(R.string.assign_id_wrong);
                        assignFailDialog(ctx, s4).show();

                    }

                }
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                String s4 = getString(R.string.assign_id_net_error);
                assignFailDialog(ctx, s4).show();
            }
        }
    });

    RemoveButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Log.d(TAG, "remove btn ");

            //add a confirm dialog

            setHints();
            Log.d(TAG, "cur is " + currentAssID);

            if (!currentAssID.equals("")) {
                removeDialog(ctx).show();
            }
        }
    });
}

From source file:edu.missouri.niaaa.ema.activity.AdminManageActivity.java

private void setListeners() {
    // TODO Auto-generated method stub
    Log.d(TAG, "Ontabchangedlistener!!~~~");
    tabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override//from  w ww.ja  v  a 2  s.  c o  m
        public void onTabChanged(String arg0) {
            // TODO Auto-generated method stub
            Log.d(TAG, "~~" + arg0);

            setHints();

            if (arg0.equals("Assign ID")) {
                imm.toggleSoftInput(0, InputMethodManager.RESULT_HIDDEN);

                Log.d(TAG, "assign id ");

            } else {

                imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN);
                imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);

                Log.d(TAG, "deassign id");

            }
        }

    });

    AssignButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Log.d(TAG, "assign btn " + asID.getText().toString());

            //editor.putString(ASID, asID.getText().toString());
            //format check

            //editor.putString(ASPWD, "");
            //editor.commit();
            //setHints();

            /*            check network*/

            /*            prepare params for server*/
            String asedID = asID.getText().toString();
            Log.d(TAG, "get from edittext is " + asedID);

            String data = null;
            try {
                data = Utilities.encryption(asedID + "," + "2");
            } catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

            HttpPost request = new HttpPost(Utilities.VALIDATE_ADDRESS);

            List<NameValuePair> params = new ArrayList<NameValuePair>();

            params.add(new BasicNameValuePair("data", data));

            //               //file_name
            //               params.add(new BasicNameValuePair("userID",asedID));
            //               //function
            //               params.add(new BasicNameValuePair("pre","2"));
            //               //data
            //               //params.add(new BasicNameValuePair("password",""));

            /*            check identity*/

            try {
                request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));

                HttpResponse response = new DefaultHttpClient().execute(request);
                if (response.getStatusLine().getStatusCode() == 200) {
                    String result = EntityUtils.toString(response.getEntity());
                    Log.d("~~~~~~~~~~http post result2 ", result);

                    if (result.equals("UserIDIsNotSet")) {
                        //add in web page first

                        String s1 = getString(R.string.assign_id_null);
                        assignFailDialog(ctx, s1).show();

                    } else if (result.equals("UserIDIsUsed")) {
                        String s2 = getString(R.string.assing_id_exist) + asedID;
                        assignConfirmDialog(ctx, s2, true).show();

                    } else if (result.equals("UserIDIsNotActive")) {
                        //assign
                        String s3 = getString(R.string.assign_id_new) + asedID;
                        assignConfirmDialog(ctx, s3, false).show();

                    } else {
                        String s4 = getString(R.string.assign_id_wrong);
                        assignFailDialog(ctx, s4).show();

                    }

                }
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                String s4 = getString(R.string.assign_id_net_error);
                assignFailDialog(ctx, s4).show();
            }
        }
    });

    RemoveButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Log.d(TAG, "remove btn ");

            //add a confirm dialog

            setHints();
            Log.d(TAG, "cur is " + currentAssID);

            if (!currentAssID.equals("")) {
                removeDialog(ctx).show();
            }
        }
    });
}

From source file:edu.missouri.bas.activities.AdminManageActivity.java

private void setListeners() {
    // TODO Auto-generated method stub
    Log.d(TAG, "Ontabchangedlistener!!~~~");
    tabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override//w  w w .j a v  a 2s  . co  m
        public void onTabChanged(String arg0) {
            // TODO Auto-generated method stub
            Log.d(TAG, "~~" + arg0);

            setHints();

            if (arg0.equals("Assign ID")) {
                imm.toggleSoftInput(0, InputMethodManager.RESULT_HIDDEN);

                Log.d(TAG, "assign id ");

            } else {

                imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN);
                imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);

                Log.d(TAG, "deassign id");

            }
        }

    });

    AssignButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Log.d(TAG, "assign btn " + asID.getText().toString());

            //editor.putString(ASID, asID.getText().toString());
            //format check

            //editor.putString(ASPWD, "");
            //editor.commit();
            //setHints();

            //check networking

            String asedID = asID.getText().toString();
            Log.d(TAG, "get from edittext is " + asedID);

            HttpPost request = new HttpPost(
                    "http://dslsrv8.cs.missouri.edu/~rs79c/Server/Crt/validateUser.php");

            List<NameValuePair> params = new ArrayList<NameValuePair>();

            //file_name 
            params.add(new BasicNameValuePair("userID", asedID));
            //function
            params.add(new BasicNameValuePair("pre", "2"));
            //data                       
            //params.add(new BasicNameValuePair("password",""));

            try {
                request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));

                HttpResponse response = new DefaultHttpClient().execute(request);
                if (response.getStatusLine().getStatusCode() == 200) {
                    String result = EntityUtils.toString(response.getEntity());
                    Log.d("~~~~~~~~~~http post result2 ", result);

                    if (result.equals("UserIDIsNotSet")) {
                        //add in web page first

                        String s1 = "This ID is not in Database, please double check or add it via web page by administrator first.";
                        buildDialog1(ctx, s1).show();
                        setResult(9);

                    } else if (result.equals("UserIDIsUsed")) {
                        String s2 = "This ID has been used before. Delete it via web page by administrator first.";
                        buildDialog2(ctx, s2).show();
                        setResult(9);

                    } else if (result.equals("UserIDIsNotActive")) {
                        //assign
                        String s3 = "Do you want to assign this ID: " + asedID;
                        buildDialog2(ctx, s3).show();

                    } else {
                        String s4 = "The ID format seems not applicable, please try again.";
                        buildDialog1(ctx, s4).show();
                        setResult(9);

                    }

                }
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                String s4 = "The ID format seems not applicable, please try again.";
                buildDialog1(ctx, s4).show();
                setResult(9);
            }

        }
    });

    RemoveButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Log.d(TAG, "remove btn ");

            //add a confirm dialog

            setHints();
            Log.d(TAG, "cur is " + currentAssID);

            if (!currentAssID.equals("")) {
                Dialog alertDialog = new AlertDialog.Builder(ctx).setCancelable(false)
                        .setTitle("Confirm Remove")
                        .setMessage(
                                "Do you really want to remove this ID and all related data from the device? ")
                        .setPositiveButton("OK", new DialogInterface.OnClickListener() {

                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                // TODO Auto-generated method stub  
                                editor.putString(ASID, "");
                                editor.putString(ASPWD, "");
                                editor.commit();
                                editor2.putString(SensorService.BED_TIME_INFO, "none");
                                editor2.putString(SensorService.BED_HOUR_INFO, "none");
                                editor2.putString(SensorService.BED_MIN_INFO, "none");
                                editor2.putInt("RandomSurveyStartHour", 11);
                                editor2.putInt("RandomSurveyStartMin", 59);
                                //editor2.putBoolean("MornReportDone", false);
                                editor2.commit();

                                setHints();
                                SensorService.mIsRunning = false;
                                ctx.stopService(new Intent(AdminManageActivity.this, SensorService.class));
                                setResult(9);
                                finish();
                            }
                        }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                // TODO Auto-generated method stub  

                            }
                        }).create();

                alertDialog.show();
            }
        }
    });
}

From source file:com.anton.gavel.GavelMain.java

public void createDialog(int id) {
    if (progressDialog != null) {
        progressDialog.dismiss();// w  w  w  .j av a  2s  .c  o  m
    }
    // handles creation of any dialogs by other actions
    switch (id) {
    case DIALOG_PI:
        //call custom dialog for collecting Personal Info
        PersonalInfoDialogFragment personalInfoDialog = new PersonalInfoDialogFragment();
        personalInfoDialog.setPersonalInfo(mPersonalInfo);
        personalInfoDialog.show(getSupportFragmentManager(), "PersonalInfoDialogFragment");
        break;
    case DIALOG_ABOUT:
        //construct a simple dialog to show text

        //get about text
        TextView aboutView = new TextView(this);
        aboutView.setText(R.string.about_text);
        aboutView.setMovementMethod(LinkMovementMethod.getInstance());//enable links
        aboutView.setPadding(50, 30, 50, 30);

        //build dialog
        AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
        alertDialog.setTitle("About")//title
                .setView(aboutView)//insert textview from above
                .setPositiveButton("Done", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                }).setIcon(R.drawable.ic_launcher).create() //build
                .show(); //display
        break;

    case DIALOG_SUBMISSION_ERR:
        AlertDialog.Builder submissionErrorDialog = new AlertDialog.Builder(this);
        submissionErrorDialog.setTitle("Submission Error")//title
                .setMessage("There was a problem submitting your complaint on the City's website.")//insert textview from above
                .setPositiveButton("Done", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                }).setIcon(R.drawable.ic_launcher).show(); //display
        break;

    case DIALOG_OTHER_COMPLAINT:
        final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        final EditText input = new EditText(this);
        input.setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS | InputType.TYPE_CLASS_TEXT);
        // capitalize letters + seperate words
        AlertDialog.Builder getComplaintDialog = new AlertDialog.Builder(this);
        getComplaintDialog.setTitle("Other...").setView(input)
                .setMessage("Give a categorical title for your complaint:")
                .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        String value = input.getText().toString();
                        // add the item to list and make it selected
                        complaintsAdapter.insert(value, 0);
                        complaintSpinner.setSelection(0);
                        complaintsAdapter.notifyDataSetChanged();
                        addToSubmitValues(value);

                        imm.toggleSoftInput(InputMethodManager.RESULT_HIDDEN, 0);//hide keyboard   
                        dialog.cancel();

                    }
                }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        imm.toggleSoftInput(InputMethodManager.RESULT_HIDDEN, 0);//hide keyboard              
                        dialog.cancel();
                    }
                }).create();

        input.requestFocus();
        imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);// show keyboard

        getComplaintDialog.show();//show dialog
        break;
    case DIALOG_NO_GEOCODING:
        AlertDialog.Builder noGeoCoding = new AlertDialog.Builder(this);
        noGeoCoding.setTitle("Not Available")//title
                .setMessage(
                        "Your version of Android does not support location-based address lookup. This feature is only supported on Gingerbread and above.")//insert textview from above
                .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                }).setIcon(R.drawable.ic_launcher).show(); //display
        break;
    case DIALOG_INCOMPLETE_PERSONAL_INFORMATION:
        AlertDialog.Builder incompleteInfo = new AlertDialog.Builder(this);
        incompleteInfo.setTitle("Incomplete")//title
                .setMessage(
                        "Your personal information is incomplete. Select 'Edit Personal Information' from the menu and fill in all required fields")//insert textview from above
                .setPositiveButton("Done", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                }).setIcon(R.drawable.ic_launcher).show(); //display         
        break;
    case DIALOG_NO_COMPLAINT:
        AlertDialog.Builder noComplaint = new AlertDialog.Builder(this);
        noComplaint.setTitle("No Comlaint Specified")//title
                .setMessage("You must specify a complaint (e.g. barking dog).")//insert textview from above
                .setPositiveButton("Done", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                }).setIcon(R.drawable.ic_launcher).show(); //display
        break;
    case DIALOG_NO_LOCATION:
        AlertDialog.Builder incompleteComplaint = new AlertDialog.Builder(this);
        incompleteComplaint.setTitle("No Location Specified")//title
                .setMessage("You must specify a location (approximate street address) of the complaint.")//insert textview from above
                .setPositiveButton("Done", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                }).setIcon(R.drawable.ic_launcher).show(); //display         
    }

}