android-dialogfragment

How to call an activity from a Dialogfragment in android?

泪湿孤枕 提交于 2019-12-25 18:29:05
问题 I want to call an activity from Dialogfragment, I have attached the code and logcat below for your reference on what I have tried.Kindly provide me your knowledge on it. Thank you. Intent intent = new Intent(getActivity(), LinkActivity.class); getActivity().startActivityForResult(intent, 0); Logcat: 02-12 13:47:17.345: E/AndroidRuntime(670): FATAL EXCEPTION: main 02-12 13:47:17.345: E/AndroidRuntime(670): java.lang.NullPointerException 02-12 13:47:17.345: E/AndroidRuntime(670): at android

datepicker dialog using DialogFragment for multiple activities

二次信任 提交于 2019-12-25 05:27:10
问题 I need to use DatePicker dialog using the new DialogFragment class for multiple activities. I am having more than two activities using datepicker and time picker. I succeeded using the example in developer.android.com for Dialog Fragment for single activity. public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener { String date; Bundle bundle; Intent in; //private View v; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the

Display string with bold letters in Dialog message

岁酱吖の 提交于 2019-12-25 04:49:10
问题 Let's say I had this: AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) .setMessage("I want THIS word to be bold and the rest normal!") .create().show(); Is there any way to have Android apply formatting or bold font to parts of the text string? 回答1: You can add a string to your strings.xml like this: <string name="bold_message">I want <b>THIS</b> word to be bold and the rest normal!</string> and then in your alert dialog just use setMessage(R.string.bold_message) 回答2:

Lollipop v21, FragmentDialog doesn't take my activity theme

限于喜欢 提交于 2019-12-25 04:48:08
问题 I have my activity theme as below set. <style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorPrimary</item> <item name="android:colorButtonNormal">@color/colorPrimary</item> </style> The activity have a simple FragmentDialog that is started using (Kotlin code) MyDialogFragment().show(supportFragmentManager, MyDialogFragment.TAG) The

Pass item[] to DialogFragment

会有一股神秘感。 提交于 2019-12-25 03:53:25
问题 I am trying to pass the String [] items of my Dialog Fragment when the activity is running, as this String is updated and its values, which are showing the DialogFragment are updated and can not always choose the same. I have read this topic: stackoverflow but I think that's not exactly what I need. I know someone help me? This is mi class DialogoSeleccion wich extends DialogFragment: public class DialogoSeleccion extends DialogFragment { @Override public Dialog onCreateDialog(Bundle

Android viewpager inside dialogfragment, app crashed with no view found for id using API 17

▼魔方 西西 提交于 2019-12-25 02:54:13
问题 for the issue in question. Tried Searching for solutions and says getChildFragmentManager/getSupportFragmentManager should be used, but the problem is even with updated android sdk lib using the android support v13 (which has v4) installed, Eclipse Luna still cannot recognize getChildFragmentManager/getSupportFragmentManager. I also tried importing the support.app.v4 namespace but that will only make the ScreenSlidePagerAdapter's FragmentManager throw a type error. DialogFragment Class which

Android: GetMap() == null inside DialogFragment

徘徊边缘 提交于 2019-12-25 02:27:12
问题 Im trying put a MapFragment inside a DialogFragment, it works fine but i dont know how can I wait until getMap()!=null... here´s my code: public class DialogMapa extends DialogFragment{ private SupportMapFragment fragment; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.layout_dialog_mapa, container,false); getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE); SupportMapFragment fragment = new

Android App: Replace default button background with custom background in a Dialog Fragment

梦想的初衷 提交于 2019-12-25 01:49:59
问题 What I'm trying to do is change the default backgrounds of a custom DialogFragment that I have written. Normally, I would do this by changing the XML layout file, however, for a DialogFragment these buttons don't exist in the layout file. In essence, I'm trying to get access to the setPositiveButton, setNegativeButton and setNeutral buttons in order to modify them. Alternatively, I would next try to do this by getting them by id, however, since they aren't defined in a layout file, I do not

Create PreferenceDialog onClick on filter popup?

大城市里の小女人 提交于 2019-12-24 23:13:01
问题 My goal is to implement the image below. How to create a PreferenceDialog if the filter icon in my toolbar has been clicked? I want to set some preferences to filter the entries of my list. I'm at this point. Is that the right way to implement this? 回答1: Yes sir, it is! You should inflate the resource first and set it as a custom view. AlertDialog should do the trick after that. Do you have any further question? Or do you only need to check if it's the right way to do it? 来源: https:/

AlertDialog in fragments

家住魔仙堡 提交于 2019-12-24 20:45:43
问题 I have some difficulties getting AlertDialog working in fragments. I have six buttons and when each button is clicked AlertDialog box should display its content. even though the prg is running without any error and tat fragment page is opening with the buttons if i click on a button dialogbox is not opening can anyone help me out? Thanks in advance. Here is my fragment activity code: @TargetApi(Build.VERSION_CODES.HONEYCOMB) public class Fragment3 extends DialogFragment implements