WEB开发网
开发学院手机开发Android 开发 Android 进程间服务通信 阅读

Android 进程间服务通信

 2010-04-12 03:39:00 来源:WEB开发网   
核心提示:DataTimeService中的调用sendBroadcast(broadcast)发送的广播消息;*/registerReceiver(receiver, new IntentFilter(DataTimeServiceImpl.BROADCAST_ACTION));}@Overridepublic void on

DataTimeService中的调用sendBroadcast(broadcast)发送的广播消息;

*/

registerReceiver(receiver, new IntentFilter(

DataTimeServiceImpl.BROADCAST_ACTION));

}

@Override

public void onPause() {

super.onPause();

unregisterReceiver(receiver);

}

@Override

public void onDestroy() {

super.onDestroy();

unbindService(svcConn);

}

private void updateForecast() {

try {

String page = service.getForecastPage();

if (page != null) {

browser.loadDataWithBaseURL(null, page, "text/html", "UTF-8",

null);

browser.postDelayed(new Runnable() {

public void run() {

updateForecast();

}

}, 1000);

}

} catch (final Throwable t) {

svcConn.onServiceDisconnected(null);

}

}

//接收者实例

private BroadcastReceiver receiver = new BroadcastReceiver() {

public void onReceive(Context context, Intent intent) {

runOnUiThread(new Runnable() {

public void run() {

updateForecast();

}

});

}

};

}

上一页  1 2 3 4 

Tags:Android 进程 服务

编辑录入:coldstar [复制链接] [打 印]
赞助商链接