new Thread(new Runnable() {
@Override
public void run() {
while (ct<1) {
try {
Thread.sleep(1000);
ct++;
} catch (InterruptedException e) {
e.printStackTrace();
}
count++;
Log.v("CountService", "Count is " + count);
//發送廣播
Intent intent=new Intent();
intent.putExtra("count", count);
intent.setAction("com.ljq.activity.CountService");
sendBroadcast(intent);
Log.v("CountService", "Count is " + count);
}
}
}).start();
Intent intent=new Intent();
intent.putExtra("count", count);
intent.setAction("com.ljq.activity.CountService");
sendBroadcast(intent);//這樣就會失敗
uj5u.com熱心網友回復:
你那不是失敗吧,是發的count一直是0吧轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/94201.html
標籤:Android
下一篇:八種經典排序演算法總結
