RE: [android-developers] Re: Scrolling broken in 2.2 ?

2010-09-15 Thread Peter Carpenter
Thanks Mike,

Yep it's definitely a cross platform framework.  At its simplest, I don't think 
it's too much to expect from a UI to have a scrolling textView within a parent 
scrollview. 

I'll delve into the source today and see if I can spot what's messing with the 
touch events.

Cheers,

Peter.

-Original Message-
From: android-developers@googlegroups.com 
[mailto:android-develop...@googlegroups.com] On Behalf Of Mike dg
Sent: Wednesday, 15 September 2010 7:58 PM
To: Android Developers
Subject: [android-developers] Re: Scrolling broken in 2.2 ?

It sounds like Peter is working on so,e framework for cross platform
applications, si it's probably less than ideal to make Android just
act different.

You are probably out of luck for 2.2 if the browser exhibits the same
behavior.

On Sep 15, 3:18 am, Kumar Bibek coomar@gmail.com wrote:
 Umm, Well, Getting back to 2.1 will not fix your problems. I would
 reckon the best approach would be to re-design your UI.

 -Kumar Bibekhttp://techdroid.kbeanie.com

 On Sep 15, 12:05 pm, Peter Carpenter



 peter.carpen...@skytechnologies.com wrote:
  Hey Romain,

  Thanks for the reply,

  I can understand why this is not an ideal ui design - I entirely agree.  
  But this doesn't change the fact that there seems to be some regression 
  with the Android UI code.  On researching further I've found that there are 
  a number of registered bugs for 2.2 to do with browsers exhibiting similar 
  problems whilst showing pages containing frames.  Looks like something 
  fundamental has changed here.

  As far as our use case goes - I need to be able to display whatever a user 
  requires in their screen.  Currently we can show these screens on Windows, 
  iPhone  Blackberry and Android  2.1 without any issues.  But Android 2.2 
  suddenly has this issue with the nesting.  Whilst we *could* design the app 
  to work around this bug by using a popup editor - this does not help us 
  keep things consistent, and your architecture bug free.

  As a workaround - do you know of any way to reset Nexus ones back to 2.1?

  Cheers, :)

  Peter.

  -Original Message-
  From: android-developers@googlegroups.com 
  [mailto:android-develop...@googlegroups.com] On Behalf Of Romain Guy
  Sent: Wednesday, 15 September 2010 4:42 PM
  To: android-developers@googlegroups.com
  Subject: Re: [android-developers] Scrolling broken in 2.2 ?

  Hi,

  You should never have a scrolling widget inside a scrolling widget;
  for instance a ListView inside a ScrollView. The behavior for such a
  setup is pretty much guaranteed to not work (and definitely not
  guaranteed to work.)

  On Tue, Sep 14, 2010 at 11:39 PM, Peter Carpenter
  peter.carpen...@skytechnologies.com wrote:
   My app builds up a custom screen as dictated to me via the users
   'application'.  This means that I can end up in the situation where I 
   have a
   parent scrollview and somewhere down the heirachy I can have a listView 
   or a
   multiline TextView.

   Both of these scenarios continue to work fine under 2.1, however are 
   broken
   in 2.2 (both device and emulator).  The symptoms are that the child (list 
   or
   textview) is unable to scroll using touch gestures although they can be
   scrolled using the keypad.

   Has anyone else experienced this behaviour and/or have a work around??  It
   appears that the onTouchEvent function in View has been changed
   substantially but I am currently delving into the code...

   Cheers,

   Peter.

   --
   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

  --
  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 
  athttp://groups.google.com/group/android-developers?hl=en

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

-- 
You received this message because you are subscribed to the Google
Groups 

RE: [android-developers] Re: Scrolling broken in 2.2 ?

2010-09-15 Thread Peter Carpenter
Hi Kumar,

I the short term, it would.  We're not a consumer application so we do have a 
reasonable amount of control over the devices that we ultimately deploy on.  
It's not out of the question for us to say that we don't support 2.2.  But 
obviously it's not in our interests to lock ourselves out of any future android 
releases.

Cheers,

Peter.

-Original Message-
From: android-developers@googlegroups.com 
[mailto:android-develop...@googlegroups.com] On Behalf Of Kumar Bibek
Sent: Wednesday, 15 September 2010 5:19 PM
To: Android Developers
Subject: [android-developers] Re: Scrolling broken in 2.2 ?

Umm, Well, Getting back to 2.1 will not fix your problems. I would
reckon the best approach would be to re-design your UI.

-Kumar Bibek
http://techdroid.kbeanie.com

On Sep 15, 12:05 pm, Peter Carpenter
peter.carpen...@skytechnologies.com wrote:
 Hey Romain,

 Thanks for the reply,

 I can understand why this is not an ideal ui design - I entirely agree.  But 
 this doesn't change the fact that there seems to be some regression with the 
 Android UI code.  On researching further I've found that there are a number 
 of registered bugs for 2.2 to do with browsers exhibiting similar problems 
 whilst showing pages containing frames.  Looks like something fundamental has 
 changed here.

 As far as our use case goes - I need to be able to display whatever a user 
 requires in their screen.  Currently we can show these screens on Windows, 
 iPhone  Blackberry and Android  2.1 without any issues.  But Android 2.2 
 suddenly has this issue with the nesting.  Whilst we *could* design the app 
 to work around this bug by using a popup editor - this does not help us keep 
 things consistent, and your architecture bug free.

 As a workaround - do you know of any way to reset Nexus ones back to 2.1?

 Cheers, :)

 Peter.

 -Original Message-
 From: android-developers@googlegroups.com 
 [mailto:android-develop...@googlegroups.com] On Behalf Of Romain Guy
 Sent: Wednesday, 15 September 2010 4:42 PM
 To: android-developers@googlegroups.com
 Subject: Re: [android-developers] Scrolling broken in 2.2 ?

 Hi,

 You should never have a scrolling widget inside a scrolling widget;
 for instance a ListView inside a ScrollView. The behavior for such a
 setup is pretty much guaranteed to not work (and definitely not
 guaranteed to work.)

 On Tue, Sep 14, 2010 at 11:39 PM, Peter Carpenter
 peter.carpen...@skytechnologies.com wrote:
  My app builds up a custom screen as dictated to me via the users
  'application'.  This means that I can end up in the situation where I have a
  parent scrollview and somewhere down the heirachy I can have a listView or a
  multiline TextView.

  Both of these scenarios continue to work fine under 2.1, however are broken
  in 2.2 (both device and emulator).  The symptoms are that the child (list or
  textview) is unable to scroll using touch gestures although they can be
  scrolled using the keypad.

  Has anyone else experienced this behaviour and/or have a work around??  It
  appears that the onTouchEvent function in View has been changed
  substantially but I am currently delving into the code...

  Cheers,

  Peter.

  --
  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

 --
 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 
 athttp://groups.google.com/group/android-developers?hl=en



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

-- 
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


Re: [android-developers] Re: OpenGL lockups in 2.2

2010-09-15 Thread Leigh McRae
 I don't use GLSurfaceView and I am not really sure why anyone would 
use it for anything other than a demo.  It makes your code less portable 
and takes control away from you.


With that said, I do get people with HTC complaining about freezes.  So 
it would seem that it's not a GLSurfaceView problem.



On 9/14/2010 8:38 PM, timedilation wrote:

This appears to be an HTC specific bug. My app never freezes on the
Motorla Droid. EVER. It is very stable on the Droid and I have tested
it for about 4months without a single freeze. Interestingly though it
never froze on my G1 either. The G1 I have is the ADP1 phone I bought
directly from Google.

All other HTC phones that I have exhibit the freezing - Evo, Desire
and Nexus One (which is also from HTC I believe).

Apart from that I tested it for a month on Samsung Moment. There was
NO freezing there either.
I have been in touch with a Google developer advocate and I have
submitted the bug report to his team. They are looking into this as
well.



On Sep 14, 8:23 pm, Jeremy Statzjst...@gmail.com  wrote:

That's my experience as well.  All my log results say that there's no
loading or anything necessary -- the frame it dies on is bog standard,
with drawFrame going from beginning to end.  Any loading is long since
done.

I'm currently wondering if this is an HTC driver bug.  I'm going to
let this run on a Motorola Droid all night and see if it crashes.  Not
sure I'm expecting it to, as my fiance has been using my wallpapers on
her Droid since forever and says she's never seen it lock and reboot
like we're describing.  Is there anyone at HTC to take something like
that to, if I gather some evidence?

On Sep 14, 3:32 pm, timedilationudayan.k...@gmail.com  wrote:




That's interesting..
Although I know for sure that all my gl* calls are happening only in
the GL thread. And this freezing happens even when I simply leave the
device (HTC Desire) running my app with zero user interaction
whatsoever. All the app renders is a scenery with a single animation.
No texture changes or geometry changes are taking place in this
scenario. But because of the animation, I have to render continuously
and this is why I have not used the Render_when_dirty approach.
I did notice that when the app freezes, my main UI thread as well as a
secondary thread (that talks to a game server) are still running and
alive. The main UI thread does register touches until a point and then
hangs while the secondary thread stays alive. I tried to send an
interrupt() to the GLThread from this secondary thread but that did
not help. The GLThread remained stuck in eglSwapBuffer();
On Sep 14, 3:42 pm, Stringsterling.ud...@googlemail.com  wrote:

On Sep 13, 11:24 pm, Jeremy Statzjst...@gmail.com  wrote:

The big problem here, in my eyes, is that this appears to
affect any OpenGL using application, and is tremendously discouraging,
to the point that people pull things off the market and avoid using
OpenGL.

I've been chasing this in a couple of my own OpenGL apps for a couple
of months as well. It's summed up well in this thread - extremely
intermittent, but extremely serious when it does happen. And I'm one
of the devs who has pulled an app from the Market as a result.
At the moment, I'm provisionally optimistic that I've worked around
the issue in my case. Given it's a race condition, I took the approach
of maximum thread-safety: I put a whole load of semaphores into my
code, added synchronized and volatile modifiers all over the
place, that sort of thing. And it seems to have been successful... I
can't be sure (because of the intermittency), but I haven't seen it
happen for a couple of weeks now.
If I had to speculate, I'd say that the problem finally went when I
synchronized some code which re-generates geometry within my OpenGL
model. I added semaphores to ensure that textures, geometry, and
rendering never happened concurrently. There's no way to know that was
the end problem, but that SEEMED to be it. If that helps anyone.
Just to reiterate, I agree that this is a serious platform-level bug
that needs to be fixed by Google. And it has gotten worse since 2.2,
although I have (rarely) seen it happen on my G1 running 1.6.
String


--
Leigh McRae
www.lonedwarfgames.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: HttpURLConnection or HttpClient

2010-09-15 Thread cindy
Thanks for all the reply.

On Sep 15, 3:39 pm, Filip Havlicek havlicek.fi...@gmail.com wrote:
 You can do that with URLConnection too of course, although it takes a little
 bit more effort to make it work.

 Best regards,
 Filip Havlicek

 2010/9/16 Frank Weiss fewe...@gmail.com

  For simple requests, URLConnection works fine. Use HttpClient if you need
  to manage basic auth, cookies, headers, etc.
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

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


[android-developers] ANR keyDispatchingTimedOut

2010-09-15 Thread Dan
Hi all,

I've got an application with an alarming number of users reporting
force closes. I've tested multiple devices numerous times and never
had this happen, so it's very difficult to test. Luckily, the new
stack trace reporting features seem to give me an idea, but I am not
familiar with ANR keyDispatchingTimedOut and Google doesn't seem to
be much help. I can debug when I see the error just fine, but I'm not
sure what information these stack traces are providing me. Is it just
saying where each thread was when the crash occurred?

Any help would be greatly appreciated - not just by me, but by a lot
of my users!

Dan


Example Trace:
---

DALVIK THREADS:
main prio=5 tid=1 NATIVE
  | group=main sCount=1 dsCount=0 s=N obj=0x4001d8c0 self=0xccc8
  | sysTid=27792 nice=0 sched=0/0 cgrp=default handle=-1345017816
  | schedstat=( 184875489 298065182 95 )
  at java.net.InetAddress.getaddrinfo(Native Method)
  at java.net.InetAddress.lookupHostByName(InetAddress.java:508)
  at java.net.InetAddress.getAllByNameImpl(InetAddress.java:280)
  at java.net.InetAddress.getByName(InetAddress.java:310)
  at java.net.InetSocketAddress.init(InetSocketAddress.java:110)
  at java.net.InetSocketAddress.init(InetSocketAddress.java:89)
  at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.init(HttpConnection.java:
62)
  at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:
88)
  at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:
927)
  at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:
909)
  at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:
1152)
  at com.xoise.mancala.Mancala.checkUpdate(Mancala.java:186)
  at com.xoise.mancala.Mancala.onCreate(Mancala.java:43)
  at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
  at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2627)
  at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2679)
  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
2033)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4627)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  at dalvik.system.NativeStart.main(Native Method)

SoundPool prio=5 tid=8 NATIVE
  | group=main sCount=1 dsCount=0 s=N obj=0x44779df8 self=0x225b18
  | sysTid=27798 nice=0 sched=0/0 cgrp=default handle=1193848
  | schedstat=( 366211 18005371 4 )
  at dalvik.system.NativeStart.run(Native Method)

SoundPoolThread prio=5 tid=7 NATIVE
  | group=main sCount=1 dsCount=0 s=N obj=0x44779720 self=0x225148
  | sysTid=27799 nice=0 sched=0/0 cgrp=default handle=1194040
  | schedstat=( 13824466 69000242 13 )
  at dalvik.system.NativeStart.run(Native Method)

Binder Thread #2 prio=5 tid=6 NATIVE
  | group=main sCount=1 dsCount=0 s=N obj=0x447696c0 self=0x11fd68
  | sysTid=27797 nice=0 sched=0/0 cgrp=default handle=1297576
  | schedstat=( 1434329 7904050 6 )
  at dalvik.system.NativeStart.run(Native Method)

Binder Thread #1 prio=5 tid=5 NATIVE
  | group=main sCount=1 dsCount=0 s=N obj=0x44764488 self=0x124880
  | sysTid=27796 nice=0 sched=0/0 cgrp=default handle=1198144
  | schedstat=( 3723144 5554199 5 )
  at dalvik.system.NativeStart.run(Native Method)

Compiler daemon prio=5 tid=4 VMWAIT
  | group=system sCount=1 dsCount=0 s=N obj=0x447632a0 self=0x121930
  | sysTid=27795 nice=0 sched=0/0 cgrp=default handle=1174160
  | schedstat=( 1220703 9277344 4 )
  at dalvik.system.NativeStart.run(Native Method)

Signal Catcher daemon prio=5 tid=3 RUNNABLE
  | group=system sCount=0 dsCount=0 s=N obj=0x447631e8 self=0x11ede0
  | sysTid=27794 nice=0 sched=0/0 cgrp=default handle=1208144
  | schedstat=( 6805420 6011962 4 )
  at dalvik.system.NativeStart.run(Native Method)

HeapWorker daemon prio=5 tid=2 VMWAIT
  | group=system sCount=1 dsCount=0 s=N obj=0x431a7b90 self=0x11e950
  | sysTid=27793 nice=0 sched=0/0 cgrp=default handle=1203280
  | schedstat=( 16723632 11505128 11 )
  at dalvik.system.NativeStart.run(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] A hand of cards

2010-09-15 Thread ClarkBattle
Imagine that you had five overlapped playing cards horizontally fanned
so that you could see the top card and the right edges of the other
four.  Now you slide over the top card until its right edge is on the
left of the screen, revealing the body of the second card with the
right edges of the remaining three cards on the right.

Any idea how to do this? I dont want to fake it with a plain old view
flipper and dummy images that pop up on the side.  It has to animate
and scroll as if it were a real card.   Is there any code that does
something similar?

Thanks.

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


[android-developers] Re: Upgrade non-market app with a new market version.

2010-09-15 Thread laminina
Hi psyke,

You can perform OTA just following the same requirements Android
Market performs.

VersionCode greater than the one is already installed, signing
certificates need to match.package name needs to match...

Later after all the bureaucratic things are done you can publish the
app in the android market with a greater version code and this will
update the second version that was installed as OTA.

I've tried my self already...just don;t forget to follow the same
requirements from the Android Market.
Remember that the user can disabled the option of Installed app that
doesn't come from the android market, if this is check OTA cannot be
executed because it doesn't come from the Android market..

good luck
On Sep 15, 9:18 am, psyke eusebio@gmail.com wrote:
 Hello Guys,

 I am developping (for my company) an app included on a project that
 will have 2 versions:

      - 1st  simple version to download using a OTA server, clients
 accesss to an URL to download.
      - 2nd version more complex to be published on the Market.

 The question here is that the process to publish on the Android Market
 is under bureaucratic internal process and it takes a long time, so
 the idea do reduce the time to market is to provide an OTA version.

 There is any possibility for users that download application via OTA
 to upgrade the application for version published later on the Market?
 (Both Application will be signed with the same key).

 Thanks in advance

 Regards

-- 
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] shared library so size versus apk size

2010-09-15 Thread pgil
I would like to know why the size of my shared library .so is bigger
than my .apk file generated with Eclipse? Approximatly the so size is
twice the apk one. What is strange is after having installed it in the
device (2.1 firmware) I checked the size of the apk when I uninstalled
it from the device and surprisingly the apk size indicated is bigger
even than the .so one. Is there any explaination 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] How to switch the mobile network in program?

2010-09-15 Thread M.Allam
Peace upon you ,
I searched more  but didn't get the answer. Currently I have 2 mobile
networks for my mobile say they are A and B.
Is there a way to automatically detect the mobile networks if there
are A and B then choose A? Or just simplely choose A no matter whether
there is B availible? I want to search for gsm networks operators
available and select the preferred one.

Thanks.

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


Re: [android-developers] A hand of cards

2010-09-15 Thread Mark Murphy
Use a RelativeLayout (for the overlapping cards) and a
TranslateAnimation (for the movement of a card).

On Wed, Sep 15, 2010 at 8:33 PM, ClarkBattle clarkbat...@gmail.com wrote:
 Imagine that you had five overlapped playing cards horizontally fanned
 so that you could see the top card and the right edges of the other
 four.  Now you slide over the top card until its right edge is on the
 left of the screen, revealing the body of the second card with the
 right edges of the remaining three cards on the right.

 Any idea how to do this? I dont want to fake it with a plain old view
 flipper and dummy images that pop up on the side.  It has to animate
 and scroll as if it were a real card.   Is there any code that does
 something similar?

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

-- 
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: ANR keyDispatchingTimedOut

2010-09-15 Thread Dan Barnett
I found a fair amount of reading about this in the following links:

http://android-developers.blogspot.com/2009/05/painless-threading.html
http://android-developers.blogspot.com/2009/05/painless-threading.html
http://stackoverflow.com/questions/704311/android-how-do-i-investigate-an-anr
http://stackoverflow.com/questions/704311/android-how-do-i-investigate-an-anr
http://developer.android.com/guide/appendix/faq/commontasks.html#threading

Thanks,

Dan Barnett
Xoise Solutions, Inc.
(516) 469-9430
www.xoise.com



On Wed, Sep 15, 2010 at 8:32 PM, Dan baseballd...@gmail.com wrote:

 Hi all,

 I've got an application with an alarming number of users reporting
 force closes. I've tested multiple devices numerous times and never
 had this happen, so it's very difficult to test. Luckily, the new
 stack trace reporting features seem to give me an idea, but I am not
 familiar with ANR keyDispatchingTimedOut and Google doesn't seem to
 be much help. I can debug when I see the error just fine, but I'm not
 sure what information these stack traces are providing me. Is it just
 saying where each thread was when the crash occurred?

 Any help would be greatly appreciated - not just by me, but by a lot
 of my users!

 Dan


 Example Trace:

 ---

 DALVIK THREADS:
 main prio=5 tid=1 NATIVE
  | group=main sCount=1 dsCount=0 s=N obj=0x4001d8c0 self=0xccc8
  | sysTid=27792 nice=0 sched=0/0 cgrp=default handle=-1345017816
  | schedstat=( 184875489 298065182 95 )
  at java.net.InetAddress.getaddrinfo(Native Method)
  at java.net.InetAddress.lookupHostByName(InetAddress.java:508)
  at java.net.InetAddress.getAllByNameImpl(InetAddress.java:280)
  at java.net.InetAddress.getByName(InetAddress.java:310)
  at java.net.InetSocketAddress.init(InetSocketAddress.java:110)
  at java.net.InetSocketAddress.init(InetSocketAddress.java:89)
  at

 org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.init(HttpConnection.java:
 62)
  at

 org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:
 88)
  at

 org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:
 927)
  at

 org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:
 909)
  at

 org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:
 1152)
  at com.xoise.mancala.Mancala.checkUpdate(Mancala.java:186)
  at com.xoise.mancala.Mancala.onCreate(Mancala.java:43)
  at
 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
 1047)
  at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
 2627)
  at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
 2679)
  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
 2033)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4627)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at com.android.internal.os.ZygoteInit
 $MethodAndArgsCaller.run(ZygoteInit.java:868)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  at dalvik.system.NativeStart.main(Native Method)

 SoundPool prio=5 tid=8 NATIVE
  | group=main sCount=1 dsCount=0 s=N obj=0x44779df8 self=0x225b18
  | sysTid=27798 nice=0 sched=0/0 cgrp=default handle=1193848
  | schedstat=( 366211 18005371 4 )
  at dalvik.system.NativeStart.run(Native Method)

 SoundPoolThread prio=5 tid=7 NATIVE
  | group=main sCount=1 dsCount=0 s=N obj=0x44779720 self=0x225148
  | sysTid=27799 nice=0 sched=0/0 cgrp=default handle=1194040
  | schedstat=( 13824466 69000242 13 )
  at dalvik.system.NativeStart.run(Native Method)

 Binder Thread #2 prio=5 tid=6 NATIVE
  | group=main sCount=1 dsCount=0 s=N obj=0x447696c0 self=0x11fd68
  | sysTid=27797 nice=0 sched=0/0 cgrp=default handle=1297576
  | schedstat=( 1434329 7904050 6 )
  at dalvik.system.NativeStart.run(Native Method)

 Binder Thread #1 prio=5 tid=5 NATIVE
  | group=main sCount=1 dsCount=0 s=N obj=0x44764488 self=0x124880
  | sysTid=27796 nice=0 sched=0/0 cgrp=default handle=1198144
  | schedstat=( 3723144 5554199 5 )
  at dalvik.system.NativeStart.run(Native Method)

 Compiler daemon prio=5 tid=4 VMWAIT
  | group=system sCount=1 dsCount=0 s=N obj=0x447632a0 self=0x121930
  | sysTid=27795 nice=0 sched=0/0 cgrp=default handle=1174160
  | schedstat=( 1220703 9277344 4 )
  at dalvik.system.NativeStart.run(Native Method)

 Signal Catcher daemon prio=5 tid=3 RUNNABLE
  | group=system sCount=0 dsCount=0 s=N obj=0x447631e8 self=0x11ede0
  | sysTid=27794 nice=0 sched=0/0 cgrp=default 

[android-developers] Re: HttpURLConnection or HttpClient

2010-09-15 Thread Indicator Veritatis
Yes, we know why. Because Apache's HttpClient (and other closely
assoc. classes in the org.apache.http package) is a much better API
than Sun's own HttpUrlConnection (and the rest of java.net's Http
support). You can do far more work with less code, and it reads much
better too.

So, for example, HttpClient has helper classes that help you deal with
spinning off a worker thread and doing all the waiting on HTTP there;
it is designed to work well asynchronously. Sun's HttpUrlConnection
has nothing of the sort.

That said, you don't get to depart from using java.net entirely. You
should still use it for dealing with URIs and URLs. But not for much
more.

On Sep 15, 2:41 pm, cindy ypu01...@yahoo.com wrote:
 Hi,

 I was told it was prefer to use Apache's library HttpClient, instead
 of java's Http URLConnection. Does any one know why?

 Thanks!

 Cindy

-- 
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: Child activity lifetime in background

2010-09-15 Thread joebowbeer
Have you tried adding alwaysRetainTaskState to your Activity
declaration?

http://developer.android.com/guide/topics/manifest/activity-element.html#always

When this attribute is 'true', users will always return to the task
in its last state, regardless of how they get there.

On Sep 14, 11:40 pm, viktor victor.scherb...@gmail.com wrote:
 Hi,

 I have next problem, I have got parent activity and few sub-
 activities, if app goes to the background by pressed HOME button for
 long time, all children will be killed, and my app restart from parent
 activity.

 For example: A1 - parent, A2,A3,A4 - sub-activities. A1--A2--A3(top), from 
 A3 I go to the background (HOME). wait 30-40 min and

 restart app.

 Only A1 displayed.

 Could you please explain how to resolve my problem?

 Thanks

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


[android-developers] Droid Losing Values When I Load Image Picker

2010-09-15 Thread GregAZ
I have an Android app that is mostly a WebView except for a few
things.  One of them is uploading pictures.

After the user picks an image I get the filepath and pass that along
with the webview's url to a new method in a new thread.

For some reason, in the onActivityResult method I can't get the value
from the webview to know what page they're on.  It's null.  It works
on my HTC Hero (2.1), just not on Droid's.(those are the only users
with the problem).

I've tried setting a global variable to the url before showing the
image picker, but when I try to read it in the onActivityResult method
it's just an empty string.  On my HTC Hero it still has the value.

I need the url so where can I put it where it won't get lost on Droid
phones?  This is all in an Activity.

-- 
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: shared library so size versus apk size

2010-09-15 Thread Chris Stratton
An apk is a zip file (try opening it as one) so the .so is stored
inside it compressed.

The savings from removing the apk would count both the compressed apk
and any parts of it that get uncompressed during installation, such as
shared libraries and the dexopted version of the class file.

pgil wrote:
 I would like to know why the size of my shared library .so is bigger
 than my .apk file generated with Eclipse? Approximatly the so size is
 twice the apk one. What is strange is after having installed it in the
 device (2.1 firmware) I checked the size of the apk when I uninstalled
 it from the device and surprisingly the apk size indicated is bigger
 even than the .so one. Is there any explaination 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


RE: [android-developers] ACTION_IMAGE_CAPTURE intent

2010-09-15 Thread lloyd
That is also a part of my problem. I am running in debug mode. I can see the
disconnect message in the debug window occur the instant I take the picture.
However Activity 3 ( the one that fired the ACTIVITY_IMAGE_CAPTURE gets the
result and finishes up nicely. When that task terminates, I get the dreaded
FC on the device. It should be noted that after the Disconnect message
appears, even though I have several breakpoints set in Task 3 including at
the very beginning of the onActivityResult(), none of them is taken,
presumably because the debugger has been disconnected?

 

BTW I can tell that Task 3 is finishing properly even though the breakpoints
are not being taken. You see one of the last things that Task 3 does in it's
onPause() is to save the path to the new picture in the database. When I
restart after the FC, the proper image is always present. It is as if
something goes haywire and even causes the debugger to get disconnected. I
guess that is what the Disconnect from local host means

 

Again I point out that I can do iterations all day as long as I do not use
the camera feature. However the instant that I use the Camera feature the
App runs into trouble as soon as the Shutter is clicked on the phone.

 

THANKS MUCH FOR RESPONDING. 

 

  _  

From: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] On Behalf Of Frank Weiss
Sent: Wednesday, September 15, 2010 7:26 PM
To: android-developers@googlegroups.com
Subject: Re: [android-developers] ACTION_IMAGE_CAPTURE intent

 

I'll compare this with similar code I have running, but meanwhile, could you
run in debug and give the stack trace or at least identify the exception.
That should also give you the line number in your code.

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

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

[android-developers] Re: ADT master version

2010-09-15 Thread Indicator Veritatis
On Sep 15, 11:28 am, Xavier Ducrohet x...@android.com wrote:
 On Wed, Sep 15, 2010 at 3:43 AM, Indicator Veritatis mej1...@yahoo.com 
 wrote:
  Do I really have to explain something so elementary? 8 is not the
  same as 8.0.0 is not the same as 8(.0.0). So yes, you did make it
  more confusing instead of less.

 You are seriously confused indeed.

Thanks to your own careless wording, yes. But that was and still is my
point. You are making it more confusing, not less, even now, though
this latest post of yours is a considerable improvement.

 Tools r8 will ship with ADT 8.0.0. The version that comes after will
 be Tools r9 with ADT 9.0.0, and then r10 and ADT 10.0.0, etc...
 Since both are meant to work together, it seems to me like it's a
 pretty straight forward versioning scheme.

Your wording this time does make it more clear, yes. But what remains
not at all straight forward is what you think to achieve by
numbering the Tools in an rn format, where n is an integer, but
numbering the things -in- the Tools with n.0.0. What will you ever
use the other two digits for, if new versions are only released with
an entire new Tools release, which is always numbered with an integer?
Or have you simply forgotten to use the terms minor revision number
and major revision number? Did you really mean to say the the -
major- revision number of each tool will match the revision number of
the entire Tools package?

 When we release r8 we will
 clearly explain this new scheme so that users know what to expect.

That will be a welcome improvement, I am sure.


 I fail to see how it's more confusing that previous releases of r7
 with ADT 0.9.8, r6 with ADT 0.9.7, etc... where the ADT version was
 completely unrelated to the SDK tools revision number.

It is more confusing because in the earlier scheme, we knew it was
unrelated. But with the incomplete and poorly worded explanations you
gave to date of the new scheme, it was clear that there was a
relationship, but with the apparently superfluous extra digits, it was
not clear whether that relation was really meant to be identity,
forever kept in lockstep.

  For that matter, are they sharing the same version number, or the same
  API level? The version number is 2.2, the API level 8. Based on what
  you have said so far, it sounds like you are using the API level as
  the version number for the tools, which is not the same as making all
  tools and plug-ins share the same version number.

 What are you talking about? Tools don't have an API level, so there's
 certainly none to share between the SDK Tools and ADT, and, obviously,
 the API level for the platform has *nothing* to do with revision
 number for the tools!

No, it is not obvious that it has -nothing- to do with it. Especially
not when both happen to be '8'. That could be coincidence (as you now
confirm that it is), but without the further information you now
supply, we had no way of -knowing' that. For all we knew, you could
have decided that in the future, you would release new versions of the
Tools only with new version of the API also. That is hardly more
arbitrary than deciding that you will release new versions of any tool
only with a new version of the whole Tools package.

-- 
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: Loading raw resource text file hang...

2010-09-15 Thread Mystique
Right, it was suppose to be:

while ((strLine = dataIO.readLine()) != null) {
sBuffer.append(strLine + \n);

I don't know why it was change. Thanks you guys.

On Sep 16, 3:18 am, DanH danhi...@ieee.org wrote:
 And, of course, DataInputStream.readLine is deprecated.

 On Sep 15, 1:53 pm, Mystique joven.ch...@gmail.com wrote:



  Hi, I use this method couples of occasion to load text file to display
  as help file.
  But I don't know why the following code didn't work. It seems to hang
  and logcat says OutOfMemoryError?

  All I did was break this out as an separate activity...
  Can anyone help me to catch the problem?

  ---xml---
  ?xml version=1.0 encoding=utf-8?
  ScrollView xmlns:android=http://schemas.android.com/apk/res/android;
          android:id=@+id/helptab
      android:orientation=vertical
      android:layout_width=fill_parent
      android:layout_height=fill_parent
  TextView
          android:id=@+id/helptext
      android:layout_width=fill_parent
      android:layout_height=wrap_content /
  /ScrollView

  ---code---
  import java.io.DataInputStream;
  import java.io.IOException;
  import java.io.InputStream;

  import android.app.Activity;
  import android.os.Bundle;
  import android.widget.TextView;

  public class Help extends Activity {
      /** Called when the activity is first created. */
      @Override

      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.help);

          InputStream iFile =
  getResources().openRawResource(R.raw.help);
          try {
              TextView helpText = (TextView)
  findViewById(R.id.helptext);
              String strFile = inputStreamToString(iFile);
              helpText.setText(strFile);
          } catch (Exception e) {
          }
      }

      public String inputStreamToString(InputStream is) throws
  IOException {
          StringBuffer sBuffer = new StringBuffer();
          DataInputStream dataIO = new DataInputStream(is);
          String strLine = ;
          while ((strLine = dataIO.readLine()) != ) {
              sBuffer.append(strLine + \n);
          }
          dataIO.close();
          is.close();
          return sBuffer.toString();
      }

  }

-- 
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: notification..!

2010-09-15 Thread Indicator Veritatis
As close as possible to a Windows Registry, and not very close, is it?
All it has in common with the Windows Registry is that it is a
searchable, editable list of properties, i.e., name-value pairs. No
system-wide standard for naming keys, no hierarchical organization, no
predefined root keys...

Really, in order to answer the OP's real question, we need to know
what he is trying to do, that he thinks he needs a Windows-style
Registry to do it.

On Sep 15, 9:26 am, Kostya Vasilyev kmans...@gmail.com wrote:
   This:

 http://developer.android.com/guide/topics/data/data-storage.html#pref

 is as close as you can get to Windows Registry. Persistent storage for
 small amounts of data, accessed by string keys.

 -- Kostya

 15.09.2010 20:07, Pent пишет:

  I want to store information in the registry
  What registry?
  I think he wants to get married ?

  Pent

  p.s. Rubin, there is no central registry in Android

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget 
 --http://kmansoft.wordpress.com

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


[android-developers] Re: Choosing background for Live Wallpaper.

2010-09-15 Thread Joel Duggan
Here's an update on where I am with this.  I have to say it's pretty
hackish and I'm not proud of it but it works, sorta.

I created a Preference in my Settings dialog to choose the background.  From
the callback I call 'startActivityForResult' with
the Intent.ACTION_SET_WALLPAPER.

This launches the default wallpaper chooser allowing the user to select
whatever they want for the wallpaper, with the caveat that the Live
Wallpapers shows up also, which I don't want.

In the 'onActivityResult' callback i check for RESUT_OK and do the
following:
- Get an instance of the wallpaper manager.
- Get the drawable from it.
- Turn it into a BitmapDrawable and write it to a private file (for
persistence) also storing it in a variable.
- During my regular draw function I draw that to the canvas and then draw my
overlay.

On startup of my wallpaper I check if the file exists.  If it does then I
read it into my bitmap variable and continue as normal.
If it doesn't exist then I get the wallpaper drawable and do the same things
as above (file, variable).

This works wonderfully for most situations.  But it breaks horribly when the
user selects a live wallpaper in my settings dialog.

In the Emulator things keep working.  My 'onActivityResult' gets a
RESULT_CANCEL event and nothing changes for me.  I'm able to back out of the
settings screen and continue no problem.

On my device however (HTC Desire w/ 2.1) it crashes the phone when I select
a live wallpaper from within my settings.

Why the discrepancy between the two?  The only difference that I can tell
between the two is that my device has more live wallpapers installed.

What can I do?

Can I detect that a live wallpaper was selected and handle it differently?
I didn't debug the app on my phone so I don't know exactly what was
happening.

My exact call to start the activity looks like this:

private void startWallpaper() {
   final Intent pickWallpaper = new Intent(Intent.ACTION_SET_WALLPAPER);
   startActivityForResult(Intent.createChooser(pickWallpaper,
getString(R.string.rain_background)),REQUEST_PICK_BACKGROUND);
}

The Live wallpaper chooser has two intents; ACTION_SET_WALLPAPER
and ACTION_LIVE_WALLPAPER_CHOOSER.  Is there a way, when I call
Intent.createChooser to filter out based on an intent even though an item
matches another intent?

If not then Google seriously needs to give us this.

Not sure what to do next.

I'm so close I can feel it.

Joel


On Thu, Sep 9, 2010 at 2:11 PM, JoelDuggan joeldug...@gmail.com wrote:

 Hello all,

 I've asked this question twice already but it didn't seem to get
 posted.  I don't know if it just takes a while for the moderators to
 approve or if it got lost so I'll try again.

 I'm writing a live wallpaper that creates an effect over a
 background.  I want the user to be able to choose the background from
 any of the system wallpapers and camera photos.  What I would like is
 for the user to be able to press a button in the Settings menu, have
 the list of options show up just like setting the wallpaper from the
 home screen, minus the Live Wallpapers options.  Once the user
 navigates the choices and picks an actually image I would load it to
 my canvas.

 How do I do this?

 I can't find an API anywhere for getting a list of wallpapers.

 I've been able to come up with a list of wallpaper providers using
 Intents.  I then get a list of live wallpaper providers also using
 Intents and remove those from my first list.  The gives me a list of
 wallpaper providers that are not live.

 Now what?  Are there other ways to do this that I'm missing?

 Please help.

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

[android-developers] how do I load an image for a softkeyboard

2010-09-15 Thread Saied
Hi,

I am trying to develop a softkeyboard, which uses and image, senses
the onTouch events, and sends characters to the input stream.

So I have created the essentials of the keyboard and I want to load an
image. Here's what I do:


public class mekb extends InputMethodService   implements
View.OnTouchListener {

  @Override public void onCreate() {
super.onCreate();
}

   @Override public View onCreateInputView() {
return (KeyboardView)
getLayoutInflater().inflate(R.layout.main, null);
}
}

And this is what I have in my layout/main.xml (essentially an image
view on the bottom of the screen)

?xml version=1.0 encoding=utf-8?
RelativeLayout
android:id=@+id/widget79
android:layout_width=fill_parent
android:layout_height=fill_parent
xmlns:android=http://schemas.android.com/apk/res/android;

ImageView
android:id=@+id/widget93
android:layout_width=wrap_content
android:layout_height=200px
android:src=@drawable/english_uppercase
android:layout_alignParentBottom=true
android:layout_alignParentLeft=true

/ImageView
/RelativeLayout

This loads and let me select the softkeyboard, but errors and stops
when I invoke the keyboard.

Is this how to load an image and return it in onCreateInputView()?

 @Override public View onCreateInputView() {
return (KeyboardView)
getLayoutInflater().inflate(R.layout.main, null);
}


Any help, hint or pointer is much 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: HttpURLConnection or HttpClient

2010-09-15 Thread cindy
How about speed? which one is fast?

On Sep 15, 5:59 pm, Indicator Veritatis mej1...@yahoo.com wrote:
 Yes, we know why. Because Apache's HttpClient (and other closely
 assoc. classes in the org.apache.http package) is a much better API
 than Sun's own HttpUrlConnection (and the rest of java.net's Http
 support). You can do far more work with less code, and it reads much
 better too.

 So, for example, HttpClient has helper classes that help you deal with
 spinning off a worker thread and doing all the waiting on HTTP there;
 it is designed to work well asynchronously. Sun's HttpUrlConnection
 has nothing of the sort.

 That said, you don't get to depart from using java.net entirely. You
 should still use it for dealing with URIs and URLs. But not for much
 more.

 On Sep 15, 2:41 pm, cindy ypu01...@yahoo.com wrote:

  Hi,

  I was told it was prefer to use Apache's library HttpClient, instead
  of java's Http URLConnection. Does any one know why?

  Thanks!

  Cindy

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


[android-developers] how to list files on SD card

2010-09-15 Thread cindy
Hi all,

 My application needs to do some clean up. I need to list the files
such as   ls voice*.amr, and then delete those files. How could I do
it in Android?

Thanks !

Cindy

-- 
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


Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Dhrumil Shah
Hey Frank,

Then you told me what do I do??

~Dhr

On Thu, Sep 16, 2010 at 12:43 AM, Frank Weiss fewe...@gmail.com wrote:

 I see a couple of issues with your code.

 1) The location variable set in the following line does not appear to be
 used anywher:

 Location location = locationManager.getLastKnownLocation(provider);

 2) Are you trying to send an intent to the Maps or Browser app, of handle
 the location display yourself? In one place the code has:

 startActivity(new Intent(Intent.ACTION_VIEW, uri));

 yet in another line, the code goes:

 canvas.drawBitmap(bitmap, myScreenCoords.x, myScreenCoords.y, paint);

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


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

[android-developers] Uploading file through HTTP Post

2010-09-15 Thread perumal316
Hi All,

I am writing an application to upload a file from Android phone to a
web server.

I have tried the example from:

http://www.anddev.org/novice-tutorials-f8/doing-http-post-with-android-t492.html

But it will only work for SDK 1.0 (why? Not Sure?).

Can this be done for Android 2.1? Or is there any other method to load
a file from Android to a webserver?

Thanks In Advance,
Perumal

-- 
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


Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Frank Weiss
I want to help you, but I don't clearly understand what you want to do.

I thought you want to to display a mark on a map from the latitude and
longitude a user entered in two text fields. But I don't understand if you
want to display that on a MapActivity in your app or in another app.

One thing that may help is if you try to display a mark on a map foir a
given latitude and longitude instead of from a user's input. Have you been
able to do that successfully?

-- 
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: Any way to animate a 2D Game Smooth without OpenGL ?

2010-09-15 Thread Jason
OK.. so the important point in the two-threads theory is that the
work IS done concurrently.

The GameThread does all the calcs for the next frame WHILE the render
thread is rendering the previous frame.  So that you don't modify game
objects while the render thread is rendering, you separate the concept
of a game object from a render object.  So you basically have two
objects representing things in your game world.  One is responsible to
maintaining the state of the relevant game element, the other is JUST
responsible for drawing.  So in your case you would split your current
object (that has the update and draw methods) into two objects.

The GameThread updates the state-based object (the one with the update
method) and the render thread just draws the render object.

When the GameThread has updated all objects for the next frame, it
waits until the previous frame has completed, then locks the render
thread while it updates all the renderable objects.  So basically you
loop through all the game objects and set the x,y coordinates etc of
the corresponding render object.

This means you are only pausing the render thread for as long as it
takes to loop through the objects and essentially just copy a few
floats across.  This should be super quick.

In terms of storage.. that is, how do you maintain a List of objects
(in both the render thread and game thread), again I took a lot from
the Replica Island example.  Chris Pruett has a thing called a
FixedSizeArray which he uses to avoid memory allocations at run
time.  I didn't end up using this and wrote my own, but basically the
idea is that you allocate an array up front, and never change it's
size.  I just have a global variable which tells me the MAX_SPRITES I
will ever have (currently at 300 I think).. so at game launch I create
an array of size 300.  My implementation is wrapped in a bunch of
logic so that I can use it like a list (ie add/remove/delete etc) but
actually all it's doing is setting indexes in the fixed size array (or
setting them to null to remove).  I then have the concept of an
iterator which knows how to loop over the array (avoiding nulls etc),
and can be created in a ThreadLocal to allow concurrent access from
multiple threads.

Skype chat is ok.. but what timezone are you in?  I'm GMT+10
(Australian Eastern Standard Time).





On Sep 16, 6:53 am, Andreas andreas.k...@googlemail.com wrote:
 Hey Jason,

 thank you so much for the Feedback. I would love to  see your game
 skeleton, to see how you solve some common problems. Or how you store
 and iterate your gameObjects.

 In My case every GameObject, like a Missle or Enemy has update(long
 difftime) and draw(Canvas c) method implemented. In the game thread
 the thread iterates over all objects and updates them (via update) and
 after that the Thread iterates over all Gameobjects an calls the draw
 method.

 Basically i don't see the big advantage to separate those to Methods
 in 2 Threads- because at the end draw() is called after update() -
 (while true)-  if you have 2 threads you kind of loop over 2 threads.
 because 1 is started, finished, stops, starts thread 2, finishes,
 starts thread 1

 I you can spare some time i would be very thankful to maybe have a
 Skype or TeamSpeak Chat  with you =)

 On 15 Sep., 15:34, Jason jason.poli...@gmail.com wrote:



  Hi Andreas,

  Sorry to jump in late, but I thought I'd share my experiences with non-
  opengl on Android.

  I have a game engine which uses both open gl and the canvas system
  depending on the device capabilities (some devices, like HTC Tattoo
  have software implementations of opengl which is actually slower than
  canvas).  I get reasonable performance from the canvas api, but the
  important thing is that the bottle-neck has always been draw speed and
  nothing else.

  I pretty much followed the replica island approach whereby I have two
  threads, one which just draws and the other where all the game calcs
  are done.  My game thread routinely outperforms my render thread, but
  I am drawing quite a lot so this may not be everyone's experience.

  I'd say you do have a slight architectural flaw in that (it appears)
  that your game logic is being computed in the same thread as the
  rendering.  This means that the render thread has to wait each frame
  for the game to update state.  It's much better to separate these
  two.  Have your game logic updated in a separate thread, then just
  notify the render thread when it's time to draw (you can do this by
  sending a message to your surface view using a Handler and then
  invalidating the canvas).

  Basically what I do is this:

  I have a separation of game objects, and renderable objects.  A game
  object is the real representation of the in-game element (eg the
  player).  The renderable object is simple a set of x,y coords, plus
  scale, rotation etc and a reference to the image that represents the
  sprite (I have some more logic to include sprite animations 

[android-developers] Can we customize spinner dialog

2010-09-15 Thread Karteek N
When we select spinner it shows a display of  items which almost the device
screen size

Can we minimize its width or height, I think this question was already
posted by some one. But i am unable to find solution

Thanks,
Karteek

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

[android-developers] How to get android version programmtically

2010-09-15 Thread Jiang
Hello, guyes.

I need to get android version programmtically  dynamically when my application 
is running on device. 

I tried android.os.Build.Version, but it doesn't exist in Android sdk 1.6.

How to get android version?

Thanks.
Jiang



  

-- 
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

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Dhrumil Shah
I thought you want to to display a mark on a map from the latitude and
longitude a user entered in two text fields. But I don't understand if you
want to display that on a MapActivity in your app or in another app.
- I want to display that  on a MapActivity in my app. Not in another
activity.


One thing that may help is if you try to display a mark on a map foir a
given latitude and longitude instead of from a user's input. Have you been
able to do that successfully?
- Yes, I tried with that also. Firstly, I entered hardcore values in the app
of latitude and longitude. Its working.
But everytime we have to change it for different locations. Thats why I put
EditText and button so user can enter its own latitude and longitude.

~Dhr.

On Thu, Sep 16, 2010 at 9:27 AM, Frank Weiss fewe...@gmail.com wrote:

 I want to help you, but I don't clearly understand what you want to do.

 I thought you want to to display a mark on a map from the latitude and
 longitude a user entered in two text fields. But I don't understand if you
 want to display that on a MapActivity in your app or in another app.

 One thing that may help is if you try to display a mark on a map foir a
 given latitude and longitude instead of from a user's input. Have you been
 able to do that successfully?

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


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

Re: [android-developers] Can we customize spinner dialog

2010-09-15 Thread Shashidhar
Yes, You can do it. While setting the dropdownviewresource for the adapter
of your spinner, define your own xml layout instead of the android's inbuilt
resource xml. Your xml can simply have a textview with your required layout
parameters.

-Shashidhar

On Thu, Sep 16, 2010 at 9:55 AM, Karteek N kartee...@gmail.com wrote:

 When we select spinner it shows a display of  items which almost the device
 screen size

 Can we minimize its width or height, I think this question was already
 posted by some one. But i am unable to find solution

 Thanks,
 Karteek

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

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

[android-developers] How to do this correctly in SQLite?

2010-09-15 Thread Mystique
Hi,

I want to insert a String value call temp but I don't seems to get it
working for the INSERT INTO statement.
Anything wrong with the code?

This is the initialization to create table and insert some default
values into the table if the database doesn't exist.

Many Thanks.

---code---
  @Override
   public void onCreate(SQLiteDatabase db) {
  db.execSQL(CREATE TABLE  + TABLE_NAME +  ( + _ID
+  INTEGER PRIMARY KEY AUTOINCREMENT,  + FIELD1 + 
VARCHAR(1),  + FIELD2
+  TEXT,  + FIELD3 +  TEXT,  + FIELD4 +  TEXT,  +
FIELD5 +  TEXT););

  String tmp = temp;
  db.execSQL(INSERT INTO  + TABLE_NAME +  VALUES (0 'A',
'Hello', '',  + temp + , ''););
   }
---code---

-- 
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


<    1   2   3