Tag: android-fragments

Fragment Recursive entry to executePendingTransactions Error

I have an error as: 03-01 11:20:43.453: E/AndroidRuntime(31235): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.qz.Blaze.ServiceStarted flg=0x10 } in com.qz.Blaze.$ServiceStartedReceiver@423540f0 03-01 11:20:43.453: E/AndroidRuntime(31235): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:766) 03-01 11:20:43.453: E/AndroidRuntime(31235): at android.os.Handler.handleCallback(Handler.java:615) 03-01 11:20:43.453: E/AndroidRuntime(31235): at android.os.Handler.dispatchMessage(Handler.java:92) 03-01 11:20:43.453: E/AndroidRuntime(31235): at android.os.Looper.loop(Looper.java:137) 03-01 11:20:43.453: E/AndroidRuntime(31235): at android.app.ActivityThread.main(ActivityThread.java:4921) 03-01 11:20:43.453: E/AndroidRuntime(31235): at java.lang.reflect.Method.invokeNative(Native Method) 03-01 11:20:43.453: E/AndroidRuntime(31235): at java.lang.reflect.Method.invoke(Method.java:511) […]

getResources from FragmentStatePagerAdapter

Inside an activity class, I have this class (from android samples): public static class DemoCollectionPagerAdapter extends FragmentStatePagerAdapter { public DemoCollectionPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { Fragment fragment = new QuestionFragment(); Bundle args = new Bundle(); args.putInt(QuestionFragment.ARG_OBJECT, i ); fragment.setArguments(args); return fragment; } @Override public int getCount() { return questionList.length; } […]

java.lang.IllegalStateException: RecyclerView has no LayoutManager in Fragment

I was in the process of changing an Activity into a Fragment and got the following error as soon as I inflated the RecyclerView. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { —-> View rootView = inflater.inflate(R.layout.layout_containing_recyclerview, container, false); java.lang.IllegalStateException: RecyclerView has no LayoutManager Before I changed my Activity to a Fragment the […]

Fragment loading spinner/dialog in Honeycomb

When loading data into my Fragments I would would like to have an indeterminate spinner in the middle of the fragment (example in pic below) to show the user that content is loading within that particular pane. What’s the best way to do this in Honeycomb? I don’t really want to use a spinner in […]

Navigation drawer below Actionbar

Right now I just started a project in Android Studio with the NavigationBar as preconfigured in the template. Apparently it puts the navigation drawer behind the actionbar. Many questions you find want the navigation drawer on top of the actionbar, I would like to have it start below the actionbar. This is what I currently […]

Send values from ViewPager Activity to a Fragment by bundle

I have an ViewPager Activity that call the fragment that represent the slide layout. What i need is pass values from activity to fragment by bundle. How i can do this? I try pass a int 2 in onCreate() but not work and i Activity: @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_screen_slide); Intent intent = […]

I don't want to refresh fragment on change

I have 3 fragments… with their 3 navigation tabs. The problem is that if i’m on the first tab, and i click the third.. when I click another time the first, it reloads all the fragment. If I click the second tab (in the middle) and I click the first, it doesn’t reload. My objective […]

Close Navigation Drawer on application start

I have developed an application with Navigation Drawer. Whenever the application starts for the first time, it has navigation drawer open. Is there any way I can set it as closed? Below is the auto generated code for your understanding. import com.example.navigationdrawer.R; import android.support.v7.app.ActionBarActivity; import android.app.Activity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.view.GravityCompat; import […]

getWidth Returns 0 in Fragment, getPaddingLeft Returns Non-Zero

I am trying to convert my Android app to Fragments to support multiple screen sizes and to use the new ICS tabs correctly. Previously I used the onWindowFocusChanged() method and ran the following code inside of it – basically this did some dynamic formatting of my layout after it was created. public View onCreateView(LayoutInflater inflater, […]

Fragment on Screen Rotation

I have added a viewpager to an activity which contains two page. In onCreate of activity I add fragments to a fragmentAdapter: public void onCreate(Bundle savedInstanceState) { …… FragmentAdapter fragmentAdapter = new FragmentAdapter ( getSupportFragmentManager(), new Fragment[]{FragmentGame.builder(id), FragmentComments.builder(id)}, new String[]{getString(R.string.gameInfo), getString(R.string.comments)} ); ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager); viewPager.setAdapter(fragmentAdapter); public static FragmentGame builder(long id) { FragmentGame […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.