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.
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)
In previous posts, I showed you how to get/post data to ASP.NET Web API service. However, until now, I only used JSON for communicating between server and client and what about for binary data? For example, uploading files to ASP.NET Web API? How should the controller work and which kind of HTTP request/HTTP format should the Android client send to server? In this blog post, I will show you a simple way to transfer binary data. In the demo, I have 2 components : web service and android client. Unlike the other post, for this one, unfortunately, I don’t have any sample web service (online over internet) for you to test. I don’t own any windows server (neither VPS nor dedicated server :() therefore I can’t host any web service allowing file uploading.
Let’s start with a question. When was the last time you played a song offline at your computer? For me, It’s long,loong,looong… time ago. Since the boom of music websites, I just choose one provider, create my favorite playlist and listen to music online. I don’t have any CD or .mp3 song at my local computer anymore, except that there are still a lot of songs in my Ipod but I don’t know where he is right now 😕 and that’s … bad. If something wrong happens with the website, my song will go with the wind. Moreover nowadays, in the dangerous internet, I doubt all of apps (if they are harmful) and consider a lot every time I install an app on my Android smartphone. So I always try to write the app or software myself if they aren’t complex. For this case, for my favorite songs, I decide to write a very simple media player connecting to my web service, playing my own song and I don’t have to worry anymore about the problem mentioned above. That’s is the concept. Next, I would like to show my media player works, if you want to improve it, go on!
If you’re working with .NET, maybe you’re already familiar with the concepts of dependency injection and MVVM (Model-View-ViewModel) pattern. Some of popular dependency injection containers for .NET are Castle Windsor, Ninject or Unity… They are all good frameworks, it just depends on which you prefer. For example, I use Castle Windsor at company and Ninject at home so that I can understand and use both of frameworks. It’s just the matter of favorite. The MVVM pattern was introduced years ago when WPF came to market. This pattern makes use of data binding structure of WPF and helps programmer to separate the view completely from logic layer. For more details about this pattern you can read some articles on my site about MVVM. Today, I will discuss again about these concepts, however not for .NET application, but I would like to show how we can apply these concepts into Android app. The example I use in this post is a De-De-Dictionary app. In this app, I can add German vocabulary with his explanation (also in German :)) through a user interface or look up for a vocabulary. Nothing special than a real dictionary book.
If you are searching to a coordinate (such as street, house number, location…) in Google Maps , you’ll see that there are more information about public places near by such as airport, cafe, restaurant, store… This information is really helpful, for example, if I want to move to a new apartment, I would like to check if the public transport is near by, any supermarket is available, playground for my children is not too far… with Google Maps you’ll get all information. Or another example, if I’m on highway and too tired because of driving, I can find any motel/hotel near by my current location so that I can drop in and take a rest. Therefore today I would like to make a small demo to show how we can show Google Places on our Android smartphone or integrate this feature to our apps.
Integrating Google Maps (or any map service) is always a nice feature for our applications, but it seems to be “complicated” for integrating Google Maps because Google Maps is not officially supported in emulator because lacking of Google Play Service. That forces us to use a real device during developing app. For me, not nice. So in this post, I would like to show step by step how I configure my emulator so that a Google Maps app can be installed on there. To make such an emulator, we have to use a set of correct settings/files. If not, it won’t work. So you have to set all settings like mine. My emulator targets on Android 4.2.2 – API Level 17.
Linking to social networks may be one of special features of your program. Today I’d like to make a small demo to make a tweet in Twitter from Android. The demo will use oAuth to authenticate user with Twitter and allow him to tweet when authentication is successful. The app won’t make any authentication with username and password, the authentication process will happen at Twitter website. When the process finishes, a successful access token will be returned to notify if user entered correct log in data. We can store this token for later use without requiring user to log in again.