I implemented a Time Picker in the preference using the code found here where the class TimePreference extends the class DialogPreference but I found a lack of alignment with the other preference items because of a different setting of the margins and/or padding.
Continue reading “Padding and margin in DialogPreference”
In this post I show some ways to copy arrays of primitive data and objects to another array.
Continue reading “Copying an array in java”
In the previous post Handling the multi-touch in a view I’ve used a class that extends a View to show the circles where the screen is touched, here I display the same example but using a SurfaceView.
Continue reading “Handling the multi-touch in a surface view”
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
Continue reading “Handling the multi-touch in a view”
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
Continue reading “Displaying notifications and progress bar from an instance of AsyncTask”
A lotus view open in a browser is very ugly but you can greatly improve using stylesheets (css); here I explain how to use the css in a lotus view in order to improve the look and feel and to display rows in alternate colors.
Continue reading “How to change the look and feel of a view using css”
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.
Continue reading “How to display an icon in the preferences”
In this post I write an example about how to launch a fortran executable form a java program passing some arguments and getting back a result.
The chosen example uses code written in fortran to get primes, it is from Sieve of Eratosthenes.
Continue reading “Running a fortran program from java”
The inner classes, and then not static, can access even if with some limitation to the variables of the outer class.
Continue reading “Getting the variables of the outer class from an inner class”
The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3.
Find the sum of the only eleven primes that are both truncatable from left to right and right to left.
NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.