Android – Show images from Flickr with ImageGridView

Flickr is a wonderful image hosting and video hosting of Yahoo. With a free account, you can get a disk space up to 1 TB for uploading and sharing your photos as well as videos. In this post, I would like to make a small demo showing how we can consume the Flickr’s REST web service and display public images of an album on Android phone. The images could be shown either in thumbnail mode or medium mode. The example app is just a proof of concept, you have to improve it when you want to build a same one in practice because I just don’t care about optimizing resources (memory) in source code. You will also ‘learn’ how to implement a singleton pattern (in entire app) with roboguice. That means, small example, interesting use cases.

Continue reading Android – Show images from Flickr with ImageGridView

Android – Build tab layout with FragmentPagerAdapter, ViewPager and ActionBar

Tab control is a popular component in desktop application. I think, most of desktop application contains at least a tab control in one way or another. In Android environment, we also have a tab control named “TabHost”, but since Android 3.0, it was replaced by ActionBar. In this post I would like to show how we can make a “fake” tab layout with ActionBar so that we can give user the same experience like TabHost. This control is built up by a combination of ActionBar and FragmentPagerAdapter. The labels will be located at the top, switching between tabs will load the content of the tabs. Moreover thanks to touch screen of smartphone, user can also swipe to navigate between tabs. The final result of our “fake” tab layout looks like following image (Please note that we aren’t going to make a “tab control” but a “tab layout”, they are different concepts)

Continue reading Android – Build tab layout with FragmentPagerAdapter, ViewPager and ActionBar