Code example for EditText

Methods: setInputTypesetTransformationMethod, setView

0
    @Override 
    protected Dialog onCreateDialog(int id, Bundle args) {
    	switch (id) { 
    	case DIALOG_GET_PASSWORD: 
    	{ 
    		final EditText input = new EditText(this); 
    		AlertDialog.Builder builder = new AlertDialog.Builder(this); 
    		builder 
    	    .setTitle("Enter Password") 
    	    .setMessage("Enter the security token for this application:") 
    	    .setView(input) 
    	    .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { 
    	        public void onClick(DialogInterface dialog, int whichButton) { 
    	            Editable value = input.getText(); 
    	    		SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(SyncActivity.this); 
    	            SharedPreferences.Editor editor = settings.edit(); 
    	    		editor.putString(SyncAdapter.AUTH_TOKEN_PREF, value.toString()); 
    	            editor.commit(); 
    	            dialog.dismiss(); 
    	            startSync(); 
    	        } 
    	    }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { 
    	        public void onClick(DialogInterface dialog, int whichButton) { 
    	            finish(); 
    	        } 
    	    }); 
    		input.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); 
    		input.setTransformationMethod(new PasswordTransformationMethod()); 
    		Dialog alert = builder.create(); 
    		return alert; 
    	} 
    		 
    	case DIALOG_NO_ACCOUNT: