Hi

public class CustomDialog extends Dialog {

/**
 *
 * @param context
 *            - Activity context
 * @param theme
 *            - Theme id
 */
public CustomDialog(Context context, int theme) {
super(context, theme);
}

/**
 *
 * @param context
 *            - Activity context
 */
public CustomDialog(Context context) {
super(context);
}

/**
 * Helper class for creating a custom dialog
 */
public static class Builder {

private Context context;
private CustomDialog dialog = null;

/**
 * Constructor
 */
public Builder(Context context) {
this.context = context;
}

/**
 * Create the custom dialog
 */
public CustomDialog create() {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

// Instantiate the dialog with the custom Theme
dialog = new CustomDialog(context, R.style.<Your Dialog>);

// Remove the title bar and notification bar
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

// Get the dialog custom layout
View layout = inflater.inflate(R.layout.<Your Layout>, null);

dialog.setContentView(layout, new LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

dialog.getWindow().setGravity(Gravity.TOP);
dialog.getWindow().setLayout(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT);

return dialog;
}
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to