@Override
protected void onResume()
{
super.onResume();
try
{
Thread.sleep(30000);
getBlueToothName();
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void getBlueToothName()
{
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
String name = bluetoothAdapter.getName();
System.out.println(name);
}
LogCat中System.out 打印时候出现空指针,我想知道为什么会出现这个异常
有人和我说 没有反应过来 我加上了延迟 还是出现空指针androidnull
protected void onResume()
{
super.onResume();
try
{
Thread.sleep(30000);
getBlueToothName();
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void getBlueToothName()
{
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
String name = bluetoothAdapter.getName();
System.out.println(name);
}
LogCat中System.out 打印时候出现空指针,我想知道为什么会出现这个异常
有人和我说 没有反应过来 我加上了延迟 还是出现空指针androidnull
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货