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
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.
Do you need the width, height or orientation of the screen in your Android application? Try this
Today we’ll learn more about Handlers and Threads and we’ll have an example with a class inheriting Thread, using Messages and Handlers. This is gonna be a long post with lots of information, hopefully not overwhelming.
Today we’ll focus on Threads creation and analyze an example of a local Thread instantiated in a method.
First of all I want to make sure that we understand why and how we deal with Threads. We use Threads objects to start parallel execution lines. For this we need to “load” the Thread object with the behavior we want, meaning to provide a run() method for it, which contains that behavior.