我在stackoverflow中试过同样的问题,但都没有工作。有人请帮助我。 这是我的代码如何从线程调用另一个活动?
new Thread(new Runnable() {
public void run() {
try{
CallSoap cs;
cs=new CallSoap();
// String resp=cs.Call();
String resp= cs.Call();
ActivateDecive.rslt=resp;
}catch(Exception ex)
{ActivateDecive.rslt=ex.toString();}
if(ActivateDecive.rslt=="0"||ActivateDecive.rslt.equals("0"))
{
//Toast.makeText(getBaseContext(), "Device is not in active state..Please contact admin",Toast.LENGTH_LONG).show();
ActivationText.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
ActivationText.setText("Device is not in active state..Please contact admin");
}
});
}
else
{
Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
ActivationText.setText("Device is Active");
Intent i=new Intent(ActivateDecive.this,FormSelectionACT.class);
startActivity(i);
}
}, 2000);
}
}
}).start();
活动是不是对正在添加上面只包含布局显示...
任何的logcat你能说明什么?你还看过runOnUiThread,看看它是否适用于你? –
谢谢你回答..我尝试过...但仍然没有工作....有没有在logcat reeor。 – Abhi