[android-developers] Change drawable for indeterminate progress bar

2010-06-29 Thread Alexey Volovoy
Hi all, i'm trying to change standard indeterminate progress bar from
rotating wheel to sequence of 3 images ( dots ).

What i have is a animation drawable defined as progress.xml :

animation-list   android:id=@+id/progress_animation
android:oneshot=false
xmlns:android=http://schemas.android.com/apk/res/android;
item android:drawable=@drawable/progress1
android:duration=200 /
item android:drawable=@drawable/progress2
android:duration=200 /
item android:drawable=@drawable/progress3
android:duration=200 /
 /animation-list

and progressbar defined as :

 ProgressBar
android:id=@+id/my_progress
android:layout_width=wrap_content
android:layout_height=wrap_content
android:indeterminate=true
android:indeterminateOnly=true
android:indeterminateDrawable=@drawable/progress
android:visibility=invisible /

In general it works - however image is repeated for as much i have
space horizontally.  I think it's side effect of same kind of stuff
used in progress_indeterminate_horizontal.xml

Is there anyway to get rid of that repeating behavior ? Alternative,
as i understand would be change progressBar to ImageView with
animation drawable inside.

-- 
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] Need advice on UI control/feature implementation

2009-12-23 Thread Alexey Volovoy
Hi All , i have a requirement to have a control that visually is
similar to the expandable list. However on the expansion of the
section it should show something similar to the grid view. GridView
should properly respond to itemclicks and should not be scrollable and
expanded fully till the next section of the list item.
As we know it's not a good idea to mix scrollable controls on the same
screen, so i'm looking for alternative way of building such thing. Any
direction advice/ hints will be appreciated.

-- 
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: Shape with open border

2009-12-01 Thread Alexey Volovoy
Anybody figured this out yet ? I need same thing..

On Nov 16, 5:44 pm, Matthew Wardrop mister.ward...@gmail.com wrote:
 I too would like to know this.

 On Oct 23, 1:31 pm, junker37 junke...@gmail.com wrote:



  I am wondering how to do this as well.  Also, I can't seem to find
  where this is documented.

  On Oct 19, 4:19 am, Viktor Bresan viktor.bre...@gmail.com wrote:

   Hi all.

   I would like to have ashapethat hasborderonly on 3 sides: top,
   left and right, i.e. I want bottom to beopen.  How can I achieve that
   definingshapeinXML?

   Currently I have a normal 4 sideborderusing the followingshapeXML
   definition:

   ?xmlversion=1.0 encoding=utf-8?
   shapexmlns:android=http://schemas.android.com/apk/res/android;
       android:layout_width=fill_parent
       android:layout_height=fill_parent
           

           solid android:color=#FFE8F0F8
                      /

       strokeandroid:width=1dp
                   android:color=#808480
                   /

       padding android:left=1dp
                    android:top=1dp
                android:right=1dp
                android:bottom=1dp
                /
   /shape

   Many thanks, Viktor.

-- 
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] weird issues with resources on Verizon Eris.

2009-11-17 Thread Alexey Volovoy
Hi all, i'll have more info tomorrow, once i'll have this device
again, but i was shown very weird stuff  today.
We've updated app with hi-res graphics for the Droid ( only
drawables ) around 4 days ago .
Resources organized
res
drawable
drawable-hdpi-v6
App was tested in working fine on devices droid, all tmo devices
including cliq, all sprint devices with both 1.5 and 1.6 roms, and
some unbranded European hero.
With eris behavior is like this - if i download app from the market
everything is fine. User reported he turned device off and then he
turn it back on, app seems to lost some images. For example launch
icon changed to the random image ( which was supplied with the app as
well) background was simply lost etc. Uninstall/reinstall helps, but i
think it's going to be till next reboot.
i'm realize that somehow it's related to the way i put the drawables
but not sure of what exactly is going on.
I'll try to get reproduce that tomorrow in the office.
If anybody have any idea what's going on on Eris build with res
selection - i really appreciate any help / hints.

-- 
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: Person using Sprint Hero can't see application?

2009-11-14 Thread Alexey Volovoy
Most of the Heros running 1.5 , although upgrade afaik is available.
So minSdk should be 3 ( or you'll run into the same problem with CLIQ
users )
target SDK should be 4

On Nov 14, 9:53 am, g1bb corymgibb...@gmail.com wrote:
 Hello,

 I have someone e-mailing me that they can't see my application in the
 Market. Is there something specific that I need to put in my manifest?
 They're using a Sprint Hero.

 Here's my manifest:
 ?xml version=1.0 encoding=utf-8?
 manifest xmlns:android=http://schemas.android.com/apk/res/android;
       package=com.droidfart.app android:versionCode=14
 android:versionName=1.1.2
 application android:label=@string/app_name android:icon=@drawable/
 logo
         activity android:name=.Main
                   android:label=@string/app_name
                   android:screenOrientation=portrait
             intent-filter
                 action android:name=android.intent.action.MAIN /
                 category
 android:name=android.intent.category.LAUNCHER /
             /intent-filter
         /activity

         activity android:name=.FartBombActivity
                 android:label=@string/app_name
                 android:screenOrientation=portrait/

         activity android:name=.FartBombCountDown
                 android:label=@string/app_name
                 android:screenOrientation=portrait/

         activity android:name=.Shaker
         android:label=@string/app_name
         android:screenOrientation=portrait/

         activity android:name=.Settings
         android:label=@string/app_name
         android:screenOrientation=portrait/

         activity android:name=.Recorder
         android:label=@string/app_name
         android:screenOrientation=portrait/

          receiver android:name=.SMSReceiver
                         android:enabled=true
                         intent-filter
                                 action
                                         
 android:name=android.provider.Telephony.SMS_RECEIVED /
                         /intent-filter
         /receiver
         receiver android:name=.SMSReceiver android:label=@string/
 app_name
     intent-filter
        category android:name=android.intent.category.LAUNCHER /
     /intent-filter
 /receiver

  receiver android:name=.OneShotAlarm android:process=:remote /
    service android:name=.FartBomb/
  /application

 uses-sdk android:minSdkVersion=4/uses-sdk
 uses-permission android:name=android.permission.RECEIVE_SMS/uses-
 permission
 uses-permission android:name=android.permission.WAKE_LOCK/uses-
 permission
 uses-permission android:name=android.permission.VIBRATE/uses-
 permission
 uses-permission android:name=android.permission.RECORD_AUDIO/uses-
 permission
 /manifest

 Thanks in advance.

-- 
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 test if app is shown on Market for all screensizes

2009-11-12 Thread Alexey Volovoy
How's your uses-sdk part of manifest looks like ?

On Nov 12, 4:29 pm, Klaus Kartou kar...@gmail.com wrote:
 Can anyone enlighten me? :)
 It looks like our app doesnt show up on the market on HTC Tattoo. What else
 should we specify in the manifest?



 On Thu, Nov 12, 2009 at 4:01 PM, Klaus Kartou kar...@gmail.com wrote:
  Hi!

  We have uploaded a new version of our app where we added the following to
  the manifest:

  supports-screens
  android:smallScreens=true
   android:normalScreens=true
  android:largeScreens=true
   android:anyDensity=true
  /

  However, we are receiving complaints that users cannot find the app on the
  market using their HTC Tattoo and HTC Dragon phones. Any ideas what we are
  doing wrong, and is there a way for the developers to test if the app is
  visible on the market?

  Cheers!

-- 
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: Unexpected Resumes Running Under 2.0

2009-11-11 Thread Alexey Volovoy
I have same issue cause by this line of code i onCreate();
iconView.setImageResource(R.drawable.mylogor);

On Oct 29, 9:18 pm, Nmix nepean...@gmail.com wrote:
 Ok, I found it -- it's my bug. Mark, you were partly right, and that
 helped. It was related to the configuration. Here is the guilty code,
 which is in onCreate():

 mRes = getResources();
 mConfig = mRes.getConfiguration();
 mConfig.setToDefaults();      //Error here.

 There should not be a call to setToDefaults(). I don't remember now
 what I was thinking at the time, and the Android doc is very
 uninformative for this method. Possibly I copied an example from
 somewhere. Removing this line solved the problem.

 Funny thing is that the bad code works fine pre-2.0 releases. However,
 once I found it I carefully scoured the logcat on a 1.6 AVD and I did
 find the same warning log spit out from the system process. Of course,
 since nothing was broken and there was no way to relate the log to my
 process, I had no idea.

 I know now because it breaks in 2.0 by forcing a restart of the
 activity that resembles a config change. I don't know if the 2.0
 behavior is right or wrong since the write-up for setToDefaults() says
 very little.

 fadden: I did consider filing a bug, but that seemed premature when I
 wasn't able to localize the problem. I didn't want to simply point to
 the app on Android Market. Now the point is moot. Thanks.

 On Oct 29, 7:04 pm, Nmix nepean...@gmail.com wrote:



  Apart from a Log.d() that I just added to produce the logcat trace and
  the super call, there was just one line of code (an 'if' with a
  condition which isn't satisfied) which is pretty boring. Regardless, I
  commented that out. No change in behavior. Thanks for the suggestion,
  Mark, but I am beginning to think that something quite a bit more
  subtle is going on.

  Now I'm getting quite worried about when 2.0 shows up in OTA updates
  because it may/will break my app and I have no idea what to do. Up to
  1.6 the app is solid as a rock.

  On Oct 29, 5:30 pm, Mark Murphy mmur...@commonsware.com wrote:

   Nmix wrote:
I did some additional testing on the 2.0 AVD, including numerous
project cleans, compiling with 1.5, 1.6 and 2.0, and cutting out large
swaths of code. The problem persists. Yet other apps I have work fine
on 2.0.

I peppered logs in each of the major life cycle methods I implement,
and this is what I get:
10-29 20:33:23.561: DEBUG/tag(502): onCreate
10-29 20:33:24.271: DEBUG/tag(502): onResume
10-29 20:33:26.101: DEBUG/tag(502): onSaveInstanceState
10-29 20:33:26.214: DEBUG/tag(502): onPause
10-29 20:33:26.311: DEBUG/tag(502): onCreate
10-29 20:33:26.561: DEBUG/tag(502): onRestoreInstanceState
10-29 20:33:26.571: DEBUG/tag(502): onResume
10-29 20:33:27.081: DEBUG/tag(502): onSaveInstanceState
10-29 20:33:27.130: DEBUG/tag(502): onPause
10-29 20:33:27.211: DEBUG/tag(502): onCreate
10-29 20:33:27.601: DEBUG/tag(502): onRestoreInstanceState
10-29 20:33:27.611: DEBUG/tag(502): onResume
10-29 20:33:28.162: DEBUG/tag(502): onSaveInstanceState
10-29 20:33:28.201: DEBUG/tag(502): onPause
10-29 20:33:28.541: DEBUG/tag(502): onCreate
10-29 20:33:28.951: DEBUG/tag(502): onRestoreInstanceState
10-29 20:33:28.960: DEBUG/tag(502): onResume
10-29 20:33:29.631: DEBUG/FatCalc(502): onPause

I finally kill it with the back key, though it sometimes takes a few
tries because the timing is critical.

Elsewhere in the log, I found something in the logs put out by the
system process that from their timestamp may be correlated with the
uninstall/install process initiated by ADB:

10-29 20:33:14.391: WARN/ResourceType(55): Resources don't contain
package for resource number 0x7f06
10-29 20:33:14.461: WARN/ResourceType(55): Resources don't contain
package for resource number 0x7f060001

These correspond to string resources in the app, both of which appear
to display normally when the app runs, in the momentary glimpses of
the app's UI display before it gets destroyed.

This really has me puzzled. Any help appreciated.

   Something in your onResume() would appear to be triggering behavior
   reminiscent of a screen rotation or other configuration change.

   I'd start by commenting out everything in onResume() and seeing if the
   problem persists.

   --
   Mark Murphy (a Commons 
   Guy)http://commonsware.com|http://twitter.com/commonsguy

   Android 1.6 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] Android 2.0 setImageResource(R.drawable.my_icon)

2009-11-11 Thread Alexey Volovoy
hi all , not sure if it's a bug or i'm using that in the wrong place.
If i have following line (s ) of code in onCreate ()
iconView.setImageResource(R.drawable.my_icon);
And ONLY if my device(Droid) or emulator running 2.0 in landscape it
cause activity go through lifecycle endlessly like described in this
thread :
http://groups.google.com/group/android-developers/browse_thread/thread/d3d6f944c6167952
If i move code to onStart() - life is good again.
Weird thing it only happens if i'm testing 2.0 and only landscape. I
realize that onCreate may be not the best choice to put such things
in, but still it's weird that it doesn't work only in landscape.

-- 
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] TelephonyManager getDeviceID() in 2.0

2009-10-27 Thread Alexey Volovoy

Hi All  getDeviceID() and LineNumber1 return null in th 2.0 emulator.
Anybody knows how to fake those ?
--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-07-31 Thread Alexey Volovoy

that's what i did. it is set to 0. and i'm updating via alarm manager.
and i'm scheduling with setInexactRepeating(). Further looking into
the log tonight - it's is working, i had some cases with 5-10 minutes
without logging an update. Of course my update will join any other
update that wakes device up ( gmail, twitter feed etc ). Bottom line -
it's working as designed, but due to the nature of the widget it's
still be nicer to base updates on the screen state rather on device
state. I'd rather cancel all alarms if screen is off and start
scheduling new ones once it back on..
Rationale behind frequent updates - if i'm not rotating headlines in
visible fashion people complain that widget is not working. Service
is basically just puts new headline and image on RemoteViews.

On Jul 31, 12:27 am, Jeff Sharkey jshar...@android.com wrote:
 When you register for AppWidget updates through the updatePeriodMillis
 parameter, the system schedules an update for you using
 setInexactRepeating() with a WAKEUP flag.  (Which forces the device
 awake for every update.)  Here's the relevant system service code:

 http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;...

 The rationale behind this is that users don't want all their widgets
 to begin updating the moment they wake up a phone, slowing it down.
 Any updates should continue happening, even when the phone is asleep,
 so widgets are always ready and updated.  Several places it's been
 mentioned that you should avoid update intervals shorter than, say,
 every hour, precisely because of this fact.

 Keep in mind that you're completely free to set updatePeriodMillis to
 0 (which disables updates) and manage your own update alarms without
 the WAKEUP flag.

 j



 On Mon, Jun 22, 2009 at 2:31 PM, Mark Murphymmur...@commonsware.com wrote:

  Alexey Volovoy wrote:
  Hi All , i'm looking for the best strategy for the following -- widget
  suppose to go through cached headlines. And once a 3 hours or so -
  pull new ones.
  Update are scheduled from widget config file. Everything seems to be
  working, except I don't want to running my updates which are simply
  changing info on the screen while phone is sleeping. What's the best
  strategy to avoid that ? Desired  behavior - phone is not sleeping -
  i'll run update which will change headline to next one and check if
  there is  a time to pull new headlines. If phone is sleeping - i don't
  want to do any of that.

  AFAIK, widgets don't update while the device is asleep. Do you have
  evidence to the contrary?

  --
  Mark Murphy (a Commons Guy)
 http://commonsware.com|http://twitter.com/commonsguy

  Android Development Wiki:http://wiki.andmob.org

 --
 Jeff Sharkey
 jshar...@android.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] Re: Widgets ( frequent updates )

2009-07-31 Thread Alexey Volovoy

that's what i did. it is set to 0. and i'm updating via alarm manager.
and i'm scheduling with setInexactRepeating(). Further looking into
the log tonight - it's is working, i had some cases with 5-10 minutes
without logging an update. Of course my update will join any other
update that wakes device up ( gmail, twitter feed etc ). Bottom line -
it's working as designed, but due to the nature of the widget it's
still be nicer to base updates on the screen state rather on device
state. I'd rather cancel all alarms if screen is off and start
scheduling new ones once it back on..
Rationale behind frequent updates - if i'm not rotating headlines in
visible fashion people complain that widget is not working. Service
is basically just puts new headline and image on RemoteViews.

On Jul 31, 12:27 am, Jeff Sharkey jshar...@android.com wrote:
 When you register for AppWidget updates through the updatePeriodMillis
 parameter, the system schedules an update for you using
 setInexactRepeating() with a WAKEUP flag.  (Which forces the device
 awake for every update.)  Here's the relevant system service code:

 http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;...

 The rationale behind this is that users don't want all their widgets
 to begin updating the moment they wake up a phone, slowing it down.
 Any updates should continue happening, even when the phone is asleep,
 so widgets are always ready and updated.  Several places it's been
 mentioned that you should avoid update intervals shorter than, say,
 every hour, precisely because of this fact.

 Keep in mind that you're completely free to set updatePeriodMillis to
 0 (which disables updates) and manage your own update alarms without
 the WAKEUP flag.

 j



 On Mon, Jun 22, 2009 at 2:31 PM, Mark Murphymmur...@commonsware.com wrote:

  Alexey Volovoy wrote:
  Hi All , i'm looking for the best strategy for the following -- widget
  suppose to go through cached headlines. And once a 3 hours or so -
  pull new ones.
  Update are scheduled from widget config file. Everything seems to be
  working, except I don't want to running my updates which are simply
  changing info on the screen while phone is sleeping. What's the best
  strategy to avoid that ? Desired  behavior - phone is not sleeping -
  i'll run update which will change headline to next one and check if
  there is  a time to pull new headlines. If phone is sleeping - i don't
  want to do any of that.

  AFAIK, widgets don't update while the device is asleep. Do you have
  evidence to the contrary?

  --
  Mark Murphy (a Commons Guy)
 http://commonsware.com|http://twitter.com/commonsguy

  Android Development Wiki:http://wiki.andmob.org

 --
 Jeff Sharkey
 jshar...@android.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] Re: Widgets ( frequent updates )

2009-07-31 Thread Alexey Volovoy

At this moment no - but in new version i've provided ability to
refresh content on demand. hopefully it'll solve complains problem

On Jul 31, 9:15 am, String sterling.ud...@googlemail.com wrote:
 On Jul 31, 2:46 pm, Alexey Volovoy avolo...@gmail.com wrote:

  Rationale behind frequent updates - if i'm not rotating headlines in
  visible fashion people complain that widget is not working.

 Have you made the update interval user-configurable? I'd like to think
 this would cut down on such complaints, or at least give you somewhere
 to point them.

 String
--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-07-31 Thread Alexey Volovoy

At this moment no - but in new version i've provided ability to
refresh content on demand. hopefully it'll solve complains problem

On Jul 31, 9:15 am, String sterling.ud...@googlemail.com wrote:
 On Jul 31, 2:46 pm, Alexey Volovoy avolo...@gmail.com wrote:

  Rationale behind frequent updates - if i'm not rotating headlines in
  visible fashion people complain that widget is not working.

 Have you made the update interval user-configurable? I'd like to think
 this would cut down on such complaints, or at least give you somewhere
 to point them.

 String
--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-07-31 Thread Alexey Volovoy

At this moment no - but in new version i've provided ability to
refresh content on demand. hopefully it'll solve complains problem

On Jul 31, 9:15 am, String sterling.ud...@googlemail.com wrote:
 On Jul 31, 2:46 pm, Alexey Volovoy avolo...@gmail.com wrote:

  Rationale behind frequent updates - if i'm not rotating headlines in
  visible fashion people complain that widget is not working.

 Have you made the update interval user-configurable? I'd like to think
 this would cut down on such complaints, or at least give you somewhere
 to point them.

 String
--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-07-30 Thread Alexey Volovoy

Ok.. so i already have an receiver for the widget... and adding
screen_on/screen_off should do it ?
  !-- Broadcast Receiver that will process AppWidget updates --
receiver android:name=com.package.NewsWidget
android:label=@string/app_name 
intent-filter
action
android:name=android.intent.action.SCREEN_ON /
action
android:name=android.intent.action.SCREEN_OFF /
action
android:name=android.appwidget.action.APPWIDGET_UPDATE /
/intent-filter
meta-data android:name=android.appwidget.provider
android:resource=@xml/widget_news /
/receiver
Strangely i don't receive SCREEN_OFF/SCREEN_ON in my
 @Override
public void onReceive(Context context, Intent intent) {
 }

On Jul 29, 5:20 pm, Mark Murphy mmur...@commonsware.com wrote:
 Alexey Volovoy wrote:
  Hm.. let's say i'm not going to schedule next update via alarm if
  screen is off. Service will shut itself down. Then screens is coming
  back what will listen to that broadcast ?

 A BroadcastReceiver registered in your manifest. That receiver then
 starts up your service. You may already have one of these if your
 service needs to start up at boot time.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Android App Developer Training:http://commonsware.com/training.html
--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-07-30 Thread Alexey Volovoy

Oh man.. that not going to fly .. I can't do it from the service,
because service runs like for a second to update the widget and
stopSelf(). So if i register something onStart() i'd have to
unregister that onDestroy(). Therefore to actually catch that event
while service is running becomes kind of tricky.
Sigh.. still don't understand why the hell it running updates during
the sleep...

On Jul 30, 3:16 pm, Mark Murphy mmur...@commonsware.com wrote:
  Ok.. so i already have an receiver for the widget... and adding
  screen_on/screen_off should do it ?
       !-- Broadcast Receiver that will process AppWidget updates --
          receiver android:name=com.package.NewsWidget
  android:label=@string/app_name 
              intent-filter
                  action
  android:name=android.intent.action.SCREEN_ON /
                  action
  android:name=android.intent.action.SCREEN_OFF /
                  action
  android:name=android.appwidget.action.APPWIDGET_UPDATE /
              /intent-filter
              meta-data android:name=android.appwidget.provider
  android:resource=@xml/widget_news /
          /receiver
  Strangely i don't receive SCREEN_OFF/SCREEN_ON in my
  �...@override
      public void onReceive(Context context, Intent intent) {
   }

 Nuts. Further research indicates that, at least as of last December, you
 can only get SCREEN_OFF/SCREEN_ON from in-Java registered receivers:

 http://groups.google.com/group/android-developers/browse_frm/thread/8...

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 Android App Developer Books:http://commonsware.com/books.html
--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-07-30 Thread Alexey Volovoy

is there anyway to get to the state of the phone/screen without
listening to broadcasts ?

--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-07-29 Thread Alexey Volovoy

Well.. i've tried to use alarm manager like:
AlarmManager alarmManager = (AlarmManager)getSystemService
(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC, nextUpdate, pendingIntent);
thinking behind it was - if devices is not a sleep, i'll loop through
my headlines in 30 sec interval. If it goes a sleep i don't need to do
anything.
Well after putting devices to sleep i still see updates. It's
obviously i'm doing something wrong but have no idea what exactly..

On Jun 22, 9:09 pm, Alexey Volovoy avolo...@gmail.com wrote:
 Skip the work is not a really good option in my case. I have very
 little work to do, get next headline and push widget update. So it's
 probably will spend equal amount of time of starting and stopping
 service
 alarm manager , yes it's really good option and you don't need set
 very long time - setting it to 0 does the job.

 On Jun 22, 6:00 pm, Mark Murphy mmur...@commonsware.com wrote:

  Alexey Volovoy wrote:
   hm.. based on the  logs from UpdateService onStart - it's still
   executing update after i've uchecked the setting.

  That's odd. That means they must be using a WAKEUP form of AlarmManager.
  I would have expected otherwise.

  One option is for you to watch for ACTION_SCREEN_ON and
  ACTION_SCREEN_OFF broadcast Intents in your service (or use some other
  method to see if the screen is not -- not sure if there's a simple API
  for that). When you know the screen is off, skip the work in the update.

  Another alternative is for you to specify an effectively infinitely long
  updateTimeMillis (2 billion milliseconds or so is over a year) and use
  AlarmManager yourself. You can push updates to the widget whenever you
  want -- updateTimeMillis is just a convenient means for doing so. In
  your own AlarmManager work, don't use one of the WAKEUP variants, and
  the alarm will fire when the phone next awakens if it ordinarily would
  have fired while the phone was asleep.

  --
  Mark Murphy (a Commons 
  Guy)http://commonsware.com|http://twitter.com/commonsguy

  Warescription: Three Android Books, Plus Updates, $35/Year


--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-07-29 Thread Alexey Volovoy

I see it the logs of course. Every 30 sec it's starting the service as
it should if it's not asleep.

On Jul 29, 2:35 pm, Mark Murphy mmur...@commonsware.com wrote:
 Alexey Volovoy wrote:
  Well.. i've tried to use alarm manager like:
  AlarmManager alarmManager = (AlarmManager)getSystemService
  (Context.ALARM_SERVICE);
  alarmManager.set(AlarmManager.RTC, nextUpdate, pendingIntent);
  thinking behind it was - if devices is not a sleep, i'll loop through
  my headlines in 30 sec interval. If it goes a sleep i don't need to do
  anything.
  Well after putting devices to sleep i still see updates. It's
  obviously i'm doing something wrong but have no idea what exactly..

 If the device is asleep, how do you see updates?

 Bear in mind:

 This alarm does not wake the device up; if it goes off while the device
 is asleep, it will not be delivered until the next time the device wakes
 up. 

 Hence, it may be you are getting the alarm as you are coming out of sleep.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Looking for Android opportunities?http://wiki.andmob.org/hado
--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-07-29 Thread Alexey Volovoy

I don't set any WakeLocks . So yes it's seems to be something is
preventing device to go to sleep .. And i think it's my frequent
updates. I set go to sleep on red button via spare parts which will do
this:
07-29 14:59:39.986: DEBUG/WindowManager(58): I'm tired
mEndcallBehavior=0x2
07-29 14:59:40.234: DEBUG/Sensors(58): sensors=, real=
07-29 14:59:40.424: DEBUG/AKMD(39): Compass CLOSE
07-29 14:59:40.574: DEBUG/SurfaceFlinger(58): About to give-up screen,
flinger = 0x16a458
then i see this
07-29 14:59:50.014: DEBUG/UpdateService(3813): Requested UPDATE_ALL
action
07-29 14:59:50.014: DEBUG/UpdateService(3813): OnStart()
07-29 14:59:50.024: DEBUG/UpdateService(3813): Processing thread
started
07-29 14:59:50.024: DEBUG/UpdateService(3813): Widget ID:11
07-29 14:59:50.024: DEBUG/UpdateService(3813):
Info:AppWidgetProviderInfo(provider=ComponentInfo{package/
package.widget.NewsWidget})
07-29 14:59:50.024: DEBUG/MPPNewsWidget(3813): buildUpdate()
07-29 14:59:50.034: DEBUG/MPPNewsWidget(3813): getNextItem:position{4}
size {10}
07-29 14:59:50.074: DEBUG/MPPNewsWidget(3813): UpdateIntent:25598174
07-29 14:59:50.074: DEBUG/MPPNewsWidget(3813): widgetID:11
07-29 14:59:50.114: DEBUG/UpdateService(3813): Widget ID:12
07-29 14:59:50.124: DEBUG/UpdateService(3813):
Info:AppWidgetProviderInfo(provider=ComponentInfo{package.dev/
package.NewsWidget})
07-29 14:59:50.124: DEBUG/MPPNewsWidget(3813): buildUpdate()
07-29 14:59:50.134: DEBUG/MPPNewsWidget(3813): getNextItem:position
{31} size {40}
r=2009-07-28T194846Z_01_BTRE56L0YDE00_RTROPTP_0_PEOPLE-
JACKSONw=w=150
07-29 14:59:50.184: DEBUG/MPPNewsWidget(3813): UpdateIntent:25579477
07-29 14:59:50.194: DEBUG/MPPNewsWidget(3813): widgetID:12
07-29 14:59:50.234: INFO/ActivityManager(58): Stopping service:
package.dev/package.widget.UpdateService
and like this every 30 sec .. then after i press menu again i see..
07-29 15:03:49.568: DEBUG/KeyguardViewMediator(58): wakeWhenReadyLocked
(82)
07-29 15:03:49.568: DEBUG/KeyguardViewMediator(58): handleWakeWhenReady
(82)
07-29 15:03:49.574: DEBUG/KeyguardViewMediator(58): pokeWakelock(5000)
07-29 15:03:49.584: DEBUG/AKMD(39): Compass OPEN
07-29 15:03:49.594: DEBUG/Sensors(58): sensors=0001, real=0001
07-29 15:03:49.794: DEBUG/SurfaceFlinger(58): Screen about to return,
flinger = 0x16a458


Now i disconnected the device from usb and will see if that will do
the trick.


On Jul 29, 2:49 pm, Mark Murphy mmur...@commonsware.com wrote:
 Alexey Volovoy wrote:
  I see it the logs of course. Every 30 sec it's starting the service as
  it should if it's not asleep.

 Are you holding a WakeLock anywhere?

 Is anything else perhaps keeping the device/emulator awake? In other
 words, how do you know it went to sleep?

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Looking for Android opportunities?http://wiki.andmob.org/hado
--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-07-29 Thread Alexey Volovoy

Thanks for reply Dianne - my worry is that 30 sec interval for update
is not enough to let device fall asleep and my updates basically
prevent that. I've tried to disconnect device for an hour or so and
it's still updating according to the logs. Do you have any
recommendation of how i can update widget frequently when device is
awake and screen is on and don't update at all while it's sleeping ?
I'm using alarm manager now and the android:updatePeriodMillis=0 in
the appwidget-provider

On Jul 29, 4:18 pm, Dianne Hackborn hack...@android.com wrote:
 Being plugged in to usb keeps the device awake.  There are also often things
 that will wake up the device in the background that can allow your own alarm
 to go off.



 On Wed, Jul 29, 2009 at 1:06 PM, Alexey Volovoy avolo...@gmail.com wrote:

  I don't set any WakeLocks . So yes it's seems to be something is
  preventing device to go to sleep .. And i think it's my frequent
  updates. I set go to sleep on red button via spare parts which will do
  this:
  07-29 14:59:39.986: DEBUG/WindowManager(58): I'm tired
  mEndcallBehavior=0x2
  07-29 14:59:40.234: DEBUG/Sensors(58): sensors=, real=
  07-29 14:59:40.424: DEBUG/AKMD(39): Compass CLOSE
  07-29 14:59:40.574: DEBUG/SurfaceFlinger(58): About to give-up screen,
  flinger = 0x16a458
  then i see this
  07-29 14:59:50.014: DEBUG/UpdateService(3813): Requested UPDATE_ALL
  action
  07-29 14:59:50.014: DEBUG/UpdateService(3813): OnStart()
  07-29 14:59:50.024: DEBUG/UpdateService(3813): Processing thread
  started
  07-29 14:59:50.024: DEBUG/UpdateService(3813): Widget ID:11
  07-29 14:59:50.024: DEBUG/UpdateService(3813):
  Info:AppWidgetProviderInfo(provider=ComponentInfo{package/
  package.widget.NewsWidget})
  07-29 14:59:50.024: DEBUG/MPPNewsWidget(3813): buildUpdate()
  07-29 14:59:50.034: DEBUG/MPPNewsWidget(3813): getNextItem:position{4}
  size {10}
  07-29 14:59:50.074: DEBUG/MPPNewsWidget(3813): UpdateIntent:25598174
  07-29 14:59:50.074: DEBUG/MPPNewsWidget(3813): widgetID:11
  07-29 14:59:50.114: DEBUG/UpdateService(3813): Widget ID:12
  07-29 14:59:50.124: DEBUG/UpdateService(3813):
  Info:AppWidgetProviderInfo(provider=ComponentInfo{package.dev/
  package.NewsWidget})
  07-29 14:59:50.124: DEBUG/MPPNewsWidget(3813): buildUpdate()
  07-29 14:59:50.134: DEBUG/MPPNewsWidget(3813): getNextItem:position
  {31} size {40}
  r=2009-07-28T194846Z_01_BTRE56L0YDE00_RTROPTP_0_PEOPLE-
  JACKSONw=w=150
  07-29 14:59:50.184: DEBUG/MPPNewsWidget(3813): UpdateIntent:25579477
  07-29 14:59:50.194: DEBUG/MPPNewsWidget(3813): widgetID:12
  07-29 14:59:50.234: INFO/ActivityManager(58): Stopping service:
  package.dev/package.widget.UpdateService
  and like this every 30 sec .. then after i press menu again i see..
  07-29 15:03:49.568: DEBUG/KeyguardViewMediator(58): wakeWhenReadyLocked
  (82)
  07-29 15:03:49.568: DEBUG/KeyguardViewMediator(58): handleWakeWhenReady
  (82)
  07-29 15:03:49.574: DEBUG/KeyguardViewMediator(58): pokeWakelock(5000)
  07-29 15:03:49.584: DEBUG/AKMD(39): Compass OPEN
  07-29 15:03:49.594: DEBUG/Sensors(58): sensors=0001, real=0001
  07-29 15:03:49.794: DEBUG/SurfaceFlinger(58): Screen about to return,
  flinger = 0x16a458

  Now i disconnected the device from usb and will see if that will do
  the trick.

  On Jul 29, 2:49 pm, Mark Murphy mmur...@commonsware.com wrote:
   Alexey Volovoy wrote:
I see it the logs of course. Every 30 sec it's starting the service as
it should if it's not asleep.

   Are you holding a WakeLock anywhere?

   Is anything else perhaps keeping the device/emulator awake? In other
   words, how do you know it went to sleep?

   --
   Mark Murphy (a Commons Guy)http://commonsware.com|
 http://twitter.com/commonsguy

   Looking for Android opportunities?http://wiki.andmob.org/hado

 --
 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: Widgets ( frequent updates )

2009-07-29 Thread Alexey Volovoy

Hm.. let's say i'm not going to schedule next update via alarm if
screen is off. Service will shut itself down. Then screens is coming
back what will listen to that broadcast ?
My goal is eliminate service runs while i don't need to, not minimize
amount of work service does during the run.

On Jul 29, 5:08 pm, Mark Murphy mmur...@commonsware.com wrote:
 Alexey Volovoy wrote:
  Thanks for reply Dianne - my worry is that 30 sec interval for update
  is not enough to let device fall asleep and my updates basically
  prevent that. I've tried to disconnect device for an hour or so and
  it's still updating according to the logs. Do you have any
  recommendation of how i can update widget frequently when device is
  awake and screen is on and don't update at all while it's sleeping ?
  I'm using alarm manager now and the android:updatePeriodMillis=0 in
  the appwidget-provider

 Rather than focusing on sleeping, perhaps focus on the screen being
 off. Listen for the ACTION_SCREEN_OFF and ACTION_SCREEN_ON broadcast
 Intents and tailor your behavior at that point.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Android App Developer Training:http://commonsware.com/training.html
--~--~-~--~~~---~--~~
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] Bitmap memory leaks with onClick...

2009-07-13 Thread Alexey Volovoy

Hi All i have strange memory leak with Bitmaps. First what i have - an
activity that based on the workspace view from Launcher ( 3 screens
current prev + next ) . This layout is supplied with adapter , so then
i flipping left/right it loads next view.
The views that adapter is providing is an ImageView (picture) with
decodeBitmap + TextView(Caption).  I also have on click listener that
is set on the views that toggles captions which calls this:

public void onToggleCaption() {
mAdapter.toggleCaption(); // sets boolean if is should display
caption
int currentScreen = mImageLayout.getCurrentScreen(); // 
remembers
current screen number.
mImageLayout.removeAllViews(); // Removes all three children
mImageLayout.setCurrentScreen(currentScreen); // Set back 
everything
back ( but now adapter will show or hide captions )
}

When i call this from the menu - everything is just fine. Heap stays
same +/- 1K. If i execute this code via onClick listener - i'm loosing
memory quite quickly and in about 20th iteration - VM out of budget.

adapter.public View getView(int position, View convertView, ViewGroup
parent) {
View newView = null;
byte[] mFullImage;
Enclosure enclosure = (Enclosure) getItem(position);

if (convertView != null)
newView = convertView;
else {
LayoutInflater layout = LayoutInflater.from(mContext);
newView = layout.inflate(R.layout.image_layout, null);

}
//TODO - this can be optimized
ImageView iView = (ImageView) newView.findViewById(R.id.image);
TextView tView = (TextView) newView.findViewById(R.id.caption);

Bitmap image = null;
// mFullImage is a byte[]
mFullImage = enclosure.getImage();
if (mFullImage != null) {
try {
image = 
BitmapFactory.decodeByteArray(mFullImage, 0,
mFullImage.length);

} catch (RuntimeException e) {
Log.w(TAG, e);
}
}

if (image != null) {
iView.setImageBitmap(image);
String caption = enclosure.getContent();

if (!caption.equals()  mShowCaption) {
tView.setVisibility(View.VISIBLE);
tView.setText(caption);
} else {
tView.setVisibility(View.GONE);
}
}
newView.setClickable(true);
return newView;
}
--~--~-~--~~~---~--~~
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: Error on SharedPreferences for AppWidget

2009-07-13 Thread Alexey Volovoy

I think it's an issue with exiting config activity before saving
widget settings. Put some logging around create/delete widget and in
the service and see how many widgets you're ended up getting while
rotating screen
Log.d(TAG,  appWidgetId= + appWidgetId);
You can put some logging around updates too.

On Jul 10, 7:55 am, Stefano Sanna (gerdavax) gerda...@gmail.com
wrote:
 Hi.

 I'm working on an AppWidget which manages settings using
 SharedPreferences. I'm experiencing a strange behaviour (on a Dream)
 on its configuration Activity:

 1)  if I use software keyboard (that is: without opening physical
 keyboard) to edit text, everything works fine and preferences are
 stored. The happens if the application starts with keyboard already
 open.

 2) if I open physical keyboard (and activity is being restarted and
 rendered in landscape), when saving preferences the widget does not
 appear on the desktop. Sometimes I get an error message (unable to
 unlink to the path of application's data).

 It seems that, when restarted on keyboard open, the configuration
 Activity looses ownership of its sharedpreferences.

 Any idea?

 Thank you.

 Ciao,
 Stefano.
--~--~-~--~~~---~--~~
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: loop through strings.xml

2009-07-02 Thread Alexey Volovoy

I didn't check if you'll have an access to that file. If you do - then
you can parse it ( SAX ). But WHY ?

On Jul 1, 11:41 pm, Josh joshdo...@gmail.com wrote:
 Is there a way to loop through the values of strings.xml?
--~--~-~--~~~---~--~~
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: Theme.Dialog Activity and Context Menu

2009-07-01 Thread Alexey Volovoy

bump ?

On Jun 22, 8:59 am, Alexey Volovoy avolo...@gmail.com wrote:
 Hi All , i have dialog style activity
 android:theme=@android:style/Theme.Dialog

 When i attachedcontextmenuto it
         @Override
         public void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
                 setContentView(R.layout.main);
         }

         @Override
         public boolean onCreateOptionsMenu(Menumenu) {
                 super.onCreateOptionsMenu(menu);

                 MenuItem item = null;
                 item =menu.add(0,Menu.FIRST,Menu.NONE, TestContextMenuin
 Dialog Theme);
                 item.setIcon(android.R.drawable.ic_menu_edit);

                 return true;
         }

 Themenuappears about 50 px from the bottom of this dialog. So if
 activity screen is too small - it right in the middle of the screen.
 Is there any way to anchor  menuto the bottom of the screen ?
 layout :
 ?xml version=1.0 encoding=utf-8?
 RelativeLayout
         xmlns:android=http://schemas.android.com/apk/res/android;
         android:layout_width=fill_parent
         android:layout_height=fill_parent

         ImageView
                 android:id=@+id/icon
                 android:layout_width=wrap_content
                 android:layout_height=wrap_content
                 android:layout_marginLeft=10sp
                 android:src=@drawable/icon /
         TextView
                 android:id=@+id/title
                 android:layout_toRightOf=@id/icon
                 android:layout_width=fill_parent
                 android:layout_height=wrap_content
                 android:layout_alignTop=@id/icon
                 android:layout_alignBottom=@id/icon
                 android:gravity=left|center
                 android:text=Title /
         ImageView
                 android:id=@+id/divider
                 android:layout_width=fill_parent
                 android:layout_height=wrap_content
                 android:layout_below=@id/icon
                 android:layout_gravity=left
                 android:src=@drawable/dialog_divider_horizontal_light /
         TextView
                 android:id=@+id/note
                 android:layout_width=fill_parent
                 android:layout_height=wrap_content
                 android:layout_below=@id/divider
                 android:layout_marginLeft=10sp
                 android:layout_marginBottom=10sp
                 android:layout_marginTop=10sp
                 android:text=Some Text /

 /RelativeLayout
--~--~-~--~~~---~--~~
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: Theme.Dialog Activity and Context Menu

2009-07-01 Thread Alexey Volovoy

thanks for reply Dianne.

On Jul 1, 11:20 am, Dianne Hackborn hack...@android.com wrote:
 The current platform doesn't support menus on non-fullscreen windows, sorry.



 On Wed, Jul 1, 2009 at 8:31 AM, Alexey Volovoy avolo...@gmail.com wrote:

  bump ?

  On Jun 22, 8:59 am, Alexey Volovoy avolo...@gmail.com wrote:
   Hi All , i have dialog style activity
   android:theme=@android:style/Theme.Dialog

   When i attachedcontextmenuto it
           @Override
           public void onCreate(Bundle savedInstanceState) {
                   super.onCreate(savedInstanceState);
                   setContentView(R.layout.main);
           }

           @Override
           public boolean onCreateOptionsMenu(Menumenu) {
                   super.onCreateOptionsMenu(menu);

                   MenuItem item = null;
                   item =menu.add(0,Menu.FIRST,Menu.NONE, TestContextMenuin
   Dialog Theme);
                   item.setIcon(android.R.drawable.ic_menu_edit);

                   return true;
           }

   Themenuappears about 50 px from the bottom of this dialog. So if
   activity screen is too small - it right in the middle of the screen.
   Is there any way to anchor  menuto the bottom of the screen ?
   layout :
   ?xml version=1.0 encoding=utf-8?
   RelativeLayout
           xmlns:android=http://schemas.android.com/apk/res/android;
           android:layout_width=fill_parent
           android:layout_height=fill_parent

           ImageView
                   android:id=@+id/icon
                   android:layout_width=wrap_content
                   android:layout_height=wrap_content
                   android:layout_marginLeft=10sp
                   android:src=@drawable/icon /
           TextView
                   android:id=@+id/title
                   android:layout_toRightOf=@id/icon
                   android:layout_width=fill_parent
                   android:layout_height=wrap_content
                   android:layout_alignTop=@id/icon
                   android:layout_alignBottom=@id/icon
                   android:gravity=left|center
                   android:text=Title /
           ImageView
                   android:id=@+id/divider
                   android:layout_width=fill_parent
                   android:layout_height=wrap_content
                   android:layout_below=@id/icon
                   android:layout_gravity=left
                   android:src=@drawable/dialog_divider_horizontal_light
  /
           TextView
                   android:id=@+id/note
                   android:layout_width=fill_parent
                   android:layout_height=wrap_content
                   android:layout_below=@id/divider
                   android:layout_marginLeft=10sp
                   android:layout_marginBottom=10sp
                   android:layout_marginTop=10sp
                   android:text=Some Text /

   /RelativeLayout

 --
 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] Theme.Dialog Activity and Context Menu

2009-06-22 Thread Alexey Volovoy

Hi All , i have dialog style activity
android:theme=@android:style/Theme.Dialog

When i attached context menu to it
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);

MenuItem item = null;
item = menu.add(0, Menu.FIRST, Menu.NONE, Test Context Menu in
Dialog Theme);
item.setIcon(android.R.drawable.ic_menu_edit);

return true;
}

The menu appears about 50 px from the bottom of this dialog. So if
activity screen is too small - it right in the middle of the screen.
Is there any way to anchor  menu to the bottom of the screen ?
layout :
?xml version=1.0 encoding=utf-8?
RelativeLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:layout_width=fill_parent
android:layout_height=fill_parent

ImageView
android:id=@+id/icon
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_marginLeft=10sp
android:src=@drawable/icon /
TextView
android:id=@+id/title
android:layout_toRightOf=@id/icon
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_alignTop=@id/icon
android:layout_alignBottom=@id/icon
android:gravity=left|center
android:text=Title /
ImageView
android:id=@+id/divider
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_below=@id/icon
android:layout_gravity=left
android:src=@drawable/dialog_divider_horizontal_light /
TextView
android:id=@+id/note
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_below=@id/divider
android:layout_marginLeft=10sp
android:layout_marginBottom=10sp
android:layout_marginTop=10sp
android:text=Some Text /

/RelativeLayout




--~--~-~--~~~---~--~~
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] Widgets ( frequent updates )

2009-06-22 Thread Alexey Volovoy

Hi All , i'm looking for the best strategy for the following -- widget
suppose to go through cached headlines. And once a 3 hours or so -
pull new ones.
Update are scheduled from widget config file. Everything seems to be
working, except I don't want to running my updates which are simply
changing info on the screen while phone is sleeping. What's the best
strategy to avoid that ? Desired  behavior - phone is not sleeping -
i'll run update which will change headline to next one and check if
there is  a time to pull new headlines. If phone is sleeping - i don't
want to do any of that.
--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-06-22 Thread Alexey Volovoy

One sec.. you might be right - i think i have a dev setting on the
phone that prevents it from sleeping ..

On Jun 22, 4:31 pm, Mark Murphy mmur...@commonsware.com wrote:
 Alexey Volovoy wrote:
  Hi All , i'm looking for the best strategy for the following -- widget
  suppose to go through cached headlines. And once a 3 hours or so -
  pull new ones.
  Update are scheduled from widget config file. Everything seems to be
  working, except I don't want to running my updates which are simply
  changing info on the screen while phone is sleeping. What's the best
  strategy to avoid that ? Desired  behavior - phone is not sleeping -
  i'll run update which will change headline to next one and check if
  there is  a time to pull new headlines. If phone is sleeping - i don't
  want to do any of that.

 AFAIK, widgets don't update while the device is asleep. Do you have
 evidence to the contrary?

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Android Development Wiki:http://wiki.andmob.org
--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-06-22 Thread Alexey Volovoy

hm.. based on the  logs from UpdateService onStart - it's still
executing update after i've uchecked the setting.

On Jun 22, 4:35 pm, Alexey Volovoy avolo...@gmail.com wrote:
 One sec.. you might be right - i think i have a dev setting on the
 phone that prevents it from sleeping ..

 On Jun 22, 4:31 pm, Mark Murphy mmur...@commonsware.com wrote:

  Alexey Volovoy wrote:
   Hi All , i'm looking for the best strategy for the following -- widget
   suppose to go through cached headlines. And once a 3 hours or so -
   pull new ones.
   Update are scheduled from widget config file. Everything seems to be
   working, except I don't want to running my updates which are simply
   changing info on the screen while phone is sleeping. What's the best
   strategy to avoid that ? Desired  behavior - phone is not sleeping -
   i'll run update which will change headline to next one and check if
   there is  a time to pull new headlines. If phone is sleeping - i don't
   want to do any of that.

  AFAIK, widgets don't update while the device is asleep. Do you have
  evidence to the contrary?

  --
  Mark Murphy (a Commons 
  Guy)http://commonsware.com|http://twitter.com/commonsguy

  Android Development Wiki:http://wiki.andmob.org


--~--~-~--~~~---~--~~
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: Widgets ( frequent updates )

2009-06-22 Thread Alexey Volovoy

Skip the work is not a really good option in my case. I have very
little work to do, get next headline and push widget update. So it's
probably will spend equal amount of time of starting and stopping
service
alarm manager , yes it's really good option and you don't need set
very long time - setting it to 0 does the job.

On Jun 22, 6:00 pm, Mark Murphy mmur...@commonsware.com wrote:
 Alexey Volovoy wrote:
  hm.. based on the  logs from UpdateService onStart - it's still
  executing update after i've uchecked the setting.

 That's odd. That means they must be using a WAKEUP form of AlarmManager.
 I would have expected otherwise.

 One option is for you to watch for ACTION_SCREEN_ON and
 ACTION_SCREEN_OFF broadcast Intents in your service (or use some other
 method to see if the screen is not -- not sure if there's a simple API
 for that). When you know the screen is off, skip the work in the update.

 Another alternative is for you to specify an effectively infinitely long
 updateTimeMillis (2 billion milliseconds or so is over a year) and use
 AlarmManager yourself. You can push updates to the widget whenever you
 want -- updateTimeMillis is just a convenient means for doing so. In
 your own AlarmManager work, don't use one of the WAKEUP variants, and
 the alarm will fire when the phone next awakens if it ordinarily would
 have fired while the phone was asleep.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Warescription: Three Android Books, Plus Updates, $35/Year
--~--~-~--~~~---~--~~
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 with setExtra

2009-06-22 Thread Alexey Volovoy

logs ?

On Jun 22, 9:24 pm, Will wbc...@gmail.com wrote:
 Sorry, I wasn't clear. That putExtra call actually crashes the
 program, which is why I'm so stumped. Why would a putExtra() call
 crash the app?
--~--~-~--~~~---~--~~
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: Relative layout and include tag

2009-06-15 Thread Alexey Volovoy

anyone ?
--~--~-~--~~~---~--~~
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: Widget(s) and Pending intent

2009-05-22 Thread Alexey Volovoy

Then i've tried PendingIntent.FLAG_UPDATE_CURRENT i'm no longer
crashing, but it always launches the activity with extras were put in
the widget that was updated the last. It looks like pending intent is
shared among my widget instances . Anyway to avoid that  ?

On May 22, 12:36 pm, Alexey avolo...@gmail.com wrote:
 Hi All ,  i'm working on news feed widget ( looking at Sky as an
 example )
 Everything seems to be working except when i have more than one Image
 and click on the widget i'm crashing.
 One widget is working fine and more than one widget are working fine
 too as long as i don't try to launch pending intent.
 some code :
 in buildUpdate
                 Intent intent = new Intent(context, StoryActivity.class);
                 intent.putExtra(CategoryID, catID);
                 intent.putExtra(StoryID, nItem.Number);
                 Log.d(TAG, UpdateIntent: + nItem.Number);

                 PendingIntent pending = PendingIntent.getActivity(context, 0,
 intent,PendingIntent.FLAG_CANCEL_CURRENT);
                 views.setOnClickPendingIntent(R.id.widget, pending);

 crash :

 05-22 12:31:05.483: ERROR/AndroidRuntime(15473): Uncaught handler:
 thread main exiting due to uncaught exception
 05-22 12:31:05.534: WARN/AudioFlinger(35): write blocked for 94 msecs
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):
 android.widget.RemoteViews$ActionException: android.app.PendingIntent
 $CanceledException
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.widget.RemoteViews$SetOnClickPendingIntent$1.onClick
 (RemoteViews.java:153)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.view.View.performClick(View.java:2179)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.view.View.onTouchEvent(View.java:3828)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.view.View.dispatchTouchEvent(View.java:3368)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:831)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 com.android.internal.policy.impl.PhoneWindow
 $DecorView.superDispatchTouchEvent(PhoneWindow.java:1707)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent
 (PhoneWindow.java:1197)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.app.Activity.dispatchTouchEvent(Activity.java:1993)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 com.android.internal.policy.impl.PhoneWindow
 $DecorView.dispatchTouchEvent(PhoneWindow.java:1691)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.view.ViewRoot.handleMessage(ViewRoot.java:1525)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.os.Handler.dispatchMessage(Handler.java:99)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.os.Looper.loop(Looper.java:123)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 android.app.ActivityThread.main(ActivityThread.java:3948)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 java.lang.reflect.Method.invokeNative(Native Method)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 java.lang.reflect.Method.invoke(Method.java:521)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
 (ZygoteInit.java:782)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
 dalvik.system.NativeStart.main(Native Method)
--~--~-~--~~~---~--~~
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: Widget(s) and Pending intent

2009-05-22 Thread Alexey Volovoy

I've changed the call to
 PendingIntent pending = PendingIntent.getActivity(context,
appWidgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Now everything is cool except based on discussions i'm not sure how
reliable it'll be . ( Doc says it's not supported yet )

On May 22, 2:01 pm, EboMike ebom...@gmail.com wrote:
 There are several discussions about PendingIntents in this group,
 they're a bit confusing at first because the system identifies them
 only by action and data, not extras, so multiple PendingIntents with
 the same action and data are considered the same.

 You need to make them unique, either by having unique actions or
 unique data. One of the solutions mentioned in one the threads about
 PendingIntents is to create a custom: data with the current system
 time in it.

 On May 22, 11:41 am, Alexey Volovoy avolo...@gmail.com wrote:

  Then i've tried PendingIntent.FLAG_UPDATE_CURRENT i'm no longer
  crashing, but it always launches the activity with extras were put in
  the widget that was updated the last. It looks like pending intent is
  shared among my widget instances . Anyway to avoid that  ?

  On May 22, 12:36 pm, Alexey avolo...@gmail.com wrote:

   Hi All ,  i'm working on news feed widget ( looking at Sky as an
   example )
   Everything seems to be working except when i have more than one Image
   and click on the widget i'm crashing.
   One widget is working fine and more than one widget are working fine
   too as long as i don't try to launch pending intent.
   some code :
   in buildUpdate
                   Intent intent = new Intent(context, StoryActivity.class);
                   intent.putExtra(CategoryID, catID);
                   intent.putExtra(StoryID, nItem.Number);
                   Log.d(TAG, UpdateIntent: + nItem.Number);

                   PendingIntent pending = 
   PendingIntent.getActivity(context, 0,
   intent,PendingIntent.FLAG_CANCEL_CURRENT);
                   views.setOnClickPendingIntent(R.id.widget, pending);

   crash :

   05-22 12:31:05.483: ERROR/AndroidRuntime(15473): Uncaught handler:
   thread main exiting due to uncaught exception
   05-22 12:31:05.534: WARN/AudioFlinger(35): write blocked for 94 msecs
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):
   android.widget.RemoteViews$ActionException: android.app.PendingIntent
   $CanceledException
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.widget.RemoteViews$SetOnClickPendingIntent$1.onClick
   (RemoteViews.java:153)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.View.performClick(View.java:2179)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.View.onTouchEvent(View.java:3828)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.View.dispatchTouchEvent(View.java:3368)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:831)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   com.android.internal.policy.impl.PhoneWindow
   $DecorView.superDispatchTouchEvent(PhoneWindow.java:1707)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent
   (PhoneWindow.java:1197)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.app.Activity.dispatchTouchEvent(Activity.java:1993)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   com.android.internal.policy.impl.PhoneWindow
   $DecorView.dispatchTouchEvent(PhoneWindow.java:1691)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewRoot.handleMessage(ViewRoot.java:1525)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.os.Handler.dispatchMessage(Handler.java:99)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.os.Looper.loop(Looper.java:123)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.app.ActivityThread.main(ActivityThread.java:3948)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   java.lang.reflect.Method.invokeNative(Native Method)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   java.lang.reflect.Method.invoke(Method.java:521

[android-developers] Re: Widget(s) and Pending intent

2009-05-22 Thread Alexey Volovoy

Yeah  i'm have this code , but i do need extras.

On May 22, 2:07 pm, snctln catlin.s...@gmail.com wrote:
 I have been wrestling with this problem too, and not quite figured it
 out but I remember reading something that Jeff Sharkey said about
 widget pending intents not being able to store extras properly or
 something, but they do store uris properly... like you can see in the
 sky source

 http://code.google.com/p/android-sky/source/browse/trunk/Sky/src/org/...
         // Connect click intent to launch details dialog
         Intent detailIntent = new Intent(context,
 DetailsActivity.class);
         detailIntent.setData(appWidgetUri);

         PendingIntent pending = PendingIntent.getActivity(context, 0,
 detailIntent, 0);

         views.setOnClickPendingIntent(R.id.widget, pending);

 the extras are never set, but setData() is called...

 good luck

 On May 22, 1:41 pm, Alexey Volovoy avolo...@gmail.com wrote:

  Then i've tried PendingIntent.FLAG_UPDATE_CURRENT i'm no longer
  crashing, but it always launches the activity with extras were put in
  the widget that was updated the last. It looks like pending intent is
  shared among my widget instances . Anyway to avoid that  ?

  On May 22, 12:36 pm, Alexey avolo...@gmail.com wrote:

   Hi All ,  i'm working on news feed widget ( looking at Sky as an
   example )
   Everything seems to be working except when i have more than one Image
   and click on the widget i'm crashing.
   One widget is working fine and more than one widget are working fine
   too as long as i don't try to launch pending intent.
   some code :
   in buildUpdate
                   Intent intent = new Intent(context, StoryActivity.class);
                   intent.putExtra(CategoryID, catID);
                   intent.putExtra(StoryID, nItem.Number);
                   Log.d(TAG, UpdateIntent: + nItem.Number);

                   PendingIntent pending = 
   PendingIntent.getActivity(context, 0,
   intent,PendingIntent.FLAG_CANCEL_CURRENT);
                   views.setOnClickPendingIntent(R.id.widget, pending);

   crash :

   05-22 12:31:05.483: ERROR/AndroidRuntime(15473): Uncaught handler:
   thread main exiting due to uncaught exception
   05-22 12:31:05.534: WARN/AudioFlinger(35): write blocked for 94 msecs
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):
   android.widget.RemoteViews$ActionException: android.app.PendingIntent
   $CanceledException
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.widget.RemoteViews$SetOnClickPendingIntent$1.onClick
   (RemoteViews.java:153)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.View.performClick(View.java:2179)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.View.onTouchEvent(View.java:3828)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.View.dispatchTouchEvent(View.java:3368)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:831)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   com.android.internal.policy.impl.PhoneWindow
   $DecorView.superDispatchTouchEvent(PhoneWindow.java:1707)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent
   (PhoneWindow.java:1197)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.app.Activity.dispatchTouchEvent(Activity.java:1993)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   com.android.internal.policy.impl.PhoneWindow
   $DecorView.dispatchTouchEvent(PhoneWindow.java:1691)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.view.ViewRoot.handleMessage(ViewRoot.java:1525)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.os.Handler.dispatchMessage(Handler.java:99)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.os.Looper.loop(Looper.java:123)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   android.app.ActivityThread.main(ActivityThread.java:3948)
   05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
   java.lang.reflect.Method.invokeNative(Native Method)
   05-22 12:31:05.753: ERROR

[android-developers] Re: get intent getStringExtra in a View??

2009-05-22 Thread Alexey Volovoy

why did you declare you View class static ?
Move it out of actvity. Create public method init in the view. Get an
extra in your activity and pass to View.

On May 22, 3:45 pm, guruk ilovesi...@gmail.com wrote:
 Hi,

 i have a:

 public class basal extends GraphicsActivity {

 --
         @Override       protected void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);setContentView(new 
 SampleView
 (this));        }

         private static class SampleView extends View implements
 OnGestureListener {
                 private   
 -

 and just like to request my: db_table = getIntent().getStringExtra
 (db_table);
 as I did in all other Activites before. But i always get: Can not
 make a static reference to the non-static method getIntent?

 Anyhow... how can I get my StringExtra in this SampleView??

 Thanks
 Chris
--~--~-~--~~~---~--~~
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 loading images (assets or resources) dynamically?

2009-05-22 Thread Alexey Volovoy

BitmapFactory.decodeByteArray

On May 21, 11:54 am, Kim ksunl...@gmail.com wrote:
 Hi,

 How do I load the image dynamically through the code? If its unclear,
 I mean, I want to load image files by name based on the condition in
 the code.

 If I use images as resources, the image names have to be hard coded.
 This is unacceptable to me.
 If I load image in a webview (with image src path dynamically), the
 time it takes to load is unacceptable to me.

 Can anyone suggest any other way to load the images dynamically?

 Thanks much for any pointers,
 Kim
--~--~-~--~~~---~--~~
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: 1.5 ListView disabled items

2009-05-16 Thread Alexey Volovoy

No problem, i got to tell you it means a lot that you guys responding
to the questions. Thanks. See you at I/O.

On May 15, 5:59 pm, Romain Guy romain...@google.com wrote:
 Sorry for that :(



 On Fri, May 15, 2009 at 3:21 PM, Alexey Volovoy avolo...@gmail.com wrote:

  Romain, thanks for the explanation, the name enable/disable is
  definitely misleading. I used it for dynamic content ( ads :) ) if i
  had content i enabled the item if not disabled it. I'll make a change
  to make it on the view level.

  On May 15, 3:12 pm, Romain Guy romain...@google.com wrote:
  Disabled items are badly named. They are supposed to act as separators
  (for instance, that's who the group names are implemented in the
  Settings pages.) If you don't want the user to click the item, you
  should disable the view itself. If you look at the Settings page
  you'll see why not drawing the dividers make sense for separators.

  On Fri, May 15, 2009 at 12:19 PM, Alexey Volovoy avolo...@gmail.com 
  wrote:

   Ok thanks for the answer. Although i must say it really does look ugly
   if the item happen to be in the middle of the list.

   On May 15, 12:02 pm, Romain Guy romain...@google.com wrote:
   Yes, it is intentional.

   On Fri, May 15, 2009 at 9:02 AM, Alexey avolo...@gmail.com wrote:

Hi all , i've noticed after i've switched to 1.5 that if ListView item
is not enabled the divider(s) for this item are not rendering. Is this
intentional ?

   --
   Romain Guy
   Android framework engineer
   romain...@android.com

   Note: please don't send private questions to me, as I don't have time
   to provide private support.  All such questions should be posted on
   public forums, where I and others can see and answer them

  --
  Romain Guy
  Android framework engineer
  romain...@android.com

  Note: please don't send private questions to me, as I don't have time
  to provide private support.  All such questions should be posted on
  public forums, where I and others can see and answer them

 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  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: 1.5 ListView disabled items

2009-05-15 Thread Alexey Volovoy

Ok thanks for the answer. Although i must say it really does look ugly
if the item happen to be in the middle of the list.

On May 15, 12:02 pm, Romain Guy romain...@google.com wrote:
 Yes, it is intentional.

 On Fri, May 15, 2009 at 9:02 AM, Alexey avolo...@gmail.com wrote:

  Hi all , i've noticed after i've switched to 1.5 that if ListView item
  is not enabled the divider(s) for this item are not rendering. Is this
  intentional ?

 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  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: 1.5 ListView disabled items

2009-05-15 Thread Alexey Volovoy

Romain, thanks for the explanation, the name enable/disable is
definitely misleading. I used it for dynamic content ( ads :) ) if i
had content i enabled the item if not disabled it. I'll make a change
to make it on the view level.


On May 15, 3:12 pm, Romain Guy romain...@google.com wrote:
 Disabled items are badly named. They are supposed to act as separators
 (for instance, that's who the group names are implemented in the
 Settings pages.) If you don't want the user to click the item, you
 should disable the view itself. If you look at the Settings page
 you'll see why not drawing the dividers make sense for separators.



 On Fri, May 15, 2009 at 12:19 PM, Alexey Volovoy avolo...@gmail.com wrote:

  Ok thanks for the answer. Although i must say it really does look ugly
  if the item happen to be in the middle of the list.

  On May 15, 12:02 pm, Romain Guy romain...@google.com wrote:
  Yes, it is intentional.

  On Fri, May 15, 2009 at 9:02 AM, Alexey avolo...@gmail.com wrote:

   Hi all , i've noticed after i've switched to 1.5 that if ListView item
   is not enabled the divider(s) for this item are not rendering. Is this
   intentional ?

  --
  Romain Guy
  Android framework engineer
  romain...@android.com

  Note: please don't send private questions to me, as I don't have time
  to provide private support.  All such questions should be posted on
  public forums, where I and others can see and answer them

 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  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: What uniquely identifies an application?

2009-05-14 Thread Alexey Volovoy

On Apr 28, 12:41 pm, Raphael r...@android.com wrote:
 Your question isn't quite clear. You might want to rephrase it.

How to create to packages from  same code base ?

 For your post subject: what identifies an application is the package
 name that you provide in the AndroidManifest.xml.

I'm very well aware of that .

 As for Ant, you shouldn't create the project manually. Instead use the
 android tool:

That just doesn't make any sense. Why i can't create it manually
again ?

--~--~-~--~~~---~--~~
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: What uniquely identifies an application?

2009-05-14 Thread Alexey Volovoy


 We currently don't have a good story for this especially since, as you
 found and said in your first post, the R class package depends on the
 project. One solution is to move android-agnostic code in a separate
 project building a jar library that you then package in your various
 android projects. It's not ideal though.
Unfortunately this is not really a solution for me. Let me try
again.
I have the same android-dependent code with references to R.layout and
all that stuff. So now i want to create two applications with intent
to put them on the market. To do that i'll have to have different
packages in manifest, which will lead to the fact that R.java will be
generated in two different places. Which will make my references to R
from my android code not resolving. So for two of them it's not a big
deal - i'll add import to both packages and everything will be ok. But
what if there 50 apps ? Crazy and not real example:

Let say i've developed an app that shows me everything about NHL team
(it's a playoff time after all ). Now i want to publish following apps
com.mynhl.capitals
com.mynhl.wings
com.mynhl.penguins

Android code is the same  and i want to keep it the same . res folder
is different for each team. Drawables and other properties ( for ex
tracking ids, and settings specific to each team ) so to make all that
compile to each file that has a reference to R.  i'll have to add.
import com.mynhl.capitals.*
import com.mynhl.wings.*
import com.mynhl.penguins.*
And then by using ant get res-capitals as need resource folder. And
yes, of course i've used android_rules.xml as a template and pasted in
after
setup import=false /

Now i'm looking for better way of handling all that. I don't have any
android-agnostic code .The ideal would be an ability specify your
resource package separately from application package.




  For your post subject: what identifies an application is the package
  name that you provide in the AndroidManifest.xml.

  I'm very well aware of that .

  As for Ant, you shouldn't create the project manually. Instead use the
  android tool:

  That just doesn't make any sense. Why i can't create it manually
  again ?

 The ant project uses a sophisticated build.xml file and no offense but
 you are unlikely to figure it out magically -- looking at an existing
 one is the best way to understand it.

 Starting with SDK 1.5_r1, the build.xml actually doesn't contain much
 anymore. Most of the rules are in the
 sdk/platform/android-1.N/templates/android_rules.xml. We designed that
 new structure to make it easier for people to customize the part of
 their build yet let us update the platform specific rules in later
 sdk.

 I strongly suggest you create a skeleton ant project using the
 android create project command-line and look at what has been
 generated. Then feel free to modify it as you wish.

 R/
--~--~-~--~~~---~--~~
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: What uniquely identifies an application?

2009-05-14 Thread Alexey Volovoy

Well android resources are in android.R package . always.
To pass a resource ID i need to know what it is. To find out what it
is - i need reference R. May be i didn't get what exactly you're
suggesting.
Here is simple example - i have app with package1. i want to use same
activity with package2-n apps. How i rewrite reference to R. so it can
universal ? Now as you can see i put two imports to packages where i
expect R will be generated by ant.

package com.test;
import android.app.Activity;
import android.os.Bundle;

import android.widget.Button;

// Imports to resolve R
import com.test.package1.*;
import com.test.package2.*;

public class Test extends Activity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button click = (Button) findViewById(R.id.click_btn);

}

}

On May 14, 1:52 pm, Mark Murphy mmur...@commonsware.com wrote:
  So now i want to create two applications with intent
  to put them on the market. To do that i'll have to have different
  packages in manifest, which will lead to the fact that R.java will be
  generated in two different places. Which will make my references to R
  from my android code not resolving.

 Make your reusable code take resource IDs as parameters to their APIs.

 Look at Android itself: it is reusable, yet it does not have the problems
 you describe. Why? Because resource IDs are passed in as parameters (e.g.,
 setImageResource() does not assume the resource; it takes the resource ID
 as a parameter).

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
--~--~-~--~~~---~--~~
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: What uniquely identifies an application?

2009-05-14 Thread Alexey Volovoy

life is beautiful i've discovered ant replace command :)
target name=test
 mkdir dir=src-temp /
copy todir=src-temp overwrite=true
fileset dir=src/
/copy
 replace dir=src-temp includes=**/*.java
replacetokenimport com.test.prod.R/replacetoken
replacevalueimport com.test.dev.R/replacevalue
/replace
echoDone/echo
/target

On May 14, 2:32 pm, Mark Murphy mmur...@commonsware.com wrote:
  Here is simple example - i have app with package1. i want to use same
  activity with package2-n apps. How i rewrite reference to R. so it can
  universal ? Now as you can see i put two imports to packages where i
  expect R will be generated by ant.

  package com.test;
  import android.app.Activity;
  import android.os.Bundle;

  import android.widget.Button;

  // Imports to resolve R
  import com.test.package1.*;
  import com.test.package2.*;

  public class Test extends Activity {

      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
             Button click = (Button) findViewById(R.id.click_btn);

      }

  }

 Option #1: Don't use layout resources. Instantiate your views using Java.

 Option #2: Create reusable Views for your activities that take the
 resource ID of their respective layouts as a parameter. Each view would
 navigate its contents without resource IDs (e.g., iterate over children)
 to find your widgets.

 Option #3: Augment (or wrap) your Ant build scripts to make N copies of
 your application from one master source, using text search-and-replace
 (sed/awk if you're a true geek, Ruby if you're like me and don't grok
 sed/awk) to replace necessary strings in the copies with revised ones for
 that particular copy.

 I'm sure there are any number of other possibilities.

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
--~--~-~--~~~---~--~~
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: Custom android ANT tasks

2009-05-13 Thread Alexey Volovoy

It'll be nice to have this info here as well
http://developer.android.com/sdk/1.5_r1/upgrading.html#AntUsers

On Apr 14, 2:29 pm, Xavier Ducrohet x...@android.com wrote:
 Hello,

 The new SDK include multiple versions of the Android platforms.
 Because newer versions could have slightly different build steps, we
 have decide to keep most of the build logic inside the platforms
 themselves.

 Thus, the new build.xml imports a file called android_rules.xml
 located inside SDK/platforms/platform/templates/ (it might move in
 the final SDK but you shouldn't care much).

 This file actually being imported is resolve in the first step of the
 build. The custom task setup / looks at the value loaded from
 default.properties which contains the target project (ie which
 platform/add-on the project is compiling for), and then import the
 proper rules file (after doing some properties init as well).

 If you want to change the rules to make them your own, I'd sugges to
 leave android_rules.xml unchanged, and instead copy the rules inside
 your build.xml file, *after* the setup / task.
 Additionally, change the setup task to setup import=false/. This
 will let the custom task do the properties init but not do the import.

 Some of the target in the rules files are slightly different than
 before, with some using custom tasks as well. This is due to a new
 feature to generate multiple APKs from a single project (with
 different resources).
 You can either ignore this and reuse some of the previous target/task,
 or modify the custom task to do what you want (we're pushing the
 source used to generate this SDK on the git server today)

 Xav



 On Tue, Apr 14, 2009 at 9:50 AM, Ward Willats goo...@wardco.com wrote:

  'Round these parts we don't use Eclipse and heavily customize our
  build.xml file. The android tool tried to update it and burped out
  a short, confused file.

  That's OK. Don't mind doing build.xml by hand and target-ifying it,
  but I see what look like a whole set of Android-specific ANT
  tasks/libs (prefs, apkbuilder, jarutil..), of which only setup went
  into the new build.xml.

  So.do I have to include any other custom ANT tasks besides
  setup? Or can I just use more-or-less the same command lines as
  before with aapt, javac, dx, etc...?

  And what are these rules setup uses? And where are they included from?

  Thanks

  -- Ward

 --
 Xavier Ducrohet
 Android Engineer, Google.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---