hello every body, i am a fresh in android.
i have wrote a program that about the bluetooth use the sdk 2.2 api
level 8.
first i wrote a jar. In this jar, it check the bluetooth grant. if the
bluetooth device not prepered, it will start the system bluetooth
grant activity. And then I wrote a test program. But when I run the
test program, it always "stopped unexceptedly". If i call the
"bluetooth grant system activty" in the test program, it will success
running.
How can I start the system activity from a jar?
thx alot.
------------- this is my jar source----------
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
//import android.content.Context;
import android.content.Intent;
public class startBTActivity extends Activity{
private static BluetoothAdapter mBluetoothAdapter = null;
public synchronized boolean startBTGrant()
{
if (!mBluetoothAdapter.isEnabled()) {
Intent enableIntent = new
Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
//startActivityForResult(enableIntent, REQUEST_ENABLE_BT);
startActivity(enableIntent);
}
return true;
}
}
--------this is my test program source------------
import android.app.Activity;
import android.os.Bundle;
import tst.jar.android.startBTActivity;
public class TstJarStartActiviyActivity extends Activity {
startBTActivity haha = new startBTActivity();
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
haha.startBTGrant();
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en