Last week, in spite of the winter the weather was very mild. The beams of the winter sun brought forward the memories of the summer: hot weather, girls in bikinis, mojitos! We have already gotten a promise for the first two in a certain form here in Helloandroid HQ (the heating system will be repaired, and we 'll have some women colleagues), but it is our task to make coctails.
publicclass Mojito {
privatefinalint mWhiteRum;//cl
privatefinalint mBrownSugar;//spoun
privatefinalint mLime;//clove
privatefinalint mMenta;//piece
privatefinalint mSoda;//decilitre
public Mojito(int whiteRum, int brownSugar, int lime, int menta, int soda){
This demo shows how to speed up the original autocomplete textview assuming that we can work with ordered data.
Let's prepare a simple test environment, which demostrate the difference between the two versions. Then let's generate a few thousand test data, and create two textviews from which we will speed up the second one.
Now that the project is setup you can start creating custom controls and states for them. This will all be inside the library project. Firstly you need to create an attributes xml file in values/attrs.xml (the name has to be attrs.xml) and adding the state:
Lately we have been doing all kinds of demo projects, and tests, where we did not want to use constant data to present our products. Having a demo of your application is only nice, if it has relevant data in it. It could be top class technology, but if it is using the same image 20 times in a list, well that does not look very good.
Getting 20 relevant images on a subject takes up a lot of time, even with search engines and royalty free photo sites.Luckily most search able sites have free apis, here is a little snippet for flickr's services.
This article was requested by some of our community members. It is based on the Android Gallery, ImageView Example tutorial by Sasikumar (Part 1 is here). I extended his example with a new function. If you long click on the big image, an alert dialog show up and ask “Do you want to use this image as a wallpaper?". If you click yes, the actually image will be your new wallpaper.
Accessing the sensor data of a phone, is not too complicated, but since API level 3, a lot of things got deprecated. Using only the emulator, you have only a few (here is one) options, to simulate sensor data. I would recommend the use of a physical phone. Keep in mind, that not all phones have the same sensors integrated! Cheaper phones might not have a temperature sensor, or a gyroscope, but I'm pretty sure, that all Android phones have at least an accelerometer, and an orientation sensor.
Here is an example, how to access acceleration and orientation sensor data (in API level 3 and above), without using any deprecated methods.
In this last part of the tutorial we will implement buttons to the appWidget, which will directly interact with the appWidget functionality.
We will have 2 buttons, a plus button to add one more day to the target date, and a minus button to decrease time left by one day.
First add the buttons to the countdownwidget.xml layout:
As described in the previous part, we will use a Service to update the appWidget.
So we will have the Service below, which gets the command (right now we have only the update command), ant the appwidgetId, reads the date from sharedPreferences and updates the widget.