Android – Handling Screen Orientation

Do you want your application to run only in Portrait mode, or maybe in Landscape only? Or maybe you want to force a change of orientation during execution despite of the real orientation of the device? Or maybe you want the orientation not to change when the mini-keyboard is opened? Here’s what you can do

Read More

Android – Using Intents to Open Files

Do you want to open from your code some mp3 or image file with the default media player/image viewing application? Use this

Read More

Android – Request User Decision when Back Button is Pressed

Did you want to display a Dialog to the user asking him “Do you really want to quit?” when he presses the back button thus ending your current Activity? Here’s how to do it

Read More

Android – Screen Touch Handling – MotionEvent Attributes

Do you need info about user touch on the screen? It is quite simple, in your Activity class you must override the method public boolean onTouchEvent(MotionEvent event) and manage there the Event. You are probably interested in MotionEvent.ACTION_DOWN, MotionEvent.ACTION_UP or MotionEvent.ACTION_MOVE.

Read More

Android – Screen Size, Orientation and Pixel Density

Do you need the width, height or orientation of the screen in your Android application? Try this

Read More

Android – Activity in Fullscreen Mode

Do you want your Activity to run in fullscreen mode? Any of these two snippets will do the trick

Read More

Android – Custom Dialog Initialization Problem

Have you tried to add a Custom Dialog to your application? You followed the instructions from the official page and got an error about Window token null (android.view.WindowManager$BadTokenException)?

Read More

Hello World!

I’ve started learning and programming for Android a few months ago and as such I’ve often found myself spending a lot of time looking for some obscure solution for the various problems I’ve encountered. Sometimes I’ve caused them myself (all programmers make mistakes), other times I just didn’t know how to do some things, other times the documentation was wrong or scarce.

Read More