In this post you find a full example about how to
- extend a view to draw, in this case, a circle where you touch the screen
- implement a listener on a view to handle the multi-touch
In this post you find a full example about how to
The AsyncTask class is used to perform background tasks and it might be useful to show notifications and progress bars to alert the user.
In this post I write an example where I create two AsyncTask instances showing a startup notification, a progress bar and a notification of completed task
In the Android preferences you can put different types of controls: check box, edit box, list,…, but none of these displays an icon (see Settings).
Usually a preference consists of two lines, the title and the summary, and after you have clicked you get a dialog box where you can select the chosen item, as you can see in the two pictures below.
In this example you can see how to implement the Up Navigation, i.e. the option to go back to a previous activity using the button in the upper left of the action bar.
The previous activity can be a fixed activity or an activity determined at runtime.
In the post Tab Layout in Android with ActionBar and Fragment the fragments can’t be replaced later, in this post I write the changes in order to replace the first fragment of the first tab with a third fragment using a button at runtime.
A service is a task running in the background to perform actions without a user interface and they are used to perform long running operations with a significant use of resources by avoiding delays in the user experience.
The services belong to one or both of the following categories:
The method startActivity(Intent intent) of the class Activity allows you to call a second activity specified using the argument Intent.
You can associate primitive data or primitive data array to the argument Intent and then the second Activity can access them, you can also pass objects of type String using methods of the class Bundle like put*().
In this post I show an example to pass a more complex object between an Activity and another.
In Eclipse launching javadoc from menu (Project -> generate javadoc…) if you get the errors:
If you have an EditTextPreference tag in a xml file you can catch the click event implementing OnSharedPreferenceChangeListener but it doesn’t work if you have a Preference tag in the xml file.
Consider the following code inside a xml file for the preferences:
1 2 3 4 5 |
<Preference android:key="my_key" android:summary="my_summary" android:title="my_title" > </Preference> |
It is very easy to get the Context inside an Activity:
But you can’t use any of these two methods inside a Fragment and you have to replace them respectively with:
I often do this replacement when I use code written for an Activity, but that I must use in a Fragment.