I want to display Battery Level in dynamic graph using android plot. Static graph is working fine whenever am dealing with DB [fetching the data from DB and displaying in graph]. But for real time dynamic graph am facing issues i.e. Using Broadcast receiver am able to get the battery level changes, but same time I want to update/refresh the existing graph which is displaying to the user without recreating the activity. For updating the graph am using the below code
if (plot != null) {
plot.addListener(new PlotListener() {
@Override
public void onBeforeDraw(
@SuppressWarnings("rawtypes") Plot arg0, Canvas arg1) {
}
@Override
public void onAfterDraw(
@SuppressWarnings("rawtypes") Plot arg0, Canvas arg1) {
plot.clear();
plot.redraw();
}
});
}
Can anybody please help me how to resolve this issue or some example to deal with this issue.