这是我的服务类,它根据时间i
增加值......i
public class BackService extends Service {
int i=0;
@Override
public IBinder onBind(Intent arg0) {
return null;
}
@Override
public void onCreate() {
pollForUpdates();
super.onCreate();
}
@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
}
private void pollForUpdates() {
Timer timer=new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
Log.v("Service class called", "service class called "+i);
getRunningApps();
i++;
}
},0,1000);
}
private void getRunningApps()
{
}
@Override
public void onDestroy() {
super.onDestroy();
}
}
我想将i值附加到TextView
. 即TextView
值是根据值动态变化的i
......
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
startService(new Intent(this, BackService.class));
TextView tx=(TextView)findViewById(R.id.textView1);
}}
如何将i
值附加到tx
...
先感谢您..