android-fragmentactivity

How fix this: on logcat -->> error loading /system/media/audio/ui/Effect_Tick.ogg??

霸气de小男生 提交于 2020-01-29 12:12:06
问题 I have a problem: error loading /system/media/audio/ui/Effect_Tick.ogg It's shown when I click navdraw icon. Anybody can help me?? This is errors on logcat: 04-20 01:42:11.240: E/SoundPool(639): error loading /system/media/audio/ui/Effect_Tick.ogg 04-20 01:42:11.251: E/SoundPool(639): error loading /system/media/audio/ui/Effect_Tick.ogg 04-20 01:42:11.251: E/SoundPool(639): error loading /system/media/audio/ui/Effect_Tick.ogg 04-20 01:42:11.280: E/SoundPool(639): error loading /system/media

How to properly retain a DialogFragment through rotation?

北慕城南 提交于 2020-01-27 08:55:42
问题 I have a FragmentActivity that hosts a DialogFragment. The DialogFragment perform network requests and handles Facebook authentication, so I need to retain it during rotation. I've read all the other questions relating to this issue, but none of them have actually solved the problem. I'm using putFragment and getFragment to save the Fragment instance and get it again during activity re-creation. However, I'm always getting a null pointer exception on the call to getFragment in

Viewpager pages with different layouts but same fragment class

余生长醉 提交于 2020-01-25 20:04:47
问题 Using a ViewPager, I'm working on a guide that tells the user how to use my app. This is how i currently add/setup the pages: ... private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter { public ScreenSlidePagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { switch (position) { case 0: return new Guide_fragment(); case 1: return new Guide_fragment_2(); case 2,3,4 etc. default: return null; } } ... But this way I have to have a

Adding toolbar to a FragmentActivity

蹲街弑〆低调 提交于 2020-01-23 08:10:48
问题 Am extending a FragmentActivity in a class which serves as my base activity where my other activities extend from. My issue is when I extend my other activities from my base activity, I loose toolbar functionality. How can I add this to my base activity so that my activities can inherit the toolbar? Any pointers? 回答1: In case fragments should have custom view of ToolBar you can implement ToolBar for each fragment separately. add ToolBar into fragment_layout : <android.support.v7.widget

Adding toolbar to a FragmentActivity

核能气质少年 提交于 2020-01-23 08:09:31
问题 Am extending a FragmentActivity in a class which serves as my base activity where my other activities extend from. My issue is when I extend my other activities from my base activity, I loose toolbar functionality. How can I add this to my base activity so that my activities can inherit the toolbar? Any pointers? 回答1: In case fragments should have custom view of ToolBar you can implement ToolBar for each fragment separately. add ToolBar into fragment_layout : <android.support.v7.widget

How do I change my button image with navigation drawer opening and closing

坚强是说给别人听的谎言 提交于 2020-01-23 02:56:10
问题 I have a navigation button for my navigation fragment which turns active and opens a navigation drawer menu upon click: Now when I click it, it turns active as follows: However, I want to associate it with a navigation drawer such a way that, even if I do not click the button and slide open the navigation drawer, the button turns active when the navigation drawer menu is open and when closed by sliding back in from right to left, the button turns red/inactive. The code which I am trying to

ViewPager with Fragments that contain TableLayouts loads slowly:

落花浮王杯 提交于 2020-01-22 20:02:27
问题 I'm developing an Activity with a ViewPager that contains Fragments (Max 4 fragment each time) when each containing TableLayout . So basically 4 Tables are loaded. This is the code for loading the data into the Fragment which is later attached to the ViewPager : public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { return null; } LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT

Handle Fragment duplication on Screen Rotate (with sample code)

假装没事ソ 提交于 2020-01-22 09:52:11
问题 There are some similar answers, but not to this situation. My situation is simple. I have an Activity with two different layouts, one in Portrait, another in Landscape. In Portrait , i use <FrameLayout> and add Fragment into it dynamically . In Landscape , i use <fragment> so the Fragment is static . (in fact this doesn't matter) It first starts in Portrait , then i added the Fragment by simply: ListFrag listFrag = new ListFrag(); getSupportFragmentManager().beginTransaction() .replace(R.id

How to start an Activity inside a Fragment class

可紊 提交于 2020-01-17 16:34:48
问题 I have two tabs.First tab is for map .Second tab is for list. And I tried to display the map on the first tab. But it has displayed only the layout [return inflater.inflate(R.layout.map_activity, container, false);] But instead of this I have one activity for map, i want to load that activity without losing tab ,inside the tab itself.Please help me 回答1: As you told you want to show activity in fragment, Your tabs are fragments. I want to make clear that Fragment cant host Activity . Your

FragmentActivity onCreateView

帅比萌擦擦* 提交于 2020-01-16 04:17:12
问题 I try to use the Android compatibility library (or now called the support library) v4 for pre-honeycomb android devices. I understand that, instead of using the Fragment class, I should use the FragmentActivity class. According to all the tutorials I can find, I can use the onCreateView method as in the Fragment class: public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) However, the onCreateView method in the FragmentActivity seems to be