One of the niceties about today’s smartphones is that it has a vibrating effect. This is particularly useful for the user during meetings, movies, etc. And with Android, it is so much easier to implement this as well. For this Android tutorial, we will add a vibrating effect once the weather app is launched.
To start, follow the steps below:
1. Add the code in AndroidManifest.xml file
<uses-permission android:name="android.permission.VIBRATE" />
2. Add the code in OzWeatherActivity.java file. Just place this inside the onCreate method.
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // Vibrates for 1000 milliseconds long milliseconds = 1000; v.vibrate(milliseconds);
Because there’s no vibration in an AVD, it is be to plugin your Android phone to your development computer via USB and test it from there.
Related Posts:
Tags: android tutorial
Source : htmlpress[dot]net
0 comments:
Post a Comment