On a button click we are creating the same class as a dialog so that the touch is not received
public class MainActivity extends Activity { Dialog overlayDialog; EditText edt; Button bt; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); edt=(EditText)findViewById(R.id.editText1); bt=(Button)findViewById(R.id.button1); bt.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub disableAnyInput(); } }); } public void disableAnyInput(){ Toast.makeText(getApplicationContext(), "This will disable any input. Click the backbutton " + "to enable any input.", Toast.LENGTH_LONG).show(); overlayDialog = new Dialog(MainActivity.this,android.R.style.Theme_Panel); overlayDialog.setCancelable(true); overlayDialog.show(); } }
Comments
Post a Comment