Friday 19 August 2011

How to setCancelable to Activity as Dialog in Android

Some Times we don't need to cancle alert when user click on outside dialog. At this time use below code in your activity oncreate() method after setContentView()

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.demolayout);
                //Dialog should not be canceled 
this.setFinishOnTouchOutside(false);
}

No comments:

Post a Comment

Android SQLite Database Viewer or Debuging with Stetho

Every Android Developer uses SQLite Database to store data into the Android Application data. But to view the data in SQLite have a lot of...