When using Fragments in tabs, the FragmentManager takes care of instantiating, retaining, and reusing Fragments. The problem there is that a tag for a fragment is auto-generated. If we want to reuse that exact Fragment in a different layout (like when the device is rotated), we need to extract the tag and use the same one when re-initializing.
The better way to do this is to create your fragment instance and tag yourself. That way, you can easily get a reference to your fragment later from the fragment manager.
So essentially we need to replicate the inner workings on fragment pager adapter and explicitly add your fragment (and your tag).
Jake Wharton has a great code sample that demonstrates this for using a Fragment Pager Adapter. Building off that, I combined the Fragment Pager Adapter code with a standard Tab Adapter.
The best fantasy football drafting tool for Android is back for 2013. Updated look and feel for both the draft and news features, improved draft controls, optimizations for all phone sizes including tablets, and more.
Let’s take a look at some of the best new features for this year’s fantasy football drafting season.
To send immediate alerts of earthquakes to users of my Android app Earthquake Alert, I use Google App Engine as the processing backend for C2DM (cloud to device messaging). Since this was recommended by the Google Android team, I thought it would be a great option. However that all changed when Google changed their pricing model for App Engine. Continue reading
In order to enhance my Earthquake Alert! Android app, I wanted to be able to alert any user’s phone when an earthquake occurs anywhere in the world that matches some pre-defined filters. The end result was the Earthquake Alerter add-on app and it uses Google’s C2DM and Google App Engine to accomplish. This post describes how I accomplished this. Continue reading
The best off-line fantasy football drafting app for Android is back and re-tooled for 2011. Master your fantasy football draft with the addition of a number of asked-for features like custom scoring settings, the ability to manually edit the pre-rankings, and better support for player news. Continue reading
I’ve always been fascinated with Earthquakes. This fascination lent itself well once I began writing Android apps. I was able to combine my interests and create Earthquake Alert!, an app that give users a great way to view and explore earthquakes all around the world. As an active user of the app myself and testing push notifications, I was one of the earlier people to be aware of the Japan quake off the coast of Honshu.
If you’re writing an Android App using a MapView, then you will most likely want to view the user’s location. This tutorial will show you how to create an activity that makes use of Android’s built-in MyLocationOverlay class.
Wanting to change the default TabWidget look and feel for Android? In this tutorial, we will investigate a few different ways to customize your app’s tabs. Continue reading
Border Wait Android app was my first app and it showed – basic ListView, simple icons, and a launcher icon I found from the web.
For my fantasy football app Draft Punk, I used a number of new UI patterns I had seen in the official Twitter App and read on the Android Developer’s blog including the dashboard and action bar. The result was my best looking app to date and a number of positive user reviews mentioning the interface and graphics.
So after finishing Draft Punk, it was time to revisit the look, feel, and graphics of Border Wait.
Last tutorial, we wrote a simple app that displays two interacting list views in a
TabActivity. In this tutorial, we will up the ante and add a
MapView as the content of one of the tabs. Why again are we using multiple views in an activity instead of using a separate activity for each tab content? Remember, we want our tabs to be able to easily interact with one another, and keeping them as views allows us to handle the logic and interaction within one activity.
So, our goal in this tutorial is to have a list of geo coordinates and when we click on an item in the list, our map view goes to that location.