這是它運行在模擬器的代碼,但它沒有給出實時值我想開發一個實時圖形應用程序,但它不工作
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GraphView graph1 = (GraphView)findViewById(R.id.main_graph1);
Series = new LineGraphSeries<DataPoint>();
graph1.addSeries(Series);
在這裏,我去模擬與線程實時該附加數據:
protected void onResume(){
super.onResume();
new Thread(new Runnable() {
public void run() {
for(int i = 0; i<100; i++);
runOnUiThread(new Runnable() {
public void run() {
addEntry();
}
});
try {
Thread.sleep(600);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
}
我覺得這好像是錯了,請幫忙
你忘了叫'start'和';'爲 –
後,我沒有得到它。你能澄清你說的話嗎? – Hamid7497