Android DialogFragment - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android DialogFragment class.

This code example shows how to use the following methods:
 
import static android.support.v4.app.Watson.OnCreateOptionsMenuListener; 
import static android.support.v4.app.Watson.OnOptionsItemSelectedListener; 
import static android.support.v4.app.Watson.OnPrepareOptionsMenuListener; 
 
public class SherlockDialogFragment extends DialogFragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
    private SherlockFragmentActivity mActivity;
 
    public SherlockFragmentActivity getSherlockActivity() { 
        return mActivity;
    } 
 
    @Override 
    public void onAttach(Activity activity) {
        if (!(activity instanceof SherlockFragmentActivity)) {
            throw new IllegalStateException(getClass().getSimpleName() + " must be attached to a SherlockFragmentActivity.");
        } 
        mActivity = (SherlockFragmentActivity)activity;
 
        super.onAttach(activity);
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
import android.view.ViewGroup; 
import android.widget.TextView; 
 
import com.newsblur.R; 
 
public class AlertDialogFragment extends DialogFragment {
 
	public String message = "";
	 
	@Override 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setStyle(DialogFragment.STYLE_NO_TITLE | DialogFragment.STYLE_NO_FRAME, R.style.dialog);
		setCancelable(true);
	} 
	 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View v = inflater.inflate(R.layout.fragment_dialog, null);
		TextView messageView = (TextView) v.findViewById(R.id.dialog_message);
10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
import android.os.Bundle; 
import android.support.v4.app.DialogFragment; 
import android.view.View; 
import android.widget.EditText; 
 
public class AddFeedDialogFragment extends DialogFragment {
  @Override 
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    final View form=getActivity()
                      .getLayoutInflater()
                      .inflate(R.layout.add_feed, null);
   
    return(new AlertDialog.Builder(getActivity())
            .setTitle(R.string.add_feed)
            .setView(form)
            .setPositiveButton(R.string.add, 
              new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                  processAdd(form);
                } 
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setCancelable, getActivity, getArguments
This code example shows how to use the following methods:show, beginTransaction, findFragmentByTag
        return b.create();
    } 
 
    public static void show(FragmentActivity activity, int titleResId, int descriptionResId) {
        FragmentManager fragmentManager = activity.getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
 
        Fragment prev = fragmentManager.findFragmentByTag(FRAGMENT_TAG);
        if (prev != null) {
            fragmentTransaction.remove(prev);
        } 
        fragmentTransaction.addToBackStack(null);
 
        SampleDescriptionDialogFragment.newInstance(titleResId, descriptionResId)
                .show(fragmentManager, FRAGMENT_TAG);
    } 
 
    public static void dismiss(FragmentActivity activity) {
        FragmentManager fragmentManager = activity.getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
import static android.support.v4.app.Watson.OnCreateOptionsMenuListener; 
import static android.support.v4.app.Watson.OnOptionsItemSelectedListener; 
import static android.support.v4.app.Watson.OnPrepareOptionsMenuListener; 
 
public class SherlockDialogFragment extends DialogFragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
    private SherlockFragmentActivity mActivity;
 
    public SherlockFragmentActivity getSherlockActivity() { 
        return mActivity;
    } 
 
    @Override 
    public void onAttach(Activity activity) {
        if (!(activity instanceof SherlockFragmentActivity)) {
            throw new IllegalStateException(getClass().getSimpleName() + " must be attached to a SherlockFragmentActivity.");
        } 
        mActivity = (SherlockFragmentActivity)activity;
 
        super.onAttach(activity);
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:show, beginTransaction, findFragmentByTag
            return this;
        } 
 
        public void show() { 
            FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
 
            Fragment prev = fragmentManager.findFragmentByTag(FRAGMENT_TAG);
            if (prev != null) {
                fragmentTransaction.remove(prev);
            } 
            fragmentTransaction.addToBackStack(null);
 
            ProgressDialogFragment.newInstance(mMessage, mOnCancelListener, mCancelable)
                    .show(fragmentManager, FRAGMENT_TAG);
        } 
    } 
 
    public static void dismiss(FragmentActivity activity) {
        FragmentManager fragmentManager = activity.getSupportFragmentManager();
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:show, beginTransaction, findFragmentByTag
            return this;
        } 
 
        public void show() { 
            FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
 
            Fragment prev = fragmentManager.findFragmentByTag(FRAGMENT_TAG);
            if (prev != null) {
                fragmentTransaction.remove(prev);
            } 
            fragmentTransaction.addToBackStack(null);
 
            ErrorDialogFragment.newInstance(mTitle, mMessage, mOnClickListener, mOnCancelListener)
                    .show(fragmentManager, FRAGMENT_TAG);
        } 
    } 
 
    public static void dismiss(FragmentActivity activity) {
        FragmentManager fragmentManager = activity.getSupportFragmentManager();
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:show, beginTransaction, findFragmentByTag
This code example shows how to use the following methods:getActivity, getArguments
      return(result);
    } 
 
    @Override 
    public Dialog onCreateDialog(Bundle savedInstanceState) {
      Bundle args=getArguments();
 
      return GooglePlayServicesUtil.getErrorDialog(args.getInt(ARG_STATUS),
                                                   getActivity(), 0);
    } 
 
    @Override 
    public void onDismiss(DialogInterface dlg) {
      if (getActivity() != null) {
        getActivity().finish();
      } 
    } 
  } 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Android DialogFragment Methods: