Android Open Source - barcodescanner Message Dialog Fragment






From Project

Back to project page barcodescanner.

License

The source code is released under:

Apache License

If you think the Android project barcodescanner listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package me.dm7.barcodescanner.zxing.sample;
//w  ww .j a  v  a  2s .  c  o  m
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

public class MessageDialogFragment extends DialogFragment {
    public interface MessageDialogListener {
        public void onDialogPositiveClick(DialogFragment dialog);
    }

    private String mTitle;
    private String mMessage;
    private MessageDialogListener mListener;

    public void onCreate(Bundle state) {
        super.onCreate(state);
        setRetainInstance(true);
    }

    public static MessageDialogFragment newInstance(String title, String message, MessageDialogListener listener) {
        MessageDialogFragment fragment = new MessageDialogFragment();
        fragment.mTitle = title;
        fragment.mMessage = message;
        fragment.mListener = listener;
        return fragment;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage(mMessage)
                .setTitle(mTitle);

        builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                if(mListener != null) {
                    mListener.onDialogPositiveClick(MessageDialogFragment.this);
                }
            }
        });

        return builder.create();
    }
}




Java Source Code List

me.dm7.barcodescanner.core.BarcodeScannerView.java
me.dm7.barcodescanner.core.CameraPreview.java
me.dm7.barcodescanner.core.CameraUtils.java
me.dm7.barcodescanner.core.DisplayUtils.java
me.dm7.barcodescanner.core.ViewFinderView.java
me.dm7.barcodescanner.zbar.BarcodeFormat.java
me.dm7.barcodescanner.zbar.Result.java
me.dm7.barcodescanner.zbar.ZBarScannerView.java
me.dm7.barcodescanner.zbar.sample.FormatSelectorDialogFragment.java
me.dm7.barcodescanner.zbar.sample.MainActivity.java
me.dm7.barcodescanner.zbar.sample.MessageDialogFragment.java
me.dm7.barcodescanner.zbar.sample.ScannerActivity.java
me.dm7.barcodescanner.zbar.sample.ScannerFragmentActivity.java
me.dm7.barcodescanner.zbar.sample.ScannerFragment.java
me.dm7.barcodescanner.zbar.sample.SimpleScannerActivity.java
me.dm7.barcodescanner.zbar.sample.SimpleScannerFragmentActivity.java
me.dm7.barcodescanner.zbar.sample.SimpleScannerFragment.java
me.dm7.barcodescanner.zxing.ZXingScannerView.java
me.dm7.barcodescanner.zxing.sample.FormatSelectorDialogFragment.java
me.dm7.barcodescanner.zxing.sample.MainActivity.java
me.dm7.barcodescanner.zxing.sample.MessageDialogFragment.java
me.dm7.barcodescanner.zxing.sample.ScannerActivity.java
me.dm7.barcodescanner.zxing.sample.ScannerFragmentActivity.java
me.dm7.barcodescanner.zxing.sample.ScannerFragment.java
me.dm7.barcodescanner.zxing.sample.SimpleScannerActivity.java
me.dm7.barcodescanner.zxing.sample.SimpleScannerFragmentActivity.java
me.dm7.barcodescanner.zxing.sample.SimpleScannerFragment.java