android-dialogfragment

Customizing android DialogFragment

≯℡__Kan透↙ 提交于 2020-01-04 03:57:10
问题 iam a beginner level programmer in Android.Now iam after a small app development and i have a dialogFragment.Everything is perfectly working and its displaying Dialog box also.But i have some difficulties with color scheme. I have changed the background color of layout and but its title bar color remains same white and also title text color blue and a blue line under that(need to change it to green).How i can achieve this? please help me here is my fragment code public class ClientInfofrag

DailogFragment - getArguments/setArguments - why passing arguments in a bundle?

一世执手 提交于 2020-01-03 15:17:07
问题 In the official example http://developer.android.com/reference/android/app/DialogFragment.html#BasicDialog the fragment is being created with use of static factory method that wraps arguments in a Bundle and calls no-args constructor passing args with setArguments(bundle)- so my question is - why not simply make public constructor with these arguments? What is the reason for using getArguments/setArguments fragment's methods - is maybe Dialog not guaranteed to be recreated each time, but

Update Listview after post new data from dialogfragment

Deadly 提交于 2020-01-03 00:00:38
问题 I am trying to update my listview directly after I submit new data from DialogFragment . But when I call notifyDataSetChanged() it give me an NullPointerException and my app is close. So this is the scenario what I want And this is my code This activity that I use to get data from the server public class LayoutActivity extends Fragment { private ListView listview; private ListItemAdapter theAdapter; String URL = "http://localhost/api/question/get_newest_except/0/0/15"; ProgressDialog pDialog;

Can't get my DialogFragment background to be transparent

老子叫甜甜 提交于 2020-01-02 20:48:11
问题 I have created a custom DialogFragment like it is described in the developer guide. Now what i am trying to do sounds simple enough, but i cannot get it to work. I have defined: android:background="@android:color/transparent" in my layout xml wich i am loading like this (in my onCreateDialog): AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); final View view = inflater.inflate(R.layout.pausedialog, null);

How to pass listener from Fragment to DialogFragment

亡梦爱人 提交于 2020-01-02 08:34:14
问题 I have I Fragment that show DialogFragment .. The DialogFragment creates and shows a TimePickerDialog dialog. I want the calling Fragment to implement the imePickerDialog.OnTimeSetListener listener. but I don't know how to pass this listener to the Called fragment (The DialogFragment) .. I have found the following code that passes a listener from ACTIVITY to the DialogFragment . @Override public void onAttach(Activity activity) { super.onAttach(activity); mActivity = activity; // This error

DialogFragment Close Event

强颜欢笑 提交于 2020-01-02 01:04:12
问题 I need to handle the end of a DialogFragment (after a call to .dismiss) - for example, I would show a toast inside the activity that "contains" the fragment after dismiss. How do I handle the event? 回答1: Override onDismiss() in your DialogFragment, or use setOnDismissListener() in the code block where you are building the fragment. 回答2: I faced similar problem, but I wanted to inform another activity about the dialog dismiss (not the activity that created and showed the dialog). Although you

DialogFragment crashes Activity when calling startActivity()

£可爱£侵袭症+ 提交于 2020-01-01 05:42:28
问题 I have a DialogFragment that was supposed to be simple but it's giving me some big problems specifically on Jelly Bean. The app uses the network and it pops a dialogue asking the user to turn on WiFi or cancel then closes it. So it extends DialogFragment and creates view as: @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog a = new AlertDialog.Builder(getActivity()).setCancelable(true).setTitle(R.string.dialog_title_disabled) .setMessage(R.string.dialog_text)

DialogFragment callback on orientation change

☆樱花仙子☆ 提交于 2019-12-31 10:35:35
问题 I'm migrating my dialogs, currently using Activity.showDialog(DIALOG_ID); , to use the DialogFragment system as discussed in the android reference. There's a question that arose during my development when using callbacks to deliver some event back to the activity/fragment that opened the dialog: Here's some example code of a simple dialog: public class DialogTest extends DialogFragment { public interface DialogTestListener { public void onDialogPositiveClick(DialogFragment dialog); } // Use

AutoCompleteTextView allow only suggested options

孤街醉人 提交于 2019-12-30 06:12:09
问题 I have a DialogFragment that contains AutoCompleteTextView , and Cancel and OK buttons. The AutoCompleteTextView is giving suggestions of usernames that I'm getting from server. What I want to do is to restrict the user to be able to enter only existing usernames. I know I can do check if that username exists when the user clicks OK , but is there some other way, let's say not allow the user to enter character if there doesn't exist such username. I don't know how to do this because on each

Adding positive / negative Button to DialogFragment's Dialog

放肆的年华 提交于 2019-12-28 11:57:22
问题 I've already written a DialogFragment. Now I've realized that I want it to have a positive and a negative button just like an AlertDialog. How can I achieve such a thing while maintaining the code that I've written? public class DoublePlayerChooser extends DialogFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setStyle(DialogFragment.STYLE_NORMAL,0); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new