OK guys i actually solved the error, finally. thanks for all your help. it was actually basically what you guys said about private/ public, and the graph elements had to be declared and called in a static way. so i just ended up leaving most of the code as-is, changed some declarations to add STATIC, and now the service does indeed populate the graph and collect the data in the background.
now the next step is doing it proper, make sure it doesnt consume CPU, and make it all cleaner. thanks guys! On Jan 19, 10:29 pm, Roger Podacter <[email protected]> wrote: > well i tried switching my activity call to private and a few other > minor edits, but still the same error. since i'm still learning, in > the spirit of what i'm "trying" to do with this activity call, could > someone perhaps guide me as to if i am attempting it correctly or > not? meaning if let's say i did want to call on the function of an > activity from another activity (or service), is it correct to do: > > private RegistersActivity mDisplay; > mDisplay = new RegistersActivity(); > > mDisplay.populateGraph(); > > is that even correct in the spirit of what i am shooting for? in the > mean time i'm going to attempt moving the data collection and graph > into the service. but in my head i can't figure out why or how to get > my original approach to work and feel like i'm missing something so > obvious. > > i made the RegistersActivity call as i did as one would if you were > calling on a function in a public class, and just thought to do the > same. but i'm beginner so its likely very wrong. thanks for the help > everyone:). > > On Jan 19, 9:25 am, Kostya Vasilyev <[email protected]> wrote: > > > > > > > > > 19.01.2011 20:15, Roger Podacter пишет:> I thought that because i was > > referencing the activity that it had to > > > be public, but i am still learning so i can try it as private. I just > > > thought that was the way to call on activity funtions, not necessarily > > > making them public, but in that manner nonetheless. > > > You don't directly instantiate activity classes - Android does it for you. > > > For data sharing between an activity and a service, use one of the > > several mechanisms available for that (a Java singleton is probably the > > easiest). > > > Oh, and AsyncTask doesn't stop automatically when onPause is called. > > Still, if you need some code running when there is no Activity on the > > screen, use a Service, that's specifically what they are for. > > > -- > > Kostya Vasilyev -- WiFi Manager + pretty widget > > --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

