Warum kann diese Methode in einer Klasse nicht aufgelöst werden? Diese Klasse ist außerhalb der Android-Klasse. Wenn ich die Methode in die Hauptklasse stelle, funktioniert das gut, aber nicht in einer anderen Klasse.Kann Methode startActivityforResults in diesem Code nicht beheben
class blu {
public blu(){
}
public boolean comprobarBluetooth(Context context){
CharSequence text = "No tiene Bluetooth";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
//mirem si hi ha bluetooth al aparell
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if(mBluetoothAdapter==null) {
//disparo un toast per informar
return false;
}else{
if (!mBluetoothAdapter.isEnabled()) {
//si està apagat obrim el dialeg per activarlo.
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}//SI startActivityForResult torna un OK faig return true, i executo el metode de buscar dispositivos
}
return true;
}