Code example for EditText

Methods: getTextselectAllsetGravitysetText

0
		} 
	} 
	 
	public String inputBox(String title, String defaultText, String defaultAction) { 
    	final FrameLayout fl = new FrameLayout(this); 
    	final EditText input = new EditText(this); 
    	input.setGravity(Gravity.CENTER); 
 
    	inputBoxCancelled = false; 
		FrameLayout.LayoutParams editBoxLayout = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); 
    	editBoxLayout.setMargins(2, 20, 2, 20); 
    	fl.addView(input, editBoxLayout); 
 
    	input.setText(defaultText); 
    	input.selectAll(); 
    	 
    	AlertDialog dlg = new AlertDialog.Builder(this) 
    		.setView(fl) 
    		.setTitle(title) 
    		.setPositiveButton(defaultAction, new DialogInterface.OnClickListener(){ 
    			public void onClick(DialogInterface d, int which) { 
    				d.dismiss(); 
    			} 
    		}) 
    		.setNegativeButton("Cancel", new DialogInterface.OnClickListener(){ 
    			public void onClick(DialogInterface d, int which) { 
    				d.cancel(); 
        	    	NativeActivity.inputBoxCancelled = false; 
    			} 
    		}).create(); 
    	dlg.setCancelable(false); 
    	dlg.show(); 
    	if (inputBoxCancelled) 
    		return null; 
    	NativeApp.sendMessage("INPUTBOX:" + title, input.getText().toString()); 
    	return input.getText().toString(); 
    } 
      
    public void processCommand(String command, String params) { 
    	if (command.equals("launchBrowser")) { 
    		Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(params));