Preventing Multiple AppWidget Instances

by Jake Colman » Sun, 27 Feb 2011 10:45:17 GMT


Sponsored Links
 Is there a way to prevent multiple instances of an appwidget from being
installed on the home screen?  I do not do any special handling, nor is
it intended, for there to multiple instances.  Therefore, I should
probably prevent it or at least warn about it.  Is this possible?

-- 
Jake Colman -- Android Tinkerer

-- 



Preventing Multiple AppWidget Instances

by String » Sun, 27 Feb 2011 17:03:08 GMT


 There's no way to prevent it, no.

 IMHO, your best bet is to handle it gracefully: if the user wants to add 
multiple copies of your widget, let them. If that's not possible for whatever 
reason, then you will at least need to issue a warning. 

String 

-- 


Sponsored Links


Re: Preventing Multiple AppWidget Instances

by Jake Colman » Sun, 27 Feb 2011 22:25:15 GMT


 >>>>> "S" == String  <sterling.ud...@googlemail.com> writes:

   S> There's no way to prevent it, no.

   S>  IMHO, your best bet is to handle it gracefully: if the user wants
   S>  to add multiple copies of your widget, let them. If that's not
   S>  possible for whatever reason, then you will at least need to
   S>  issue a warning.

Can I detect that a second instance has been added so that I can display
a toast?

-- 
Jake Colman -- Android Tinkerer

-- 



Re: Re: Preventing Multiple AppWidget Instances

by Kostya Vasilyev » Sun, 27 Feb 2011 22:45:22 GMT


 Jake,

You can watch for ACTION_APPWIDGET_UPDATE with a previously unseen 
widget Id, or specify a configuration activity for the widget. The 
config activity can be made transparent and finish right away, so it's 
just there as a callback for your logic.


But if you do that, you've got to be really careful because of various 
edge cases and Android and launcher issues (also consider replacement 
launchers) .


Why not just let the user create as many widgets as they like, and let 
the user decide?


-- Kostya

27.02.2011 17:24, Jake Colman :
"S" == String<sterling.ud...@googlemail.com> writes:
S> There's no way to prevent it, no. S> IMHO, your best bet is to handle it gracefully: if the user wants S> to add multiple copies of your widget, let them. If that's not S> possible for whatever reason, then you will at least need to S> issue a warning. Can I detect that a second instance has been added so that I can display a toast?
-- Kostya Vasilyev -- http://kmansoft.wordpress.com --



Re: Preventing Multiple AppWidget Instances

by Jake Colman » Sun, 27 Feb 2011 23:09:03 GMT


 Thanks.  I guess nothing terrible will happen, it's just that it's not
useful.  Thanks.



   KV> Jake,

   KV> You can watch for ACTION_APPWIDGET_UPDATE with a previously
   KV> unseen widget Id, or specify a configuration activity for the
   KV> widget. The config activity can be made transparent and finish
   KV> right away, so it's just there as a callback for your logic.

   KV> But if you do that, you've got to be really careful because of
   KV> various edge cases and Android and launcher issues (also consider
   KV> replacement launchers) .

   KV> Why not just let the user create as many widgets as they like,
   KV> and let the user decide?

   KV> -- Kostya

   KV> 27.02.2011 17:24, Jake Colman :
   >>>>>>> "S" == String<sterling.ud...@googlemail.com>  writes:
   S> There's no way to prevent it, no.
   >> 
   S> IMHO, your best bet is to handle it gracefully: if the user wants
   S> to add multiple copies of your widget, let them. If that's not
   S> possible for whatever reason, then you will at least need to
   S> issue a warning.
   >> 
   >> Can I detect that a second instance has been added so that I can display
   >> a toast?
   >> 

   KV> -- 
   KV> Kostya Vasilyev --  http://kmansoft.wordpress.com 

   KV> -- 
   KV> 

-- 
Jake Colman -- Android Tinkerer

-- 



Other Threads

1. GridView Selector Padding

How do you change the padding on the GridView selector?  With the
default settings, the selector is wider than my column width.  I could
use setSelector but I would rather not muck with the default
functionality.
--~--~---------~--~----~------------~-------~--~----~

2. Problems with socket connection

Hi people, first of all I tell you that my English isn't so good, so
please forgive my ugly grammar!

I have this problem: when using sdk m5 I wrote an Android app (running
on the emulator) and a Java program running on the pc. The java
program uses BlueCove to interact with the bluetooth radio of my pc. I
was able to connect the Android app and the Java program with a socket
connection and then I opened a DataInputStream an a DataOutput Stream.

The thing worked fine.

Now with the SDK 1.0 I'm not able to do the same and I don't
understand why: on the AndroidManifest file I specified with uses-
permission that my app has the INTERNET permission, but I can't open
the streams: the Java program (the server) throws an Exception that
says that the operation on the socket failed because the net isn't
reacheable.

If you have any idea about what is my error...

Thank you very much! Bye!

--~--~---------~--~----~------------~-------~--~----~

3. PreferenceActivity Refresh Problem

4. process ids

5. How to export a "signed" apk package from Eclipse?

6. MyLocationOverlay Disappears

7. More highlevel 3D development