Reputation: 336
When the bluetooth connection turns on, I want to start a Therad which is checking for the available devices. When starting this Thread, I want to start an other activity. I created a public method with an intend to start the activity and now I want to call it from my Thread, but it isn't visable.
public Thread cConnectBT = new Thread();
public void vBT_popup_start()
{
Handler hBT_popup_start = new Handler(Looper.getMainLooper());
hBT_popup_start.post(new Runnable() {
@Override
public void run() {
Intent tent_BT_popup_Start = new Intent (MainActivity.this, cBT_popup.class);
startActivity(tent_BT_popup_Start);
}
});
}
´´´
#Thread Content
´´´
public class cConnectBT implements Runnable {
@Override
public void run() {
vBT_popup_start();
}
}
}
´´´
vBT_popup_start();
is not visable, but why? how to fix that?
Upvotes: 1
Views: 32