karomile.com

karomile.com was supposed to be a simple in a design but rich in content. This is a karomile's photo site developed by me, according to her concept and design. After the PayTogether Android app, this is another project in my portfolio - web development is my skill as well (also in much more advanced designs, responsive … Continue reading karomile.com

Maven and apklib: Duplicated file error

The maven build error occurred when I had two Android projects: the one is apklib and the second one that is the actual application (the apk file) that uses apklib. The error is saying that apk project contains duplicated R.java and BuildConfig.java files under target directory. The first file comes from apk project, and the second … Continue reading Maven and apklib: Duplicated file error

Android SQLite schema migration with patches

When upgrading your Android application you often need to change its data model. When the model is stored in SQLite database, then its schema must be updated as well. I recommend the concept of patching and versioning the database This is very well described in this article: http://www.greenmoonsoftware.com/2012/02/sqlite-schema-migration-in-android/ The idea behind it Android lets you … Continue reading Android SQLite schema migration with patches

Tutorial: Set up Android UIAutomator in Eclipse

Remember my post about MonkeyTalk? UIAutomator seems to be even better automated andrroid app test suite - it does not require any dedicated libs in Android project and can work in any application (even if you do not have access to its source code. All this because it is nested in Android OS, so it … Continue reading Tutorial: Set up Android UIAutomator in Eclipse

Android status bar notifications [complete tutorial with source code]

Displaying status bar notification is a common way to unobtrusively inform user that something has happened (like new GMail message notification). In your app you can display it whenever you want. I will guide you how to do it from basics. This is how notifications are presented to the user: Google's documentation regarding the notifications … Continue reading Android status bar notifications [complete tutorial with source code]

Android: check device screen density programatically

When designing app for multiple screen sizes it is useful to check screen density (ldpi, mdpi, hdpi, xhdpi) and to know exact value in dpi. This is how to do it programatically: public void determineScreenDensity() { DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int density = metrics.densityDpi; if (density==DisplayMetrics.DENSITY_HIGH) { Toast.makeText(this, "DENSITY_HIGH: " + String.valueOf(density), Toast.LENGTH_LONG).show(); … Continue reading Android: check device screen density programatically

Android: check device screen size programatically

When designing app for multiple screen sizes it is useful to check screen size (small, normal, large, xlarge). This is how to do it programatically: public void determineScreenSize() { if((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) { Toast.makeText(this, "Large screen",Toast.LENGTH_LONG).show(); }else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) { Toast.makeText(this, "Normal sized screen" , Toast.LENGTH_LONG).show(); }else if ((getResources().getConfiguration().screenLayout … Continue reading Android: check device screen size programatically

Android: handle uncaught exceptions

To avoid the 'unfortunately app has stopped' dialog box, you can handle all uncaught exceptions in your app by setting custom handler. Uncaught exception Handler Paste this code in the beginning of your app. This will setup the handler. Do it only once, for example in onCreate of your fisrt activity that is displayed to … Continue reading Android: handle uncaught exceptions