Android 应用开发之vibrator
来源:互联网 发布:ieee编程语言排行榜 编辑:程序博客网 时间:2024/06/08 02:55
http://blog.csdn.net/shaojie519/article/details/6915998 --example
http://mobile.csdn.net/a/20110301/292785.html ---系统架构
http://www.cnblogs.com/wt616/archive/2011/06/20/2085222.html ----button使用方法
http://www.2cto.com/kf/201111/112226.html
http://developer.android.com/reference/android/widget/Button.html ---button
http://developer.android.com/reference/android/os/Vibrator.html ---vibrator
一。 VibratorTest.java
package com.android.vibratortest;
import android.app.Activity;
import android.os.Vibrator;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import android.content.Context;
public class VibratorActivity extends Activity {
/** Called when the activity is first created. */
private Vibrator vib;
private Button btnOk;
private Button btnCancel;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
init();
btnOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
vib.vibrate(10000);
showToast("ok");
}
}
);
btnCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
vib.cancel();
showToast("cancel");
}
}
);
}
private void init(){
btnOk = (Button) findViewById(R.id.btnOk);
btnCancel = (Button) findViewById(R.id.btnCancel);
vib = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE);
}
private void showToast(String msg){
Toast.makeText(this, msg, 1).show();
}
}
二。manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.vibratortest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".VibratorActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.VIBRATE"/>
</manifest>
三。 string.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">VibratorTest</string>
<string name="btnOk">开始震动</string>
<string name="btnCancel">停止震动</string>
</resources>
四。 main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/btnOk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/btnOk" />
<Button
android:id="@+id/btnCancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/btnCancel" />
</LinearLayout>
- Android 应用开发之vibrator
- android Vibrator 振动开发
- Android之Vibrator使用。
- Android开发之控制手机振动(Vibrator的使用)
- Android震动vibrator系统开发全过程
- Android震动vibrator系统开发全过程
- android开发--振动器类Vibrator的使用
- Android震动vibrator系统开发全过程
- Android震动vibrator系统开发全过程
- Android震动vibrator系统开发全过程
- Android震动vibrator系统开发全过程
- android Vibrator
- android Vibrator
- Android & Vibrator
- Android vibrator
- Android开发(22) Android 手机振动器(Vibrator)的使用
- android开发笔记之多媒体—振动器(Vibrator)
- Android之应用开发
- nginx均衡负载模块里的心跳检测模块,可以自动维护server的状态
- Iphone how to build UI for both resolutions 640X960 and 320X480?
- 为什么java.net.URLEncoder.encode方法要调用两次而不是一次呢?
- Android中的RelativeLyout布局
- 在线学习的特点和优劣分析
- Android 应用开发之vibrator
- 同步和异步的区别
- 在线学习和现场学习的比较
- 这样进行在线学习效果最好
- webkit的js对象扩展(二)——binding方式创建自定义对象(多实例)
- grep命令
- 处女帖
- 在线学习如何听课和记笔记
- Myeclipse中消除frameset引起的“the file XXX can not be found."的提示