Hello Paul,

You're right. As you said, I traced RemoteViews.java file and found
that it maintains mActions arraylist to fill with actions to be
updated. Other suggestions are also appreciated. I learned much! Thank
you all. :)

NightGospel

On 7月22日, 上午5時05分, Paul Turchenko <[email protected]> wrote:
> I'm 99% sure that the problem is that you don't create RemoteViews
> every time (reusing old instance). This way mActions arraylist of
> RemoteView will get filled up with a bunch of actions and they all
> have to be dispatched by "acore" process.
>
> I would offer 2 workarounds:
> 1. Create NEW instance of RemoteView each time you're about to update
> your app widget
> OR
> 2. Use reflection to clear mActions field of RemoteViews and then
> you're fine to reuse old instance (just make sure to gracefully handle
> reflection exceptions in case you're on different firmware and there's
> no mActions member)
>
> IMO, the best thing to do is attempt to clear mActions and only if it
> fails, create a new instance.
>
> On Jul 21, 9:33 pm, Kostya Vasilyev <[email protected]> wrote:
>
>
>
> > Hi,
>
> > This is what I would do (although I am no Brian Boitano). Make widget
> > update code (that builds RemoteViews) really, really simple - like
> > setting one text view to an increasing number. Then gradually add code
> > back until you find the culprit.
>
> > -- Kostya
>
> > 21.07.2010 20:07, NightGospel пишет:
>
> > > Hello,
>
> > > ah, I'm not sure actually, but I tested it in emulator and my phone
> > > (X10). They both have such a problem. Emulator has nothing but my
> > > widget in home screen, but it still occurs.
> > > I'm not very learned in Android, but if you have any constructive
> > > suggestions, I'll appreciate it. :)
>
> > > NightGospel
>
> > > On Jul 21, 11:50 pm, DanH<[email protected]>  wrote:
>
> > >> Stupid question:  Are you sure you're just updating the widget and not
> > >> stacking one widget on another on another...?
>
> > >> On Jul 21, 4:32 am, NightGospel<[email protected]>  wrote:
>
> > >>> Hi all,
>
> > >>> I wrote one widget that updates per 5-seconds and I found that if it's
> > >>> run for a period of time, com.android.acore will occupy almost 100%
> > >>> cpu. Could somebody give me suggestions or help?
> > >>> Thanks in advance.
>
> > >>> NightGospel
>
> > --
> > Kostya Vasilev -- 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

Reply via email to