Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
LinkBack Thread Tools
Old November 8th, 2012, 03:24 PM   #1 (permalink)
Junior Member
Thread Author (OP)
Valten1992's Avatar
Join Date: Feb 2012
Location: Ireland
Posts: 43
Device(s): Samsung Galaxy mini
Carrier: Not Provided

Thanks: 6
Thanked 3 Times in 3 Posts
Default Refreshing my static chart in my Activity?

I need to have a chart in my Android activity to pass data into as my app runs and the chart will update accordingly.

For this I am using Graphview, a static Graph that is entirely client side. When the activity loads the Graph shall be blank but will invalidate and redraw itself when data passes into it on a timer delay. At the moment I just want to get the view refresh going so the Graph redraws itself with the new data passed in, but no luck so far. I'm kinda rusty with Android after being away for a few months so it may be something obvious:

Timer tim = new Timer();

verlabels = new String[] {"here","there"};
        horlabels = new String[] {"here","there"};
        graphView = new GraphView(this, fvalues, description,horlabels, verlabels, GraphView.LINE);

tim.scheduleAtFixedRate(new TimerTask() {
            public void run() {
                try {
                    float f = (float) 2.0;
                    verlabels = new String[] { };
                    horlabels = new String[] { };
                    fvalues = new float[values.size()];
                    for(int j = 0; j<values.size(); j++) {
                        fvalues[j] = values.get(j);
                    Log.e("here", fvalues.length+"");
                } catch (Exception e) {
                    Log.e("error", "error");
                runOnUiThread(new Runnable() {
                    public void run() {
                        graphView = new GraphView(context, fvalues, description+" values",horlabels, verlabels, GraphView.LINE);
        }, 0, 5000);

Valten1992 is offline  
Reply With Quote
sponsored links
android, chart, timer

Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

All times are GMT -5. The time now is 05:28 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.