[android-developers] Does Android have a LinkButton. Basically like text but you click on it?

2011-02-19 Thread AndroidDevTime
Does Android have a link button?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Can Main Activity be conditionally shown based on app launch method?

2011-02-13 Thread AndroidDevTime
Can an application detect the manner it is being launched.
Specifically if it is a user launching from application list or on
boot.  I want the Main Activity to show when the user launches the
application, but not when the application is launched on boot.

Thanks,
Steve

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Android Application without a Main Activity?

2011-02-13 Thread AndroidDevTime
Well the exact behavior I want is if the application is auto started
on boot then no activity will show, until via widget user makes such a
request.  However, I also want to allow the user to launch the
application via the application list and in that case I want an
activity to show.  If the device is powered on/off then it will come
back on without the activity.  So I don't really want to take the main
activity out in the case of a user launch.  Is there anyway in the
application to detect the application launch method and if it is not a
user application driven lauch avoid showing the main activity.

On Feb 13, 4:03 pm, Kostya Vasilyev  wrote:
> You don't have to have the main activity in your application, or any
> activities at all. Check the manifest and remove the launcher-specific
> intent filter from your main activity if you don't want it to show up in the
> application list.
>
> However, my personal observation is that doing this can cause user confusion
> and a bunch of 1-star "duznt opin" type comments in Market.
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
> 14.02.2011 2:40 пользователь "AndroidDevTime" 
> написал:
>
> > Is it possible to have an Android application that runs without a Main
> > Activity? I have mostly Widget<-->Service communication and I really
> > don't want a Main Activity to show most of the time. But anyway my
> > question is can this be done? Does an application have to have a Main
> > Activity? Can it start and run invisibly or does it always have to
> > have screen visible when its running?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] When to use an IntentService vs. Service

2011-02-13 Thread AndroidDevTime
Its clear that for long running work IntentService is very cool.  But
are there other reasons to use Intent service? If you have no long
running work does it still make sense to use it?  When do you not use
IntentService  is another way of asking this question.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Android Application without a Main Activity?

2011-02-13 Thread AndroidDevTime
Is it possible to have an Android application that runs without a Main
Activity?  I have mostly Widget<-->Service communication and I really
don't want a Main Activity to show most of the time.  But anyway my
question is can this be done?  Does an application have to have a Main
Activity? Can it start and run invisibly or does it always have to
have screen visible when its running?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] What does Android do when you click on a widget whose application is not running?

2011-02-13 Thread AndroidDevTime
If you add a widget to the home screen that is part of an application
that does not start on boot, and then you power on/off the device,
and  click on the widget does Android restart the widget's
application?  Right now my widget does nothing when clicked unless
added when my application is already running.  I would like to
understand if android attempts to start the application that a widget
is part of when you click on the widget and its application is not
running?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] ListView Dyamically selected layout based on Item type in row.

2011-02-12 Thread AndroidDevTime
Could some explain in detail how it is possible to have a ListView
where each item in the list is rendered by its type and has different
layout.


So to clarify if i have ten rows they will all have the same layout if
they are each the same type of record like non-fiction book.

If have of the books in the list are audio books I will have an audio
type layout just for displaying that type of book.  How to dynamically
assign row layout to item in a row based on its type, type field or
some other criterial.

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Logcat Filter for two or tags in Eclipse?

2011-02-12 Thread AndroidDevTime
Clicked on create filter could not figure out from docs how to create
a filter for say two or more tags. If I have two tags
com.test.TestClassA and com.test.TestClassB how do I create a filter
that shows log for both of these classes? I saw how you can start ADB
for only certain tags, but how can this be done in eclipse? Please
provide details thanks. What exactly do I need to enter on the tag
line when creating a new filter in eclipse?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] What does/does not belong in WidgetProvider

2011-02-12 Thread AndroidDevTime
Widget Provider is a specialized BroadcastReceiver.

Assuming there exists an Application, 1-n android service,1-k
activities, and potentially additional 0-n broadcast receivers that
are not widgets, I would like to verify what belongs and does not
belong logically inside the broadcast receiver. Here are some items ..

And assuming that generally what gets launched is the widget first.

Please comment on any or all of the items as to whether you think they
belong inside or outside the WidgetProvider and why.  Pass over any
that you are not interested in.  Thanks.

1) If the Application needs to always listen for certain events
whether they show up in the widget or not where should this go? In the
Widget? If not what would keep the broadcast receiver available to
listen to the events  for duration of the the application?

2) Should the widget issue notification? or request a service to issue
them? ie should the notification logic reside in the widget itself or
in the service.

3) Should the widget issue broadcasts or ask a service to do this?

4) Should the widget ever access any system services like like
Notification Manager, PowerManager etc Why, Why not?

5) Should the widget keep any of its own state? If it should not keep
state how can it change what it displays? Like a different text or
icon?

6) Should the widget start off activities or let a service handle
this?

7) is it ok to user the context passed to update and receiver or
should one use ctx.getApplicationContext() to do things like
context.startService? ( Perhaps the one passed in is the application
context ? )

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] What is iconLevel on notification?

2011-02-11 Thread AndroidDevTime
What is iconLevel on Notification?  I've read the doc.
http://developer.android.com/reference/android/app/Notification.html#iconLevel.
It just says public int iconLevel   If the icon in the status bar is
to have more than one level, you can set this.  I might want to do
this if I knew what it means. What does this mean, any example?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Intent Flags ignored coming from an widget?

2011-02-09 Thread AndroidDevTime
nonesense.  These are basic questions and people should respond with
what they know.

On Feb 9, 4:00 pm, TreKing  wrote:
> On Wed, Feb 9, 2011 at 5:57 PM, Dirk Vranckaert 
> wrote:
>
> > Anyone? Can't figure out why it isnt working... :s
>
> You should wait more than 4 hours before bumping your posts ...
>
> -
> TreKing  - Chicago
> transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Intent Flags ignored coming from an widget?

2011-02-09 Thread AndroidDevTime
Well you could look at the lifecycle methods on a widget.  These
include onEnable, onUpdate, onReceive, onDelete, and onDisable.  You
might want to take a look at the values in some of these methods.
Perhaps you want to close something out here.

On Feb 9, 3:57 pm, Dirk Vranckaert  wrote:
> Anyone? Can't figure out why it isnt working... :s
>
> On Feb 9, 8:19 pm, Dirk Vranckaert  wrote:
>
> > All,
>
> > For the app i'm currently writing I  needs some help.
>
> > My activity structure when launching the app with the launcher:
> > HomeActivity => ListActivity
> > On the listActivity I've put a home button with a clear top flag
> > (intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);)
> > So pressing the home button makes me return to my home activity, on my
> > home activity pressing the back button results in the application
> > closing. That exactly what I want.
>
> > However when you click a button on my widget you directly go to the
> > ListActivity. Then you click the home button and the flag on the
> > intent is set correctly but the stack isn't cleared at all! So when
> > arriving at my home activity I press the back button and instead of
> > quitting the application it goes back to my ListActivity.
>
> > Any ideas how I can resolve this one?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Problem Loading Widget

2011-02-09 Thread AndroidDevTime
guys, I 'm dealing with this right now.  Am I the only one on this
board that has encountered this?

On Feb 9, 2:52 pm, AndroidDevTime  wrote:
> I am seeing Problem Loading Widget on the home screen.  Several things
> seem odd about this.
> First there is no mention of which widget it tried to load. Never the
> less the home screen is covered with Problem Loading Widget.  Did the
> system not know the name of the widget it was trying to load even
> though you can clearly see it in the list of widgets.  Secondly, I was
> debugging and did not see error in the LogCat file during this nor in
> the console.   Where does one look for the CAUSE?  thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Problem Loading Widget

2011-02-09 Thread AndroidDevTime
I am seeing Problem Loading Widget on the home screen.  Several things
seem odd about this.
First there is no mention of which widget it tried to load. Never the
less the home screen is covered with Problem Loading Widget.  Did the
system not know the name of the widget it was trying to load even
though you can clearly see it in the list of widgets.  Secondly, I was
debugging and did not see error in the LogCat file during this nor in
the console.   Where does one look for the CAUSE?  thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Clickable Status Bar Icon

2011-02-07 Thread AndroidDevTime
Well I just want to see if it can be done somehow, I don't really want
to always have to sort thru the notifications below and pick it out.
I was just wondering if you really need to goto the step of going in
the notification drawer to fire off the pending intent. Is there any
way to detect a click on the icon and issue it at that point?

On Feb 7, 1:19 pm, Kostya Vasilyev  wrote:
> Not sure what you mean by "clickable" - status bar notifications are
> "pull downable".
>
> Any reason for not just using NotificationManager.notity() ?
>
> -- Kostya
>
> 08.02.2011 0:02, AndroidDevTime пишет:
>
> > Would appreciate some pointers on how to create clickable status bar
> > Icon notification that will remain on status bar for the duration that
> > widget appears on home screen.
>
> --
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Clickable Status Bar Icon

2011-02-07 Thread AndroidDevTime
Would appreciate some pointers on how to create clickable status bar
Icon notification that will remain on status bar for the duration that
widget appears on home screen.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] ADB Cannot Find Samsung Captivate

2011-02-07 Thread AndroidDevTime
adb devices  -> Nothing

I have tried installing kies, setting usb to Kies, to Mass storage etc
nothing seems to work.

It is not at all clear what happens when you type ADB Devices?

i tried downloading device drivers from samsung as recommended, and
some of the drivers seemed to install like modem,

Many have said use Kies.  Not sure what Kies has to do with ADB which
is a debug bridge, but I have also tried installing the drivers this
way.

Help would be greatly appreciated in connecting ADB to Samsung
Captivate.

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Can registerReciver(null,Intent) provide latest broadcast value

2011-02-05 Thread AndroidDevTime
ok,  so I can use sendStickyBroadcast().  Just wondered how much I
know about the delivery of the latest broadcast that I get back this
way.  Is there any way to know if it was processed?  or do I need to
send a confirmation broadcast?  What do I know for sure about the
broadcast that i get back from registerReceiver(null, Intent).  Was
this the last Intent that was sucessfully delivered to all broadcast
receivers, or was it the last one that where sendStickBroadcast was
called?

On Feb 5, 7:27 pm, Dianne Hackborn  wrote:
> It only works for a broadcast that is sent with sendStickyBroadcast().
>
> On Sat, Feb 5, 2011 at 7:08 PM, AndroidDevTime 
> wrote:
>
>
>
> > I have seen registerReceiver(null, Intent) can be used to get last
> > System level broadcast values such as battery level.  Does this also
> > work for custom application Intents?   Lets say I have an application
> > Intent called SetOrder and I broadcast this Intent.  Using
> > registerReceiver(null, SetOrder) can I get last SetOrder broadcast?
> > How does one know if it was really the last one, it it was received
> > and processed?  How can you confirm that it was really handed
> > somewhere by a broadcast receiver?  Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Can registerReciver(null,Intent) provide latest broadcast value

2011-02-05 Thread AndroidDevTime
I have seen registerReceiver(null, Intent) can be used to get last
System level broadcast values such as battery level.  Does this also
work for custom application Intents?   Lets say I have an application
Intent called SetOrder and I broadcast this Intent.  Using
registerReceiver(null, SetOrder) can I get last SetOrder broadcast?
How does one know if it was really the last one, it it was received
and processed?  How can you confirm that it was really handed
somewhere by a broadcast receiver?  Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Application Shutdown

2011-02-05 Thread AndroidDevTime
Also what is the earliest point/hook in the code where I can begin to
store in SharedPreferences?  Can I access in Application.create()?

On Feb 5, 6:03 pm, Hari Edo  wrote:
> Save data when the user's no longer interacting with it.  And even
> when they are.  As you point out, there are no guaranteed callbacks.
> The system assumes that if you're idle, you can be killed.
>
> On Feb 5, 8:57 pm, AndroidDevTime  wrote:
>
> > I would like to handle application shutdown gracefully.  Whether the
> > user ends the application or the system decides the kill the process,
> > I want to know the best place to put hooks in the application to
> > detect and handle this.  I know that application level components have
> > lifecycle methods the conform to system events, but I really want the
> > best practice on this at the application level.  This is after all an
> > application level shutdown, so i want an app level(not just component
> > level) handling.
>
> > Not really sure where to put the global app shutdown code:
>
> > In Application.terminate() ?:  Not really guaranteed to get called.
>
> > In a service?:  I have n services.
>
> > In an activity? : ok but just for the view data.
>
> > The only thing I can think is to have a service dedicated to this
> > shutdown activity manage the application level data, but I don't
> > really want to start a service at a time when my app is getting
> > shutdown perhaps for resource consumption.
>
> > Perhaps one could  just let each component deal with it, however I
> > have shared data/state (that is not a preference) across the
> > components, and I see no reason why one of those components other than
> > the application (subclass) should be dealing with application global
> > data management.
>
> > Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Application Shutdown

2011-02-05 Thread AndroidDevTime
Ok. In the particular case of a global (application level) shared
static variable accessed via a singleton, that I want to be able to
recover. Should I have this store this every time it gets updated in a
single method call.   for example public synchronized
Singleton{  // derived from Application or just global singleton.

updateSharedVariable(String val){
this.value=val;
// here update value in shared preferences
}
}



On Feb 5, 6:01 pm, Mark Murphy  wrote:
> On Sat, Feb 5, 2011 at 8:57 PM, AndroidDevTime  
> wrote:
> > I would like to handle application shutdown gracefully.
>
> There is no such concept as "application shutdown" in Android.
>
> > Whether the
> > user ends the application or the system decides the kill the process,
> > I want to know the best place to put hooks in the application to
> > detect and handle this.
>
> There are none. Design your app such that you don't care about
> "application shutdown", whatever you consider that to be.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training in Atlanta:http://bignerdranch.com/classes/android

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Application Shutdown

2011-02-05 Thread AndroidDevTime
I would like to handle application shutdown gracefully.  Whether the
user ends the application or the system decides the kill the process,
I want to know the best place to put hooks in the application to
detect and handle this.  I know that application level components have
lifecycle methods the conform to system events, but I really want the
best practice on this at the application level.  This is after all an
application level shutdown, so i want an app level(not just component
level) handling.

Not really sure where to put the global app shutdown code:

In Application.terminate() ?:  Not really guaranteed to get called.

In a service?:  I have n services.

In an activity? : ok but just for the view data.

The only thing I can think is to have a service dedicated to this
shutdown activity manage the application level data, but I don't
really want to start a service at a time when my app is getting
shutdown perhaps for resource consumption.

Perhaps one could  just let each component deal with it, however I
have shared data/state (that is not a preference) across the
components, and I see no reason why one of those components other than
the application (subclass) should be dealing with application global
data management.

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Where to put a broadcast receiver for a widget

2011-02-05 Thread AndroidDevTime




On Feb 5, 2:33 pm, Mark Murphy  wrote:
> On Sat, Feb 5, 2011 at 5:19 PM, AndroidDevTime  
> wrote:
> > Where
> > should the application state for a Widget be maintained?  In the
> > Application subclass or in the Widget itself.
>

true, but what I was thinking is an app widget that is reflecting the
application's state.

> Neither. Ideally, an app widget has no "state" outside of data you
> maintain for your application as a whole, which hopefully is in a
> database or some other persistent store.
>
> The "Widget itself" has no meaning. If you mean AppWidgetProvider, it
> lives for milliseconds. If you mean the RemoteViews, they are
> read-only, and so you cannot store "state" in them to be read out
> later.
>
> The Application object will live only as long as your process lives,
> which could be for the same number of milliseconds that the
> AppWidgetProvider instance lives.
>
Alright, but what I really want is the app widget reflects the state
of the app.  It makes no sense for the Widget to store the app state
off for the app to me.  Perhaps the service, but then again it is
really the state of the app, not the state of the widget (although the
widget reflects it), nor is it the state of the service.  So the point
is each component needs to reference the application level status
state, (even if it just needs it for few milliseconds), and yes it
needs to be stored, but it also needs to be kept in a synced/singleton
manner at all times.

> Hence, anything related to an app widget that you want to live for
> more than an eye-blink should be in a persistent store or be
> re-retrievable from the OS. If you want to cache stuff in an
> Application object or static data members, in the off chance your
> process sticks around long enough to be useful, that's cool, just
> watch out for garbage collection issues.
>
> > I have decided to put
> > the state of the App Widget in an app subclass but not sure if this is
> > right, given I can't very well initialize everyting in the
> > Application.onCreate() method.
>
registerReceiver(null, Intent) would be under 5 seconds for sure?  I
have not seen any guarantees related to android functions.

> Anything slow enough to cause a problem probably should be processed
> by an IntentService, or possibly an AsyncTask kicked off by the
> Application (I have never tried an Application-spawned AsyncTask).
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android 2.3 Programming Books:http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to Keep Widget Application Status/State

2011-02-05 Thread AndroidDevTime
What is the advantage of using lazy initialize Java Singleton vs.
using subclass of application as the Singleton itself?  Since we
already have getApplication() available in most places 

On Feb 5, 3:03 pm, Kostya Vasilyev  wrote:
> You can use a lazy initialize Java Singleton, where you pass in a context in
> case one is needed to recreate state.
>
> If you need to keep a context reference, make sure to call
> getApplicationContext and keep that instead, so you don't run into object
> lifetime issues and leak memory (in case that Context is an Activity or a
> Service, and it goes away before the process does).
>
> The stuff about not doing much in the application's onCreate I take to be
> more of an architectural suggestion than a real framework limitation, you
> can probably do as much there as in any other callback (e.g activity
> onCreate), subject to ANR timeouts.
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
> 06.02.2011 1:38 пользователь "AndroidDevTime" 
> написал:
>
> > I have an Widget Application that also has Activities, and a heavily
> > used Service full of functions. I would like to keep a global status
> > for the application. This is app/widget specific state like say
> > STARTED, LEVEL1, LEVEL2 etc, so since the status is referenced in the
> > widget, the service, and activities I thought a static variable in an
> > Application Subclass might be good. So my question is twofold.
>
> > 1) Where should I keep such a state/status variable as a syncronized
> > static variable in an application subclass?
>
> > And
>
> > 2) Its first initial value depends on reading some values by calling
> > registerReceiver(null, intent) passing null for the receiver in order
> > to obtain some system values. Where should I do this initialization.
> > The Application.onCreate() docs indicate that not much should happen
> > in this method. I am thinking in the Widget.update method can call
> > getApplication and perform the registerReceiver operation and then
> > update the static variable in the Applicaiton subclass. Is this the
> > right place to initialize the application state?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to Keep Widget Application Status/State

2011-02-05 Thread AndroidDevTime
What is the advantage of using lazy initialize Java Singleton vs.
using subclass of application as the Singleton itself?  Since we
already have getApplication() available in most places 

On Feb 5, 3:03 pm, Kostya Vasilyev  wrote:
> You can use a lazy initialize Java Singleton, where you pass in a context in
> case one is needed to recreate state.
>
> If you need to keep a context reference, make sure to call
> getApplicationContext and keep that instead, so you don't run into object
> lifetime issues and leak memory (in case that Context is an Activity or a
> Service, and it goes away before the process does).
>
> The stuff about not doing much in the application's onCreate I take to be
> more of an architectural suggestion than a real framework limitation, you
> can probably do as much there as in any other callback (e.g activity
> onCreate), subject to ANR timeouts.
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
> 06.02.2011 1:38 пользователь "AndroidDevTime" 
> написал:
>
> > I have an Widget Application that also has Activities, and a heavily
> > used Service full of functions. I would like to keep a global status
> > for the application. This is app/widget specific state like say
> > STARTED, LEVEL1, LEVEL2 etc, so since the status is referenced in the
> > widget, the service, and activities I thought a static variable in an
> > Application Subclass might be good. So my question is twofold.
>
> > 1) Where should I keep such a state/status variable as a syncronized
> > static variable in an application subclass?
>
> > And
>
> > 2) Its first initial value depends on reading some values by calling
> > registerReceiver(null, intent) passing null for the receiver in order
> > to obtain some system values. Where should I do this initialization.
> > The Application.onCreate() docs indicate that not much should happen
> > in this method. I am thinking in the Widget.update method can call
> > getApplication and perform the registerReceiver operation and then
> > update the static variable in the Applicaiton subclass. Is this the
> > right place to initialize the application state?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to Keep Widget Application Status/State

2011-02-05 Thread AndroidDevTime
What is the advantage of using lazy initialize Java Singleton vs.
using subclass of application as the Singleton itself?  Since we
already have getApplication() available in most places 

On Feb 5, 3:03 pm, Kostya Vasilyev  wrote:
> You can use a lazy initialize Java Singleton, where you pass in a context in
> case one is needed to recreate state.
>
> If you need to keep a context reference, make sure to call
> getApplicationContext and keep that instead, so you don't run into object
> lifetime issues and leak memory (in case that Context is an Activity or a
> Service, and it goes away before the process does).
>
> The stuff about not doing much in the application's onCreate I take to be
> more of an architectural suggestion than a real framework limitation, you
> can probably do as much there as in any other callback (e.g activity
> onCreate), subject to ANR timeouts.
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
> 06.02.2011 1:38 пользователь "AndroidDevTime" 
> написал:
>
> > I have an Widget Application that also has Activities, and a heavily
> > used Service full of functions. I would like to keep a global status
> > for the application. This is app/widget specific state like say
> > STARTED, LEVEL1, LEVEL2 etc, so since the status is referenced in the
> > widget, the service, and activities I thought a static variable in an
> > Application Subclass might be good. So my question is twofold.
>
> > 1) Where should I keep such a state/status variable as a syncronized
> > static variable in an application subclass?
>
> > And
>
> > 2) Its first initial value depends on reading some values by calling
> > registerReceiver(null, intent) passing null for the receiver in order
> > to obtain some system values. Where should I do this initialization.
> > The Application.onCreate() docs indicate that not much should happen
> > in this method. I am thinking in the Widget.update method can call
> > getApplication and perform the registerReceiver operation and then
> > update the static variable in the Applicaiton subclass. Is this the
> > right place to initialize the application state?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to Keep Widget Application Status/State

2011-02-05 Thread AndroidDevTime
What is the advantage of using lazy initialize Java Singleton vs.
using subclass of application as the Singleton itself?  Since we
already have getApplication() available in most places 

On Feb 5, 3:03 pm, Kostya Vasilyev  wrote:
> You can use a lazy initialize Java Singleton, where you pass in a context in
> case one is needed to recreate state.
>
> If you need to keep a context reference, make sure to call
> getApplicationContext and keep that instead, so you don't run into object
> lifetime issues and leak memory (in case that Context is an Activity or a
> Service, and it goes away before the process does).
>
> The stuff about not doing much in the application's onCreate I take to be
> more of an architectural suggestion than a real framework limitation, you
> can probably do as much there as in any other callback (e.g activity
> onCreate), subject to ANR timeouts.
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
> 06.02.2011 1:38 пользователь "AndroidDevTime" 
> написал:
>
> > I have an Widget Application that also has Activities, and a heavily
> > used Service full of functions. I would like to keep a global status
> > for the application. This is app/widget specific state like say
> > STARTED, LEVEL1, LEVEL2 etc, so since the status is referenced in the
> > widget, the service, and activities I thought a static variable in an
> > Application Subclass might be good. So my question is twofold.
>
> > 1) Where should I keep such a state/status variable as a syncronized
> > static variable in an application subclass?
>
> > And
>
> > 2) Its first initial value depends on reading some values by calling
> > registerReceiver(null, intent) passing null for the receiver in order
> > to obtain some system values. Where should I do this initialization.
> > The Application.onCreate() docs indicate that not much should happen
> > in this method. I am thinking in the Widget.update method can call
> > getApplication and perform the registerReceiver operation and then
> > update the static variable in the Applicaiton subclass. Is this the
> > right place to initialize the application state?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to Keep Widget Application Status/State

2011-02-05 Thread AndroidDevTime
What is the advantage of using lazy initialize Java Singleton vs.
using subclass of application as the Singleton itself?  Since we
already have getApplication() available in most places 

On Feb 5, 3:03 pm, Kostya Vasilyev  wrote:
> You can use a lazy initialize Java Singleton, where you pass in a context in
> case one is needed to recreate state.
>
> If you need to keep a context reference, make sure to call
> getApplicationContext and keep that instead, so you don't run into object
> lifetime issues and leak memory (in case that Context is an Activity or a
> Service, and it goes away before the process does).
>
> The stuff about not doing much in the application's onCreate I take to be
> more of an architectural suggestion than a real framework limitation, you
> can probably do as much there as in any other callback (e.g activity
> onCreate), subject to ANR timeouts.
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
> 06.02.2011 1:38 пользователь "AndroidDevTime" 
> написал:
>
> > I have an Widget Application that also has Activities, and a heavily
> > used Service full of functions. I would like to keep a global status
> > for the application. This is app/widget specific state like say
> > STARTED, LEVEL1, LEVEL2 etc, so since the status is referenced in the
> > widget, the service, and activities I thought a static variable in an
> > Application Subclass might be good. So my question is twofold.
>
> > 1) Where should I keep such a state/status variable as a syncronized
> > static variable in an application subclass?
>
> > And
>
> > 2) Its first initial value depends on reading some values by calling
> > registerReceiver(null, intent) passing null for the receiver in order
> > to obtain some system values. Where should I do this initialization.
> > The Application.onCreate() docs indicate that not much should happen
> > in this method. I am thinking in the Widget.update method can call
> > getApplication and perform the registerReceiver operation and then
> > update the static variable in the Applicaiton subclass. Is this the
> > right place to initialize the application state?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to Keep Widget Application Status/State

2011-02-05 Thread AndroidDevTime
What is the advantage of using lazy initialize Java Singleton vs.
using subclass of application as the Singleton itself?  Since we
already have getApplication() available in most places 

On Feb 5, 3:03 pm, Kostya Vasilyev  wrote:
> You can use a lazy initialize Java Singleton, where you pass in a context in
> case one is needed to recreate state.
>
> If you need to keep a context reference, make sure to call
> getApplicationContext and keep that instead, so you don't run into object
> lifetime issues and leak memory (in case that Context is an Activity or a
> Service, and it goes away before the process does).
>
> The stuff about not doing much in the application's onCreate I take to be
> more of an architectural suggestion than a real framework limitation, you
> can probably do as much there as in any other callback (e.g activity
> onCreate), subject to ANR timeouts.
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
> 06.02.2011 1:38 пользователь "AndroidDevTime" 
> написал:
>
> > I have an Widget Application that also has Activities, and a heavily
> > used Service full of functions. I would like to keep a global status
> > for the application. This is app/widget specific state like say
> > STARTED, LEVEL1, LEVEL2 etc, so since the status is referenced in the
> > widget, the service, and activities I thought a static variable in an
> > Application Subclass might be good. So my question is twofold.
>
> > 1) Where should I keep such a state/status variable as a syncronized
> > static variable in an application subclass?
>
> > And
>
> > 2) Its first initial value depends on reading some values by calling
> > registerReceiver(null, intent) passing null for the receiver in order
> > to obtain some system values. Where should I do this initialization.
> > The Application.onCreate() docs indicate that not much should happen
> > in this method. I am thinking in the Widget.update method can call
> > getApplication and perform the registerReceiver operation and then
> > update the static variable in the Applicaiton subclass. Is this the
> > right place to initialize the application state?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to Keep Widget Application Status/State

2011-02-05 Thread AndroidDevTime
What is the advantage of using lazy initialize Java Singleton vs.
using subclass of application as the Singleton itself?  Since we
already have getApplication() available in most places 

On Feb 5, 3:03 pm, Kostya Vasilyev  wrote:
> You can use a lazy initialize Java Singleton, where you pass in a context in
> case one is needed to recreate state.
>
> If you need to keep a context reference, make sure to call
> getApplicationContext and keep that instead, so you don't run into object
> lifetime issues and leak memory (in case that Context is an Activity or a
> Service, and it goes away before the process does).
>
> The stuff about not doing much in the application's onCreate I take to be
> more of an architectural suggestion than a real framework limitation, you
> can probably do as much there as in any other callback (e.g activity
> onCreate), subject to ANR timeouts.
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
> 06.02.2011 1:38 пользователь "AndroidDevTime" 
> написал:
>
> > I have an Widget Application that also has Activities, and a heavily
> > used Service full of functions. I would like to keep a global status
> > for the application. This is app/widget specific state like say
> > STARTED, LEVEL1, LEVEL2 etc, so since the status is referenced in the
> > widget, the service, and activities I thought a static variable in an
> > Application Subclass might be good. So my question is twofold.
>
> > 1) Where should I keep such a state/status variable as a syncronized
> > static variable in an application subclass?
>
> > And
>
> > 2) Its first initial value depends on reading some values by calling
> > registerReceiver(null, intent) passing null for the receiver in order
> > to obtain some system values. Where should I do this initialization.
> > The Application.onCreate() docs indicate that not much should happen
> > in this method. I am thinking in the Widget.update method can call
> > getApplication and perform the registerReceiver operation and then
> > update the static variable in the Applicaiton subclass. Is this the
> > right place to initialize the application state?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to Keep Widget Application Status/State

2011-02-05 Thread AndroidDevTime


On Feb 5, 3:03 pm, Kostya Vasilyev  wrote:
> You can use a lazy initialize Java Singleton, where you pass in a context in
> case one is needed to recreate state.
>

   Are you referring to keeping a Context reference inside the
singleton?

> If you need to keep a context reference, make sure to call
> getApplicationContext and keep that instead, so you don't run into object
> lifetime issues and leak memory (in case that Context is an Activity or a
> Service, and it goes away before the process does).
>
> The stuff about not doing much in the application's onCreate I take to be
> more of an architectural suggestion than a real framework limitation, you
> can probably do as much there as in any other callback (e.g activity
> onCreate), subject to ANR timeouts.
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
> 06.02.2011 1:38 пользователь "AndroidDevTime" 
> написал:
>
> > I have an Widget Application that also has Activities, and a heavily
> > used Service full of functions. I would like to keep a global status
> > for the application. This is app/widget specific state like say
> > STARTED, LEVEL1, LEVEL2 etc, so since the status is referenced in the
> > widget, the service, and activities I thought a static variable in an
> > Application Subclass might be good. So my question is twofold.
>
> > 1) Where should I keep such a state/status variable as a syncronized
> > static variable in an application subclass?
>
> > And
>
> > 2) Its first initial value depends on reading some values by calling
> > registerReceiver(null, intent) passing null for the receiver in order
> > to obtain some system values. Where should I do this initialization.
> > The Application.onCreate() docs indicate that not much should happen
> > in this method. I am thinking in the Widget.update method can call
> > getApplication and perform the registerReceiver operation and then
> > update the static variable in the Applicaiton subclass. Is this the
> > right place to initialize the application state?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to Keep Widget Application Status/State

2011-02-05 Thread AndroidDevTime
Ok. Lets say that it goes into a static singleton, and say the status
is level2 and the application/widget gets shutdown.  I suppose I would
need to implement a saveState() method on the singleton, and detect
this shutdown somewhere so I could recover the correct state?   I
don't think there is any method on the Application that is guaranteed
to get called during such a shutdown.  There is terminate method but
this is not really called for sure.  The widget is long running, so
where would be the best place to save off the application status/state
during shutdown? or when process gets killed.

Thanks

On Feb 5, 3:03 pm, Kostya Vasilyev  wrote:
> You can use a lazy initialize Java Singleton, where you pass in a context in
> case one is needed to recreate state.
>
> If you need to keep a context reference, make sure to call
> getApplicationContext and keep that instead, so you don't run into object
> lifetime issues and leak memory (in case that Context is an Activity or a
> Service, and it goes away before the process does).
>
> The stuff about not doing much in the application's onCreate I take to be
> more of an architectural suggestion than a real framework limitation, you
> can probably do as much there as in any other callback (e.g activity
> onCreate), subject to ANR timeouts.
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
> 06.02.2011 1:38 пользователь "AndroidDevTime" 
> написал:
>
> > I have an Widget Application that also has Activities, and a heavily
> > used Service full of functions. I would like to keep a global status
> > for the application. This is app/widget specific state like say
> > STARTED, LEVEL1, LEVEL2 etc, so since the status is referenced in the
> > widget, the service, and activities I thought a static variable in an
> > Application Subclass might be good. So my question is twofold.
>
> > 1) Where should I keep such a state/status variable as a syncronized
> > static variable in an application subclass?
>
> > And
>
> > 2) Its first initial value depends on reading some values by calling
> > registerReceiver(null, intent) passing null for the receiver in order
> > to obtain some system values. Where should I do this initialization.
> > The Application.onCreate() docs indicate that not much should happen
> > in this method. I am thinking in the Widget.update method can call
> > getApplication and perform the registerReceiver operation and then
> > update the static variable in the Applicaiton subclass. Is this the
> > right place to initialize the application state?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] How to Keep Widget Application Status/State

2011-02-05 Thread AndroidDevTime
I have an Widget Application that also has Activities, and a heavily
used Service full of functions.  I would like to keep a global status
for the application.  This is app/widget specific state like say
STARTED, LEVEL1, LEVEL2 etc, so since the status is referenced in the
widget, the service, and activities I thought a static variable in an
Application Subclass might be good.  So my question is twofold.

1) Where should I keep such a state/status variable as a syncronized
static variable in an application subclass?

And

2) Its first initial value  depends on reading some values by calling
registerReceiver(null, intent) passing null for the receiver in order
to obtain some system values.  Where should I do this initialization.
The Application.onCreate() docs indicate that not much should happen
in this method. I am thinking in the Widget.update method can call
getApplication and perform the registerReceiver operation and then
update the static variable in the Applicaiton subclass.  Is this the
right place to initialize the application state?

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] How to Keep Widget Application Status/State

2011-02-05 Thread AndroidDevTime
I have an Widget Application that also has Activities, and a heavily
used Service full of functions.  I would like to keep a global status
for the application.  This is app/widget specific state like say
STARTED, LEVEL1, LEVEL2 etc, so since the status is referenced in the
widget, the service, and activities I thought a static variable in an
Application Subclass might be good.  So my question is twofold.

1) Where should I keep such a state/status variable as a syncronized
static variable in an application subclass?

And

2) Its first initial value  depends on reading some values by calling
registerReceiver(null, intent) passing null for the receiver in order
to obtain some system values.  Where should I do this initialization.
The Application.onCreate() docs indicate that not much should happen
in this method. I am thinking in the Widget.update method can call
getApplication and perform the registerReceiver operation and then
update the static variable in the Applicaiton subclass.  Is this the
right place to initialize the application state?

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Where to put a broadcast receiver for a widget

2011-02-05 Thread AndroidDevTime
If the widget initialization requires some calls to registerReceiver()
passing a null pointer to get the values where is the best place to be
doing this. In my case, I am maintaining "Application state" in an
Application subclass. In a sense my whole widget application has a
state.  The state depends on some values that I can only get by
calling registerReceiver() passing the null value.  The docs indicate
that not much processing should go on in the Application.onCreate()
method so I am not sure if this is the right place to do the
initialization.  On the other hand it seems like keeping Wdiget
Application State in the App subclass is the right place for it,. (I
also have services, and activities associated with the Widget).  Where
should the application state for a Widget be maintained?  In the
Application subclass or in the Widget itself.   I have decided to put
the state of the App Widget in an app subclass but not sure if this is
right, given I can't very well initialize everyting in the
Application.onCreate() method.

On Feb 4, 5:08 am, Mark Murphy  wrote:
> On Fri, Feb 4, 2011 at 1:13 AM, Jeffrey  wrote:
> > Okay, figured it out. I guess I can't have anything from the
> > AppWidgetProvider class activate a registerReceiver so I have to make
> > a service to do it. I don't keep it running, just launch it to update
> > everything then it dies.
>
> If the Context passed into your onReceive() method is named ctxt, use:
>
> ctxt.getApplicationContext().registerReceiver(null, myIntentFilter);
>
> Then, you won't need service and extra overhead of starting it up.
>
> I just remembered that I had a blog post on this:
>
> http://commonsware.com/blog/2010/09/12/real-use-getapplicationcontext...
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training in Atlanta:http://bignerdranch.com/classes/android

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Where to put a broadcast receiver for a widget

2011-02-03 Thread AndroidDevTime
what are the power battery performance implications of maintaining a
service? Will this drain the battery more to keep a service up and
running?  Especially if you bind to the service from the widget to
call service functions?

On Feb 3, 3:39 pm, Mark Murphy  wrote:
> 2011/2/3 Jeffrey :
>
> > Thank you, one last issue that I'm having, you said to get the battery
> > level to call registerReceiver with a null broadcast receiver, but
> > when I try the following code I get a nullpointerexception:
>
> > int rawlevel = registerReceiver(null,
> > batteryLevelFilter).getIntExtra("level", -1);
>
> > I'm not sure if thats right or not. When I was running a broadcast
> > receiver it grabbed the context and the code was as such:
>
> >  int rawlevel = intent.getIntExtra("level", -1);
>
> > which worked but since I no longer use the broadcast receiver to grab
> > the intent I can't seem to figure out how to get it into a manageable
> > variable.
>
> There are two possibilities:
>
> 1. Your batteryLevelFilter is incorrect
>
> 2. Your code is being called before an ACTION_BATTERY_CHANGED
> broadcast has been sent
>
> Since #2 is conceivable, depending on when you are setting up your
> alarms, be sure to handle a null response to registerReceiver().
>
> Also, I would use BatteryManager.EXTRA_LEVEL instead of "level".
> That's a change I need to make in one of my own examples, one of these
> days...
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training...At Your Office:http://commonsware.com/training

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Keeping Synced App State

2011-02-03 Thread AndroidDevTime
This is a question about domain specific state. It is not so much
about storage mechanisms like SQLite or Shared Preferences (although
they are no doubt part of the answer).  Perhaps an example will help.
Lets say I have an app with 4 states:  JUMPING, TUMBLING, FALLING,
CRASHING.   What I need to know is how each to store these states
where I can access them from a Widget, From an Activity, a Service etc
in a synced manner so that I always know what state the application is
in.  Of course store and resume is part of this, but I am really
talking about how to maintain the application state in synced manner
that is accessible anywhere in the application at any time, I have
some ideas, but what I am looking for is best practice here from those
who have done this.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Subclassing Android Application

2011-01-31 Thread AndroidDevTime
Are there any compatibility issues or disadvantages with subclassing
the Android application?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Service reference to System Managers

2011-01-31 Thread AndroidDevTime
ok.  Is it best to retrieve as needed during service execution and
remove reference or obtain on service create and maintain as
reference?  if so should it be static reference member variable?

On Jan 31, 8:14 pm, Dianne Hackborn  wrote:
> Generally it should be a member variable because these are retrieved and
> associated with the Service's context.
>
> On Mon, Jan 31, 2011 at 8:06 PM, AndroidDevTime 
> wrote:
>
> > Is it a good practice for a Service to maintain static reference to
> > System Manager? like Activity Manager, Power Manager? etc?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to Add Item Status Bar Dropdown Menu/List?

2011-01-31 Thread AndroidDevTime
while we are on the topic is there any better way to get a clickable
Icon on the status bar then using notifications?  Are there any layout
options that could allow custom rendering of below the status bar or
change of priority of notifications appearing below the status ba?

On Jan 31, 7:46 pm, AndroidDevTime  wrote:
> Well the documentation does show a way to add notifications to the
> status bar using NotificationMgr.   I wonder if Notifications are the
> only thing that can be added to the STATUS bar.  And if anything else
> can be added below the Status Bar besides the Notification
> dropdowns ?  In particular is there any way to have the item always
> appear at the top of this list?  Does this documentation make it clear
> how to maintain the Notification for the duration that the app is
> running. What if your app server goes down and resumes, what does its
> notifications look like then?
>
> On Jan 27, 9:02 am, TreKing  wrote:
>
> > On Wed, Jan 26, 2011 at 9:36 PM, AndroidDevTime 
> > wrote:
>
> > > I would like to place an item in the Status Bar Dropdown List.  How can
> > > this be done?
>
> > By reading the 
> > documentation:http://developer.android.com/guide/topics/ui/notifiers/notifications
>
> > -
> > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> > transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Should a service maintain a reference to a Broadcast Receiver

2011-01-31 Thread AndroidDevTime
Is it a bad practice to maintain a service level reference to a
BroadcastReceiver?  I do see there is a service level method
service.registerReceiver   Under what situations is it appropriate
to register the BroadcastReceiver with a service? To hold a static
reference to a broadcast receiver in a service?  Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Service reference to System Managers

2011-01-31 Thread AndroidDevTime
Is it a good practice for a Service to maintain static reference to
System Manager? like Activity Manager, Power Manager? etc?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to Add Item Status Bar Dropdown Menu/List?

2011-01-31 Thread AndroidDevTime
Well the documentation does show a way to add notifications to the
status bar using NotificationMgr.   I wonder if Notifications are the
only thing that can be added to the STATUS bar.  And if anything else
can be added below the Status Bar besides the Notification
dropdowns ?  In particular is there any way to have the item always
appear at the top of this list?  Does this documentation make it clear
how to maintain the Notification for the duration that the app is
running. What if your app server goes down and resumes, what does its
notifications look like then?

On Jan 27, 9:02 am, TreKing  wrote:
> On Wed, Jan 26, 2011 at 9:36 PM, AndroidDevTime 
> wrote:
>
> > I would like to place an item in the Status Bar Dropdown List.  How can
> > this be done?
>
> By reading the 
> documentation:http://developer.android.com/guide/topics/ui/notifiers/notifications
>
> -
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] How to Read Device Properties

2011-01-27 Thread AndroidDevTime
I don't know how to read device properties like value of LED?  I do
know how to write such properties using Notification Manager.  So are
these write-only properties?  Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Custom Status Bar Icons Lifecycle

2011-01-26 Thread AndroidDevTime
I am able to place Status Bar Icons using Notification Manager,  and I
see a way to send/cancel notifications to add/remove them.  Is this
the right way however to maintain icons in the status bar over a
period of time like to duration that my app is running?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] How to Add Item Status Bar Dropdown Menu/List?

2011-01-26 Thread AndroidDevTime
I would like to place an item in the Status Bar Dropdown List.  How
can this be done?  Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Options for Loading app apk

2010-12-18 Thread AndroidDevTime
 This starts loading of application apkFileName

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(apkFileName)),
"application/vnd.android.package-archive");
   ctx.startActivity(intent);

It also auto starts the Activity for loading app loading which goes
outside my admin app.

What other options are there for loading an application.  I would
rather not go thru this page every time?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en