Skip to content

Instantly share code, notes, and snippets.

@ppamorim
Created August 27, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppamorim/c3c1248eaefeb843949e to your computer and use it in GitHub Desktop.
Save ppamorim/c3c1248eaefeb843949e to your computer and use it in GitHub Desktop.
package com.camerite.ui.dialog;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import com.camerite.R;
public class HappyDialog extends DialogFragment {
private TextView someText;
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(STYLE_NO_FRAME, android.R.style.Theme_Translucent);
}
@Override public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dialog_happy, null);
if(view != null) {
someText = (TextView) view.findViewById(R.id.ok_button);
someText.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View view) {
//do something
}
});
}
builder.setView(view);
return builder.create();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment