android-dialogfragment

How can we call another activity by using fragment tabs?

流过昼夜 提交于 2019-12-04 06:35:34
问题 I am using fragment with tabs, and i use listfragment in tab,i want to go another acitivity on item clicklistner, i am using below code: Activity activity = getActivity(); Intent i = new Intent(activity, Motherboard.class); startActivity(i); it is going to another activity but it not showing tabbars. I want if any activity call then the tabbar remain infront. Please help me out. 回答1: Hope this might helps you http://wptrafficanalyzer.in/blog/creating-navigation-tabs-using-tabhost-and

Using image from street view

拥有回忆 提交于 2019-12-04 02:03:57
问题 I want to get a picture of streetview (stating latitude and longitude) and display in a dialog, is this possible? I saw some examples here, but not found one that show me how to display the image in dialog. Sorry if already exists this question in the site, but I not found when I search. 回答1: Yes you can, as a URL root you can use this one http://cbk0.google.com/ or maps.google.com and this is a example where you use above mentioned URL by providing location: http://cbk0.google.com/cbk?output

How to set a default value to SharedPreferences programmatically?

蓝咒 提交于 2019-12-04 01:46:43
问题 I am using SharedPreferences to keep the information about user's weight, which I need in my application. The problem is, how to set a default value (eg. 75 kg) automatically after installation? I know how to do it via .xml, but how to do this programmatically? My code: public class SettingsDialogFragment extends DialogFragment{ public static final String PREFS_NAME = "settings"; public Dialog onCreateDialog(Bundle savedInstanceState) { builder.setPositiveButton(R.string.save, new

Cannot get DialogFragment to dismiss programmatically

為{幸葍}努か 提交于 2019-12-04 01:32:49
问题 I have a DialogFragment that shows a list of items to pick from (similar to the attach dialog in Messaging). My problem is that I cannot get this dialog to dismiss when an item is selected. I've tried calling dismiss() and getDialog().dismiss() inside the OnItemClickListener , no luck. I've tried to remove the dialog through the FragmentManager, I've tried fragmentManager.popBackStack() , all to no avail. I cannot get this dialog to dismiss. It goes away fine when clicking outside the dialog

Adding a fragment to a dialog

那年仲夏 提交于 2019-12-04 01:31:35
I would like to add a fragment to a dialog (it can be either a DialogFragment or a regular Dialog). How do I do that? Here's my DialogFragment: public class MyDialogFragment extends DialogFragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { MyDialogFragment2 dialog = new MyDialogFragment2(); View v = inflater.inflate(R.layout.news_articles, container, false); getActivity().getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, dialog).commit(); return v; } } Here's news_article.xml: <FrameLayout xmlns:android="http:

Custom Dialog Fragment

感情迁移 提交于 2019-12-04 01:28:43
问题 I am trying to create a simplistic dialog similar to a DatePickerDialog . The Dialog that I am creating should provide the user with an array of images from which they can select. I believe I have managed to create the array and add the correct images to it, the problem I am running into now is how to get the Dialog to show up? What should I be returning? I have looked into AlertDialogs and such, but I am not sure as to what to do to implement them. UPDATED: FIXED PROBLEM, CODE SHOWN BELOW IS

DialogFragment remove black border

▼魔方 西西 提交于 2019-12-03 21:45:19
问题 I saw this question and also this one and some others, but nothing really helped me. I'm building a quick action DialogFragment for my list view and trying to set a custom view to it according to the android dev guide. view_quick_action.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/white" > <ImageView android:id="@

Can't get transparent DialogFragment

ε祈祈猫儿з 提交于 2019-12-03 19:09:14
问题 I have a dialog Fragment which look like that. AlertDialog ad = builder.create(); Drawable d = new ColorDrawable(Color.BLACK); d.setAlpha(130); ad.getWindow().setBackgroundDrawable(d); This code get background semi transparent. But I still got a white part on the bottom. I want to get rid of the white to just have semi transparent background I already tried a lot of stuff that I saw in other posts. I don't know what is the object that I must change between the DialogFragment, the AlertDialog

getSupportFragmentManager() is undefined

◇◆丶佛笑我妖孽 提交于 2019-12-03 19:05:23
问题 I'm getting the following error: "The method getSupportFragmentManager() is undefined for the type new View.OnClickListener(){}" in my fragment file shown below. I have the compatibility library referenced through ABS and the proper imports in place. I reinstalled ABS library w/ the compatibility library, cleaned the project, restarted Eclipse, but nothing has worked. Essentially, I'm trying to get the fragment to show a date picker through a dialog fragment. Once the date is picked, it must

DialogFragment crashes Activity when calling startActivity()

廉价感情. 提交于 2019-12-03 16:05:23
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) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick