How get getTime and battery level In my graph?

124 views Asked by At

I'm working to create a chart of battery usage.. I'm using GraphViews library and i'm studing how it works. Right now in the original example code there is this part:

exampleSeries1.resetData(new GraphViewData[] {
        new GraphViewData(0, getRandom())
        , new GraphViewData(2, getRandom())
        , new GraphViewData(2.5, getRandom()) // another frequency
        , new GraphViewData(3, getRandom())
        , new GraphViewData(4, getRandom())
        , new GraphViewData(5, getRandom())

What i need instead is something like:

exampleSeries1.resetData(new GraphViewData[] {
              new GraphViewData(getTime(), getLevel())
    ,         new GraphViewData(getTime(), getLevel())
            , new GraphViewData(getTime(), getLevel()) // another frequency
            , new GraphViewData(getTime(), getLevel())
            , new GraphViewData(getTime(), getLevel())
            , new GraphViewData(getTime(), getLevel())

Because i need the battery level and the time(current time) and the result will be something like:

GraphViewData((new GraphViewData[] {
              new GraphViewData(8:00, 80%)
    ,         new GraphViewData(8:01, 80%)
            , new GraphViewData(8:02, 79%) // another frequency
            , new GraphViewData(8:03, 78%)
            , new GraphViewData(8:04, 78%)
            , new GraphViewData(8:05, 77%)

How can i do it? How can i find getTime() and getLevel()? Is it the right way?Thanks

0

There are 0 answers