Android : Using Dialog to an activity - Android

on Wednesday, August 6, 2014


I have an activity that is working already!


And I have created a new class where I can call that activity through "Dialog". The problem is when I'm on the dialog, the functions I assign to the widgets doesn't work anymore. I am new to Android and Java so please bear with me. Btw, this is the code of the dialog activity.



public class FilterDialog extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_filter_dialog);

Button btnFilterDialog = (Button) findViewById(R.id.btnFilterDialog);
btnFilterDialog.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {
final Dialog dialog = new Dialog(FilterDialog.this);
dialog.setContentView(R.layout.activity_filter);
dialog.setTitle("Set your tags");
dialog.setCancelable(true);

Button btnDone = (Button) dialog.findViewById(R.id.btnBack);
btnDone.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
}
});
}


}


UPDATE: What I want to happen is when after I click the button "Next", a dialog will appear containing my first activity, which is working already as a regular activity. But when I put it inside the Dialog. All widgets seems to be disabled and not working.


0 comments:

Post a Comment