Android Open Source - Geoloqi-Android-Geotracks Simple Alert Dialog Fragment






From Project

Back to project page Geoloqi-Android-Geotracks.

License

The source code is released under:

GNU General Public License

If you think the Android project Geoloqi-Android-Geotracks 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 com.geoloqi.geotracks.app;
//from  w w  w  .  jav  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;

/**
 * Display a simple {@link AlertDialog} with custom title
 * and message copy.
 * 
 * @author Tristan Waddington
 */
public class SimpleAlertDialogFragment extends DialogFragment {
    private static final String EXTRA_TITLE = "com.geoloqi.geotracks.app.extra.TITLE";
    private static final String EXTRA_MESSAGE = "com.geoloqi.geotracks.app.extra.MESSAGE";

    public static SimpleAlertDialogFragment newInstance(int title, int message) {
        SimpleAlertDialogFragment f = new SimpleAlertDialogFragment();
        
        // Configure our AlertDialog
        Bundle args = new Bundle();
        args.putInt(EXTRA_TITLE, title);
        args.putInt(EXTRA_MESSAGE, message);
        f.setArguments(args);
        
        return f;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        int title = getArguments().getInt(EXTRA_TITLE);
        int message = getArguments().getInt(EXTRA_MESSAGE);

        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setIcon(android.R.drawable.ic_dialog_alert);
        builder.setTitle(title);
        builder.setMessage(message);
        builder.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
            }
        });
        
        return builder.create();
    }
}




Java Source Code List

com.geoloqi.geotracks.Build.java
com.geoloqi.geotracks.app.SimpleAlertDialogFragment.java
com.geoloqi.geotracks.maps.DoubleTapMapView.java
com.geoloqi.geotracks.receiver.LocationBroadcastReceiver.java
com.geoloqi.geotracks.ui.LauncherActivity.java
com.geoloqi.geotracks.ui.LinkListActivity.java
com.geoloqi.geotracks.ui.MainActivity.java
com.geoloqi.geotracks.ui.NewShareLinkActivity.java
com.geoloqi.geotracks.ui.SettingsActivity.java
com.geoloqi.geotracks.ui.SignInActivity.java
com.geoloqi.geotracks.ui.SignUpActivity.java
com.geoloqi.geotracks.utils.FileUtils.java
com.geoloqi.geotracks.utils.LocationUtils.java
com.geoloqi.geotracks.widget.BaseViewHolder.java
com.geoloqi.geotracks.widget.ImageViewHolder.java
com.geoloqi.geotracks.widget.LazyImageLoader.java
com.geoloqi.geotracks.widget.LinkListAdapter.java