Retain the Fragment object while rotating

By default Android will retain the fragment objects. In your code you are setting the homeFragment in your onCreate function. That is why it is allways some homeFragment or fl what ever that you set in onCreate. Because whenever you rotate, the onCreate will execute and set your fragment object to the first one So … Read more

How can I customize the Action Mode’s color and text?

This is the style used for any ActionMode, I pulled it from the SDK. You’ll need to create your own style to customize it. It’s really easy to do. If you’ve never done anything like this before, you should read through this post on customizing the ActionBar. It explains everything you’ll need to know. <style … Read more

How to implement the Android ActionBar back button?

Selvin already posted the right answer. Here, the solution in pretty code: public class ServicesViewActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // etc… getActionBar().setDisplayHomeAsUpEnabled(true); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; default: return super.onOptionsItemSelected(item); } } } The function NavUtils.navigateUpFromSameTask(this) requires you to … Read more

Technical details of Android Garbage Collector

To answer one of your questions, the Dalvik VM indeed does use a tracing garbage collector, using a Mark and Sweep approach. According to The Dalvik Virtual Machine Architecture: The current strategy in the Dalvik garbage collector is to keep mark bits, or the bits that indicate that a particular object is “reachable” and therefore … Read more