//获得本设备的蓝牙适配器实例
/**Return:the default local adapter, or null if Bluetooth is not supported on this hardware platform */
mbta=BluetoothAdapter.getDefaultAdapter();
if(mbta==null){
AlertDialog.Builder builder=new AlertDialog.Builder(this);
builder.setTitle("警告")
.setMessage("此设备不支持蓝牙")
.setPositiveButton("确定",null)
.show();
return;
/**Return:the default local adapter, or null if Bluetooth is not supported on this hardware platform */
mbta=BluetoothAdapter.getDefaultAdapter();
if(mbta==null){
AlertDialog.Builder builder=new AlertDialog.Builder(this);
builder.setTitle("警告")
.setMessage("此设备不支持蓝牙")
.setPositiveButton("确定",null)
.show();
return;
}
- android自带的base64编码
- 首先导入包
- import android.util.Base64;
- String 变量=android.util.Base64.encodeToString(字符串.getBytes(),Base64.DEFAULT);
- 也可简写为
- String 变量=Base64.encodeToString(字符串.getBytes(),Base64.DEFAULT);
- 至于解码
- byte b[]=android.util.Base64.decode(字符串,Base64.DEFAULT);
- String 变量=new String(b);
- byte b[]=android.util.Base64.decode(字符串,Base64.DEFAULT);
//use option std c99 or std gnu99 to compile your code
LOCAL_CFLAGS += -std=c99