getSystemService – from Context to Android system

This article aims to teach you  what context.getSystemService method is and how to use it wisely Purpose Context.getSystemService method is used when we want to access one of few Android system-level services. To name only few of managers that we can get: LocationManager – access GPS device information NotificationManager – manage (create, cancel) notifications ConnectivityManager … 

 

Activity lifecycle – different approach

Creating mobile applications is always so serious. If it seems to you that the explanation of the lifecycle of an Activity is difficult, then maybe the humoristic approach will be more effective (or at least entertaining): When you click to open your application, First screen is waiting to creation. Developers creativity, Led to call it … 

 

Unit tests in Android projects

Purpose This article aims to teach you how to run unit tests from terminal and what is the output of those unit tests. Knowledge of this issue  is the first step to automating unit tests execution process. Beginning Let’s assume that you just finished the basic funcionality of your android application. The project consists of code … 

 

MVP for Android

Have you ever had problems with the lifecycle of an Activity or Fragment? The necessity to handle things like a configuration change, an activity kill because of low memory issues, removal of the entire app process, etc. always distinguished Android mobile enviroment from other application runtime enviroments. In our Android world there are many platform specific … 

 

Android Fragments restoration mechanism

In my last post, where I described a problem of incorrect usage of Fragments instantiation inside FragmentPageAdapter & ViewPager, I wrote: After orientation change all fragments currently added to FragmentManager are automatically restored and instantiated so there is no need to create them once again. Today, I want to focus more specifically on an issue how … 

 

Fragments in ViewPager

Using ViewPager with FragmentPagerAdapter or FragmentStatePagerAdapter appears to be quite easy and enjoyable. It could be done within few simple steps: Create layout .xml resource with ViewPager Create adapter and implement all required methods Set adapter instance to your ViewPager instance. Simple? Yes! – but like always only for easiest (also the most common) case Problem occurs when …