I\'m trying to display information got from wifi scan with broadcast receiver ,into a bar chart using achartengine. Well i want to have a real time chart ,every time i receive d
Well i resolved this problem ,to have a eal time chart (bar chart ) ,i have to change tho my onReceive method like bellow.I hope it will help someone.
public void onReceive(Context context, Intent intent) {
WifiManager wifiMan=(WifiManager)WifiChartsRealTime.this.getSystemService(Context.WIFI_SERVICE);
wifiMan.startScan();
if(intent.getAction().equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)){
results = wifi.getScanResults();
length=results.size();
Log.i("length1",length +"");
XYMultipleSeriesRenderer renderer = getTruitonBarRenderer(results.size());
myChartSettings(renderer);
layout = (LinearLayout) findViewById(R.id.chart);
if (mChartView != null) {
layout.removeView(mChartView);
}
mChartView = ChartFactory.getBarChartView(WifiChartsRealTime.this, getTruitonBarDataset( results), renderer, Type.STACKED);
layout.addView(mChartView, 0, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}
}`