Android Auto-Versioning

This post is a continuation of my previous post about using Gradle to streamline versioning into the build process so you can spend more time on what’s important: building your product. The basic idea

Streamline releases with Android

When it comes to releasing a build, it usually goes without saying that there are a few housekeeping tasks that need accomplished before an actual release goes out. Things like tagging and pushing you

Customizing EdgeEffect

If there’s one thing Android is good for, it’s being able to customize almost every aspect of your application, down to the nitty gritty. One area that some developers/designers may overlook when customizing is the EdgeEffect. The EdgeEffect is an indicator to let the user know that he/she have reached the end of the scrolling container. You’ll also know it as the blue overscroll glow…

Managing Fragment States Manually

If you find yourself in a bit of a sticky situation where you need to save Fragment state manually, thankfully Android has a simply way of accomplishing this. Step 1 - Get the FragmentObtain the targe

Notifying ViewPager Fragments

As the title suggests, this post is about notifying Fragments in a ViewPager. Even though PagerAdapter has a notifyDataSetChanged() method, this method is for a different purpose. There are undoubtly more than one way to solve this problem, but I found this method to be very simple to implement and easy to understand.

Using Custom ActionBar Title Views

The ProblemThe default ActionBar is good for most use cases, however some applications may require further customization to establish a brand. Customizing the ActionBar title may seem quite trivial, however, there are a couple of things that you can do to create an even more polished experience. As you may have guessed already, setting a custom View is the way to go… 123456789@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar ab = getActionBar(); ab.setDisplayShowTitleEnabled(false); ab.setDisplayShowCustomEnabled(true); View customTitle = getLayoutInflater().inflate(R.layout.custom_title, null); ab.setCustomView(mTitleView);} The above code will absolutely work with zero problems…

Retaining Fragments in FragmentPagerAdapter

The general pattern for using a FragmentPagerAdapter looks something like this… 123456789101112131415public static class MyAdapter extends FragmentPagerAdapter { public MyAdapter(FragmentManager fm) { super(fm); } @Override public int getCount() { return NUM_ITEMS; } @Override public Fragment getItem(int position) { return ArrayListFragment.newInstance(position); }} The above code works perfectly, however if getItem(int) was to be called by anything other than FragmentPagerAdapter, things may get weird. The getItem(int) method gets called by instantiateItem(ViewGroup, int) if the Fragment at the given position doesn’t exist already in the FragmentManager. This explains why getItem(int) returns a new instance every time it’s called in the snippet above.