Discover android vibration intensity code, include the articles, news, trends, analysis and practical advice about android vibration intensity code on alibabacloud.com
Signal-intensity monitoring is a very common feature of Android phones. Today, this article shows an example of how Android realizes signal intensity monitoring. Share to everyone for your reference.
The specific implementation code is as follows:
Telephonymanager Tel;
-1 parameter is used to indicate non-repetition.
ParametersPattern an array of longs of times for which to turn the vibrator on or off.Repeat the index into pattern at which to repeat, or-1 if you don't want to repeat.Certificate ---------------------------------------------------------------------------------------------------------------------------------------------------
It also contains a method called Cancel to cancel the vibration.
DEMO
I did some other work in the past two days because I used the arraylist class when I used the getproviders () method yesterday. I suddenly wanted to have a deep understanding of its mechanism, and I got a lot of results, I read the source code of the Java Collection framework analyzed by a great god, so that the Fail fast mechanism is naked. The core code in the middle takes me into the door of the design p
---------------------------------------------------------------------------------------------------------------------------------------------------
It also contains a method called cancel to cancel the vibration.
DEMO code
/*
* @ Author octobershiner
* 2011 7 25
* SE. HIT
* A demo that uses android mobile phones to vibrate
**/
Package uni. vibrator;
Import
phones have these sensors, because the sensor needs money, so cheap phones will choose the most commonly used sensors to add, and some high-end models are basically the majority of sensors.Sensor use stepsThe steps for using an Android sensor can be broadly divided into three stages:1. Get sensor Management Service object Sensormanager.2. Create a sensor event listener class that must implement the Android.hardware.SensorEventListener interface.3. Us
provides a class to control the volume and vibration of the system. Android. Media. audiomanager uses this class.Set the phone to mute or vibrate, and change the vibration type. Audiomanager cannot be instantiated in code. You need to obtain its instance through context. getsystemservice (context. audio_service. OK. A
The source code is as follows:[Delphi]View PlainCopy
Uses
Androidapi. JNI. Os,
Androidapi.Jnibridge;
function Getvibratorarray (const Aintarr: array of Int64): tjavaarray
Var
Lindex:integer;
Begin
Result: = Tjavaarray
For LIndex: = Low (Aintarr) to High (Aintarr) does
Result.Items[lindex]: = Aintarr[lindex];
End
Procedure Vibratortest;
Var
Lvibratorobj:jobject;
Lvibrator:jvibrator;
ljavaarray:tjavaarray
Android login interface implementation-supports clear input box and vibration effect, android input boxDemo Effect
The main code is as follows:
A custom EditText, used to display clear buttons when there is text:
Import android. content. context; import
Listen to the text input situation, just limited to the toast slightly low point, this article is slightly "tall" some, experience rolling and vibration.First, two files are required. :The contents of the two files are as follows:Cycle_7:Shake.xml:And then we go to the subject. Let's start with an interface:Requirements: Enter the password in the edit box to determine if it is correct. If the input is correct, it will be displayed correctly on the bottom (listen text changes here); If the error,
In interaction with users, the vibration function is often used to remind users. This function is easy to implement. See the following code:
[Java] import android. app. Activity;Import android. app. Service;Import android. OS. Vibrator;Public class TipHelper {Public static v
[Android tool class] vibration and animation prompts when users enter illegal content-EditTextShakeHelper tool class introduction,
Reprinted please indicate the source: http://blog.csdn.net/zhaokaiqiang1992
When the user input in EditText is null or the data is abnormal, we can use Toast to remind the user. In addition, we can also use animation effects and vibration
in the Androidmainfest.xml declaring vibration permissions in a fileGet mobile phone vibration services through system services, such asVibrator vibrator= (Vibrator) Getsystemservice (Vibrator_service)Get vibration service after detection Vibrator is present, asVibrator.hasvibrator ();returns false if there is trueMake appropriate calls based on actual needs, suc
Android achieves vibration. See the following code.
Layout file main. xml
Version = "1.0" encoding = "UTF-8"?>
Xmlns: Android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "fill_parent"
See Apidemos, find View/animation/shake find the corresponding animation code, direct copy over
When importing a project, the R file does not exist, in many cases the XML file is wrong
Animation shake = Animationutils.loadanimation (this, r.anim.shake);
Et_phone.startanimation (shake);
Animated XML File Shake.xml
Android:interpolator= "@anim/cycle_7"
Interpolator is an INSERT, you can define the speed of the animation, etc.
Invokes the Setinter
Android login interface implementation-supports clear input box and vibration effectDemo Effect
The main code is as follows:
A custom EditText, used to display clear buttons when there is text:
Import android. content. context; import android. graphics. drawable. drawable; i
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.