主题:
Runnable r=new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
try{
System.out.println("successsssss");
wait(3000);
}catch(Exception ae)
{
ae.printStackTrace();
}
}
};
onReceive方法调用
TelephonyManager t=(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
int x=t.getCallState();
System.out.println(x);
String aa=intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
if(x==1)
{
r.run();
Intent i=new Intent(context.getApplicationContext(),Main.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtra("aa", aa);
context.startActivity(i);
}