Back to project page Simple-Android-SQL-DB.
The source code is released under:
Apache License
If you think the Android project Simple-Android-SQL-DB listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package io.github.darkprayer93.example; //from w w w. j a v a2 s .c o m import io.github.darkprayer93.simpleandroidsqldb.R; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.LayoutInflater; import android.widget.EditText; public class NoticeDialogFragment extends DialogFragment { /* The activity that creates an instance of this dialog fragment must * implement this interface in order to receive event callbacks. * Each method passes the DialogFragment in case the host needs to query it. */ public interface NoticeDialogListener { public void onDialogPositiveClick(DialogFragment dialog); public void onDialogNegativeClick(DialogFragment dialog); } // Use this instance of the interface to deliver action events NoticeDialogListener mListener; // Override the Fragment.onAttach() method to instantiate the NoticeDialogListener @Override public void onAttach(Activity activity) { super.onAttach(activity); // Verify that the host activity implements the callback interface try { // Instantiate the NoticeDialogListener so we can send events to the host mListener = (NoticeDialogListener) activity; } catch (ClassCastException e) { // The activity doesn't implement the interface, throw exception throw new ClassCastException(activity.toString() + " must implement NoticeDialogListener"); } } public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the Builder class for convenient dialog construction final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Get the layout inflater LayoutInflater inflater = getActivity().getLayoutInflater(); // Inflate and set the layout for the dialog // Pass null as the parent view because its going in the dialog layout builder.setView(inflater.inflate(R.layout.dialog_bookmark, null)) // Add action buttons .setPositiveButton(R.string.enter, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // Start with the payment amount EditText mShortEditNAME = (EditText) getDialog().findViewById(R.id.shortExampleNAME); EditText mShortEditURL = (EditText) getDialog().findViewById(R.id.shortExampleURL); String shortEditNAME = mShortEditNAME.getText().toString(); String shortEditURL = mShortEditURL.getText().toString(); // enter in links into DB ... ((ExampleActivity) getActivity()).submit_data(shortEditNAME, shortEditURL); } }) .setNegativeButton(R.string.cancel, null); return builder.create(); } }