[android-developers] Workaround for Package Installer bug
Hello, I'm trying to find a workaround for the following bug: http://code.google.com/p/android/issues/detail?id=5277 Short summary: installing an application from a .apk file and then running it with the 'Run' button in the Package Installer will cause the application to run subtly wrong, which can cause attempts to run the application to create multiple copies of the activity instead of resuming an existing instance. This is a very serious problem for us: our application is being distributed off-Market, so our users will see this workflow frequently. Can anyone suggest anything we can do to avoid the problem? Even something as crude as a way of suppressing the 'Run' button in the Package Installer would be fine. I've been trying to find out exactly what's going wrong, but not having much luck. The only difference I've seen is that the Home Screen starts my app with this: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x1020 cmp= bnds=[98,227][172,327] } ...and the Package Installer starts it with this: Intent { act=android.intent.action.MAIN flg=0x1000 cmp= } 0x20 is FLAG_ACTIVITY_RESET_TASK_IF_NEEDED; 0x1000 is FLAG_ACTIVITY_NEW_TASK. Any ideas? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] glReadPixels() crashes on the HTC Desire
I appear to have found a bug in the Adreno 200 OpenGL driver which is used on the HTC Desire (among others). Specifically, if you're using a 32-bit config, and you call glReadPixels(), it crashes. I've got a bug containing a test case here: http://code.google.com/p/android/issues/detail?id=10825 I've tried this on two different kinds of device with the same OpenGL driver and it dies reliably on both --- but on a third device with a different driver it succeeds. It's interesting to note that the Khronos OpenGLES conformance tests use glReadPixels() a lot to check that the tests drew the right thing on the screen; which suggests that this driver never managed to pass the conformance tests in the first place... -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
Re: [android-developers] Create new process
On 29/07/10 12:37, Mark Murphy wrote: [...] > You're saying you want to use *several processes* for one app? Not > one, not two, but many? That is correct. It's an environment for running alien applications; each application goes in a process, but they're all instances of the same activity. Believe me, using multiple processes is the correct solution in this case. Does anyone know how to do this? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Create new process
In order to keep some native code happy, I need to launch an activity in a new process. Does anyone know how to do this? I can set the activity's process attribute in the manifest, but this will cause *all* instances of the activity to appear in the *same* process, which I can't have. I'm willing to use internal APIs for this, and I've found Process.start(), but it's not at all clear how this is supposed to be used. Can anyone shed light on this? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Instantiating activities into a new task and process
I have an application with a multi-instance activity. I would like each instance of the activity to appear in a *new* task and process. Does anyone know how to do this? By manipulating the manifest I can cause *all* instances of the activity to appear in a specific task and process, but I haven't found any way to cause each instance to appear in a *different* task and process. (The requirement to have different tasks is that we want each instance of the activity to appear separately in the task list; the requirement for different processes is that each instance of the activity is backed by a chunk of native code with global state. We can't change either of these.) -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
Re: [android-developers] Re: INTENT_SEND and attached files
On 27/07/10 07:34, FrankG wrote: [...] > When I read your email it sounds for me that you are able to adapt > the email app on your platform. No. I'm looking at the email app source code to try and figure out how this whole area works, as it's largely undocumented. I don't have the ability to modify it. > If no, then the whole discussion makes no sense in my eyes because you > have no choice anyway ? I have no choice but I don't know what the choice is! Hence my message. My requirements are pretty straightforward requirement --- I wish to send a message with an attachment; the attachment data is generated by code; I don't want to write the data to a temporary file because the email app doesn't tell me when it's finished with the file; how can I do this? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] INTENT_SEND and attached files
My app wants to send a data file by email. However, the data only exists inside the database. There is no physical file containing it. In order to make it possible to send this using INTENT_SEND, I need to return a file descriptor in ContentProvider.openFile(). This means I need to write my data out to a temporary file on disk somewhere so I can open it to get a real file descriptor. However, the email app doesn't necessarily use the file immediately, and *doesn't tell me* when it's finished with it, so I don't know when to remove the temporary file. As the file is likely to be quite large I don't want to keep it around for long periods. What I'd really like to do is to be able to avoid the whole issue by using a callback to synthesise the data as and when the email app needs it, using some sort of pipe. Unfortunately due to the real file descriptor requirement I can't use Java pipes, there are no Unix fifo APIs that I can find, and you can't create a ParcelFileDescriptor from a Unix socket, which was my other option. Is there any easy way to do what I want, or do I need to start messing around with TCP sockets? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Send/receiving files via Bluetooth
I would like my application to be able to send and receive files via OBEX on Eclair. We have our own IANA MIME type. My investigations of the (undocumented) Bluetooth APIs seem to suggest that Eclair is hard-coded to only allow transfers of images, audio and video. From the Bluetooth package manifest: ...and from the OBEX server itself: public static final String[] ACCEPTABLE_SHARE_INBOUND_TYPES = new String[] { "image/*", "video/*", "audio/*", "text/plain", "text/html", }; Is this true? If so, is there any way around this restriction? Our MIME type is "application/...", so unless we can somehow persuade the system to handle other MIME types, we're pretty much stuffed. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
Re: [android-developers] Re: TelephonyManager.getLine1Number() returning null?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/05/10 12:48, Mark Ellul wrote: > I was informed that its a SIM issue, and that some SIM cards do not > store the telephone number in the appropriate way to retrieve the > number That's what I originally thought, but as I said, Settings->About Phone *is* returning the correct phone number. Something on the phone must be able to determine it. > On May 5, 1:32 pm, Vinay S wrote: >> Hi David, >> >> I think you are trying to use TelephonyManager.getLine1Number(); >> >> Instead create an object of the TelephonyManager and then call the >> getLine1Number(); We're already doing that --- here's the code: TelephonyManager tm = (TelephonyManager) _context.getSystemService(Context.TELEPHONY_SERVICE); return despace(tm.getLine1Number()); (_context is our activity, despace() is a function that removes spaces from a string.) As I said in my original message, the code *works*. It just always returns null. So it's not a compilation problem. - -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvhnagACgkQf9E0noFvlzg47ACeK9J4jSzgraXTWAAtD+M7BjEi 2zgAoLlHl3NRP1MdLFdCCrDtQeE9i6dh =pS74 -END PGP SIGNATURE- -- 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] TelephonyManager.getLine1Number() returning null?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 28/04/10 14:27, David Given wrote: [...] > I'm trying to fetch the telephone number of the device. I'm calling > TelephonyManager.getLine1Number(), and it's returning null. > > A trawl of the intertubes shows that there's a potential problem with > some SIMs not containing this information; however, Settings->About > Phone->Status *does* show the correct phone number, so this isn't it. > > Looking at the code, it appears that Settings isn't using > TelephonyManager to retrieve the phone number. Instead it's using > com.android.internal.telephony.Phone, an internal API, to do this; so > obviously this is working, where TelephonyManager is not. > > Can anyone shed any light on this, and hopefully suggest how I can > correctly fetch the phone number? Does anyone know anything about this? - -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvhTh0ACgkQf9E0noFvlzjo4ACfTvvkmZS+bx4qbSGdhFXe/Odw UAcAoL/HYT59nnVL86s6sNymD6wlklEs =MTvd -END PGP SIGNATURE- -- 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.getLine1Number() returning null?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm trying to fetch the telephone number of the device. I'm calling TelephonyManager.getLine1Number(), and it's returning null. A trawl of the intertubes shows that there's a potential problem with some SIMs not containing this information; however, Settings->About Phone->Status *does* show the correct phone number, so this isn't it. Looking at the code, it appears that Settings isn't using TelephonyManager to retrieve the phone number. Instead it's using com.android.internal.telephony.Phone, an internal API, to do this; so obviously this is working, where TelephonyManager is not. Can anyone shed any light on this, and hopefully suggest how I can correctly fetch the phone number? - -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvYN9wACgkQf9E0noFvlzg6WwCgmyZDbGV1IqqnIUTUBxjtgmUZ YL8An2mrVxtNy+i8kjeFniytTIY8UYvP =6p5u -END PGP SIGNATURE- -- 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: Detect/intercept screen turning off
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dianne Hackborn wrote: > Also you definitely do get paused when the screen is turning off, so you > really should be able to fix things by doing whatever you need to there. What I'm trying to do is to work around bug 3755: http://code.google.com/p/android/issues/detail?id=3755 OpenGL apps don't get notified of surface destruction when the screen turns off, which means they try to render onto an invalid surface, which means the GL system gets itself knotted up and shifts into a state where it won't work any more. We do get onPause() when the screen turns off, but unfortunately it's sometimes too late (there appears to be a race between surface destruction and the onPause() being delivered). It just so happens that with apps using GLSurfaceView this mostly works, and with our app (which doesn't use GLSurfaceView) it mostly doesn't work! Testing for ACTION_SCREEN_OFF is a reasonable workaround --- it allows me to distinguish between the application being paused because it's being backgrounded (which works correctly) and the application being paused because the screen's being turned off (which doesn't); but because it's arriving after the onPause(), it's still arriving after surface destruction, which means it's too late to save the app, so all I can really do is quit. But that's way better than crashing --- thanks! (What I'd really like to do is to be able to detect the screen turning off *before* it actually does so, so I can switch to a different activity and therefore artifically force a paused-due-to-backgrounding event. Unfortunately I don't think any such event gets delivered.) - -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "Under communism, man exploits man. Under capitalism, it's just the │ opposite." --- John Kenneth Galbrith -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFLEl8rf9E0noFvlzgRAlPRAKCjegDGvhGmko4osetZnWvMddp0mwCgnKNX a8v790x7bO1nr/utrZRnFHY= =Y/He -END PGP SIGNATURE- -- 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] Detect/intercept screen turning off
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is there any way where I can detect that the screen is about to turn off, so I can do some work *before* it happens? I need this to work around bug 3755: OpenGL apps sometimes crash when the screen gets turned off because they don't get surfaceDestroyed()/surfaceCreated() events. http://code.google.com/p/android/issues/detail?id=3755 Simply put, I need to shut down OpenGL before the phone has a chance to detach the GPU. The only events I seems to be getting when the screen turns off are onPause() and onWindowFocusChanged()... both of which turn up *after* the GPU detaches, by which time it's too late. Can anyone suggest any way of doing this? (In desperation, I have tried to intercept the power key, but the power/hangup key is treated specially and doesn't generate keyboard events...) - -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "Sufficiently advanced incompetence is indistinguishable from │ malice." -- Vernon Schryver -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAksPvFIACgkQf9E0noFvlzioGACfW5r72xNXqykHvSu4SocKo0bw rlkAoLNa6NZiWgczIBHtLmgJmzFZLiaR =HOwY -END PGP SIGNATURE- -- 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] No surfaceCreated() callback after phone wakes up
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I've got an OpenGL game with a SurfaceHolder being used to manage the screen. If I use the HOME button to temporarily switch away from the game, I see the following sequence of callbacks: Press HOME -> onPause() surfaceDestroyed() onStop() Switch back to app -> onStart() onResume() surfaceCreated() This all seems normal. However, when I press the HANGUP button to switch the screen off, and then wake up the phone, I get the following: Press HANGUP to turn screen off -> onPause() surfaceDestroyed() Press HANGUP again to screen on, going to the screen lock page -> onResume() Deactivate screen lock, switch back to game -> nothing! Not only am I not informed that my application has become visible again, but I'm never informed that my surface has been created so I can start drawing on it again! Anyone know what's going on here? - -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "Sufficiently advanced incompetence is indistinguishable from │ malice." -- Vernon Schryver -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAksNKVgACgkQf9E0noFvlzh+6ACgiDklIyvPy+BWz/rWqvQStcsz Fx0AoJyw8ZEQCDvdcSgV0iIP4XukMklD =ijtu -END PGP SIGNATURE- -- 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: Securing a paid app
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 jax wrote: [...] > How would I go about generating the hash code? I am intending on > using the ime. If you're in the UK and you want to keep track of customers' IMEIs, you may need to get legal advice --- there's a good chance you'll be liable under the Data Protection Act (as you're storing personally identifiable information). - -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "Sufficiently advanced incompetence is indistinguishable from │ malice." -- Vernon Schryver -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAksKqO8ACgkQf9E0noFvlzjDQgCgrXFzamiu5EX6agg7NFI7OKiz BUEAn1CMcFfWIro+V8E7RtbDMF3rPqLa =KH5U -END PGP SIGNATURE- -- 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] EGL and surface destruction
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David Given wrote: [...] > I have an application that uses EGL. It creates an EGLSurface in the > normal manner, draws on it, etc. Then the user presses the HOME button. > > The EGL spec says this: > >> Following a power management event, calls to eglSwapBuffers, eglCopy- >> Buffers, or eglMakeCurrent will indicate failure by returning EGL FALSE. The >> error EGL CONTEXT LOST will be returned if a power management event has oc- >> curred. >> On detection of this error, the application must destroy all contexts >> (by calling >> eglDestroyContext for each context). To continue rendering the application >> must >> recreate any contexts it requires, and subsequently restore any client API >> state and >> objects it wishes to use. >> Any EGLSurfaces that the application has created need not be destroyed >> following a power management event, but their contents will be invalid. > > I would expect that my app detaching from the screen to be considered > this sort of power management event. > > However, Android doesn't do this. Instead what happens is that it calls > my SurfaceHolder.Callback.surfaceDestroyed() method and then nukes the > surface without telling me. The Android docs say this: Does anyone know anything about this? This is becoming a very serious issue for us --- Android's support for EGL_CONTEXT_LOST appears to be just plain broken in a lot of places. Specifically, once it's in a dead context state, all operations fail --- including calls to eglCreateContext(), which we need to call to get it working again! Not to mention that eglGetError() always returns EGL_CONTEXT_LOST and never resets to EGL_SUCCESS, which violates the spec. One we get a dead context, how can we get EGL back up and running again? - -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "Sufficiently advanced incompetence is indistinguishable from │ malice." -- Vernon Schryver -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAksKgggACgkQf9E0noFvlzh4owCffic+r4RZUGwWo/2wjh3Tn6JR bVwAoMSdQkx7fuBm5aEqTElp+FkP26vX =0ZgR -END PGP SIGNATURE- -- 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] EGL and surface destruction
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have an application that uses EGL. It creates an EGLSurface in the normal manner, draws on it, etc. Then the user presses the HOME button. The EGL spec says this: > Following a power management event, calls to eglSwapBuffers, eglCopy- > Buffers, or eglMakeCurrent will indicate failure by returning EGL FALSE. The > error EGL CONTEXT LOST will be returned if a power management event has oc- > curred. > On detection of this error, the application must destroy all contexts (by > calling > eglDestroyContext for each context). To continue rendering the application > must > recreate any contexts it requires, and subsequently restore any client API > state and > objects it wishes to use. > Any EGLSurfaces that the application has created need not be destroyed > following a power management event, but their contents will be invalid. I would expect that my app detaching from the screen to be considered this sort of power management event. However, Android doesn't do this. Instead what happens is that it calls my SurfaceHolder.Callback.surfaceDestroyed() method and then nukes the surface without telling me. The Android docs say this: > This is called immediately before a surface is being destroyed. After > returning from this call, you should no longer try to access this > surface. If you have a rendering thread that directly accesses the > surface, you must ensure that thread is no longer touching the Surface > before returning from this function. It doesn't explicitly mention what happens to the EGLSurface attached to the Surface that's been destroyed, but it appears to stop working --- I've certainly spotted calls to eglSwapBuffers() just hang, with these messages being produced: W/SurfaceComposerClient( 297): lock_layer timed out (is the CPU pegged?) layer=2, lcblk=0x4235c120, state=0043 (was 0043) This is a big problem for me. My (third party, can't change) renderer ist rendering in a different thread, and is expecting EGL to behave according to the spec; that is, that the EGLSurface survives being disconnected from the screen. Android's insistence on asynchronously destroying it and leaving behind a bogus pointer is not useful. Is there any way of getting Android to behave in a more standards-compliant manner, and not destroy (or invalidate) the EGLSurface? - -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "Sufficiently advanced incompetence is indistinguishable from │ malice." -- Vernon Schryver -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAksFgyMACgkQf9E0noFvlzh94wCfSepclO6XaZpA/umeMqVlrgRZ WokAoISSm2F51G0sT07W5EQh4wsJE9Pa =ur5V -END PGP SIGNATURE- -- 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: Layout with all cells the same size
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tom Gibara wrote: > Try setting the width of every child in your LinearLayout to 0, and their > weights to 1. Yup, that works. Thanks! (But good grief, it's hardly intuitive. I'd have never have thought of that on my own.) - -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "There is nothing in the world so dangerous --- and I mean *nothing* │ --- as a children's story that happens to be true." --- Master Li Kao, │ _The Bridge of Birds_ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFK3jLyf9E0noFvlzgRAmLtAJ9D6phS5Cs8vRukoC/AsCsmiK9IfgCeLtwT fvOEtp7dqbCW57iuYOEWYfM= =zEWM -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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] Layout with all cells the same size
I'm trying to do something incredibly simple: I want a layout which evenly divides the space up among its children, so each child is the same size. I cannot figure out how to do this. LinearLayout appears to assign space to all of its children and then allocate the *remaining* space --- so a TextView with a label of "LONG" gets more space than a TextView with a label of "I", even if it's not necessary. TableLayout... well, I can't figure out what rules TableLayout uses to assign its space. But I still get much the same effect, regardless of how I fiddle with shrinkColumns and stretchColumns. Does anyone know how I can do this? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)' │ --- Conway's Game Of Life, in one line of APL --~--~-~--~~~---~--~~ 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 receiving orientation changes
David Given wrote: > I've got an activity which is always configured to be displayed in > portrait mode (with android:screenOrientation="portrait"). I don't want > it destroyed when an orientation change happens, so I have > android:configChanges="orientation" for it. > > However, it *does* needs to be aware of orientation changes, so I can > update the content. Unfortunately it would appear that while I am being > sent configuration change events, the orientation in the configuration > claims it's always in portrait mode, presumably because that's what the > activity is set to. > > How can I have my activity be permanently in portrait mode and *also* > receive the correct orientation change events as the phone is rotated? Does anyone know about this? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "They laughed at Newton. They laughed at Einstein. Of course, they │ also laughed at Bozo the Clown." --- Carl Sagan --~--~-~--~~~---~--~~ 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: dblite file?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yayo wrote: [...] > Is it possible to bundle a read/only dblite file with data for the > application? By 'dblite file' you mean a SQLite database file, right? The short answer is: sort of. The longer answer is: SQLite can only open *files*. (i.e. something on the filesystem.) While you can ship files in your apk in the form of raw resources, they don't actually appear as files, and so you then can't open them from SQLite. (Context.openRawResource() will only return you an InputStream, but SQLiteDatabase.open() wants a path or a file.) So you could ship a SQLite database in your apk, but you'd have to copy it out of the apk and into you app's file storage area before you could use it. In fact, if you were going this route it would probably be more sensible to ship an SQL dump rather than a raw database --- Android stores some magic data in its databases which you'd have to replicate, and using an SQL dump generally makes life easier. Unfortunately, actually *running* the SQL dump is needlessly hard on Android (Android will only let you run one statement at a time), but it is quite manageable. - -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "People who think they know everything really annoy those of us who │ know we don't." --- Bjarne Stroustrup -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFKueJPf9E0noFvlzgRAthhAKDX60/Ncgjmpuk0tDxiH8hkok180wCeK/Hp vBSptf70F+Qw3FkDhkXh6xI= =M5KP -END PGP SIGNATURE- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Problem receiving orientation changes
I've got an activity which is always configured to be displayed in portrait mode (with android:screenOrientation="portrait"). I don't want it destroyed when an orientation change happens, so I have android:configChanges="orientation" for it. However, it *does* needs to be aware of orientation changes, so I can update the content. Unfortunately it would appear that while I am being sent configuration change events, the orientation in the configuration claims it's always in portrait mode, presumably because that's what the activity is set to. How can I have my activity be permanently in portrait mode and *also* receive the correct orientation change events as the phone is rotated? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "They laughed at Newton. They laughed at Einstein. Of course, they │ also laughed at Bozo the Clown." --- Carl Sagan --~--~-~--~~~---~--~~ 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] Running big chunks of SQL
I want to initialise my database on app startup from a file containing quite a lot of SQL. I can't find any way of executing multiple statements at once. SQLiteDatabase.execSQL() is restricted to running *one* statement at a time. I know the SQLite library is capable of doing this; is there any way of accessing this from Java? (Right now I have a very simple parser that splits the input file up into statements by looking for ; characters, but as I'm about to start needing triggers that will fail.) -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "They laughed at Newton. They laughed at Einstein. Of course, they │ also laughed at Bozo the Clown." --- Carl Sagan --~--~-~--~~~---~--~~ 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: Intercepting SQLite's file reads / writes, so we can encrypt the storage
Chris Stratton wrote: [...] > Pretty soon we'll be talking about a custom runtime linker that loads > up a patched version of the existing sqlite... there must be a better > way? You might be interested in HSQLDB: http://hsqldb.org/ It's a pure-Java SQL engine. Being pure Java, it has the advantage of not needing hairy and non-portable native compilation. It's got a number of fun features like pluggable SQL functions written in Java. I can't find any handy references for the footprint size, though. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "They laughed at Newton. They laughed at Einstein. Of course, they │ also laughed at Bozo the Clown." --- Carl Sagan --~--~-~--~~~---~--~~ 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: Returning files through a Cursor
Chris Stratton wrote: [...] > I wonder if its expectations are close enough to those of the sources- > provided non-gmail "Email" application that you could debug it against > that and then switch back to gmail? Yes, of course I can... For reference, what GMail (and Email) want is a cursor conforming to OpenableColumns, containing the name and size of the file (if known). Once the app has read those it'll try to open the file via ContentResolver#openInputStream(). So that bit's all working fine. However, I can't find a way of passing a stream through a ParcelFileDescriptor. I really don't want to have to write my file out to disk because figuring out when to clear up the temporary file becomes nasty. What I'd really like is a pipe, so that I can create the data as the email app asks for it --- but it doesn't appear to be possible to create a ParcelFileDescriptor from a pipe, or a unix socket, etc. Is there any way to do this? I may have to resort to creating a unix socket in my application sandbox and lying to GMail about it being a file. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "They laughed at Newton. They laughed at Einstein. Of course, they │ also laughed at Bozo the Clown." --- Carl Sagan --~--~-~--~~~---~--~~ 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] Returning files through a Cursor
I would like my app to start an email app such as GMail with an attached file. For various technical reasons we can't use a file: URL for this --- we have to pull the file out of our ContentProvider. So, I need some way to make a content: URL behave as if it were a file. We've got it *nearly* working; I can see GMail call query() on my ContentProvider, followed shortly by GMail crashing because I'm not providing the right fields in the cursor. The thing is --- what's GMail expecting to see? I can't find any documentation on this. I have found ContentProvider#getAssetFile(), which appears to be related, but it doesn't seem to being called. What I get is: E/CursorWindow( 848): Bad request for field slot 0,1. numRows = 1, numColumns = 1 (What I'd really like to do is to be able to pass GMail some sort of high-level stream object so that I can generate data on the fly, but I suspect it's not possible.) -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "They laughed at Newton. They laughed at Einstein. Of course, they │ also laughed at Bozo the Clown." --- Carl Sagan --~--~-~--~~~---~--~~ 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: FTP on android
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark Murphy wrote: [...] > Bear in mind that the Android emulator runs in a virtual machine (qemu). > Just because you can get to the FTP server from your desktop does not > necessarily mean you can get to it from the virtual machine. Also, don't forget that depending on how you FTP session is configured then the server might need to make a connection back to your Android system --- FTP is a ghastly protocol, and needs to be configured just right (PASV) to avoid this: http://slacksite.com/other/ftp.html - -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJ4NTRf9E0noFvlzgRArcJAJ9PaPtNzwl35G+ziZH+wWXKjCLCfgCfWvl/ G6lErc/AmwUU36VYUb1K1Fs= =PFsP -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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: Writing files to SD card failing
Tane Piper wrote: [...] > File k = new File(j, rowId + ".jpg"); > k.mkdirs(); > k.createNewFile(); [...] > However, it keeps failing on the line k.createNewFile(); with the > error: > WARN/System.err(10727): java.io.IOException: Parent of file is not a > directory: /sdcard/twitcast/1.jpg It looks like there's a file on your SD card called '/sdcard/twitcast' that's preventing the directory from being created. Is File.mkdirs() returning non-zero? (Remember that it doesn't throw an IOException on error.) Also, in the interests of pedantry, it's a good idea to close your FileOutputStream after use --- while the garbage collector will take care of it *eventually*, leaving the file open may cause you problems later if you need to open the file again. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "A line dancer near a graduated cylinder, the blithe spirit inside │ some wheelbarrow, and a tomato are what made America great!" --- │ received via spam signature.asc Description: OpenPGP digital signature
[android-developers] Re: If your hosting your own .apk
Tom wrote: > Sites will not work for hosting APKs since the mimetype is not set > properly: Clicking the file from the G1 will result in a browser > error, not an install. Damn. It might be worth asking them to change it, particularly if any Google people from here feel like putting in a word; it is the obvious place for hosting this sort of thing... -- David Given d...@cowlark.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: If your hosting your own .apk
Tom wrote: > My APK is 1.2M. I've searched for ways to reduce it in size without > success. Any pointers? Alas, Google Pages is no more (unless you happen to have signed up for it before they started to shut it down), but sites.google.com is a similar free website hosting thingy that's nothing like as good, but should still do for your purposes --- you can either attach the apk to a normal page or else use a special File Cabinet page. The file size limits seem to be large, ~10MB. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "A line dancer near a graduated cylinder, the blithe spirit inside │ some wheelbarrow, and a tomato are what made America great!" --- │ received via spam signature.asc Description: OpenPGP digital signature
[android-developers] Re: How to send email programmatically?
Mark Murphy wrote: [...] > Those cases all require you to send emails. You can do this today. You > need to get yourself a Java JAR that supports SMTP, ask the user for > SMTP credentials (server, from address, SMTP authentication settings, > etc.), and you're set. Speaking as a user, I don't want an app sending mail on my behalf, ever --- especially if it's through my account! But I *would* like an API that allows an app to launch the email application of my choice, with subject, recipient and body filled in, so that I can inspect it and press SEND if I choose. This has another advantage that it ought to be really easy to implement, requiring only a standardised intent with the data packed into it --- e.g. mailto://[EMAIL PROTECTED]&body=Body, which is not only how the web does it, but is also a standard: http://www.rfc-editor.org/rfc/rfc2368.txt Am I right in thinking that the only thing this needs to work is that email apps declare themselves as supporting the mailto: data scheme? Do any Android email apps do this already? -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to get MediaController positioned at a required location?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Nilangini wrote: [...] > Do you have any idea how can we position the MediaController at a > required location? > I could not find any way to set the position of MediaController. Heh --- I just asked this! One it's *playing*, you can use MediaPlayer.seekTo() to change the position in the stream. But if it *hasn't started playing yet*, you can't change the position. In other words, you need to wait for it the buffer the initial part of the stream and start playing before you can call seekTo(). - -- David Given [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJNRz2f9E0noFvlzgRAp6CAKCTytVsJnLdCkWnIGuKpkWvCZ54BgCgtl5Z nxsTmm1t8lgdK0sXE/uGq7k= =DFUc -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Download the Android Developers
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Xavier Mathews wrote: > Is There A Reason Why You Post This? It's spam --- just ignore it and it'll be eaten by your spam filter. (Good advice, BTW, for all mailing list spam. Many's the time I've only received a piece of spam because someone replied to it; the initial message didn't make it through the filters and was eaten.) - -- David Given [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJNR1Xf9E0noFvlzgRAoDmAJ43Y2VzfjDgwV8GLi2kQkuuyuAFCQCdFyQi qpxxPqyrL3X26WGVPMd1hGQ= =i+B9 -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Android on iPhone
Robert Green wrote: [...] > 1) Like Romain said - Android doesn't need multiple cores nor does the > G1 have them. The G1 has a multicore CPU in that it contains a > discrete CPU and GPU but not 2 CPU cores. The iPhone has 1 ARM CPU > (same arch as G1) and 1 discrete GPU. People may be being confused by the fact that the G1 is kind of phone normally called a *two-chip* phone --- what this means is that there are two CPU cores, one of which runs the applications, and one of which runs the mobile radio stack. (Even though they'll be on the same piece of silicon.) This is different from *one-chip* phones, where the same CPU runs both the applications and the radio stack. Most Linux phones are two-chip systems because Linux doesn't get on well with real-time work, and mobile radio stuff is about as real-time as it gets. On the G1, the MSM7201A is a multicore CPU combining: - an ARM11 core - an ARM9 core - a QDSP4000 core - (possibly a QDSP5000 core as well, the spec sheet is unclear whether you get both this and the QDSP4000) - (possibly a 3D acceleration engine; again, the spec sheet is unclear about whether this is a separate module or just done by the DSP. A lot of these mobile processors just bolt on a PowerVR core for the 3D acceleration) So it might be technically accurate to call the MSM7201A a *five* core CPU. Regardless, Linux only sees one core, the ARM11. The radio stack runs its own specialised OS on the ARM9. The DSPs will run *another* tiny OS to service requests from the other processors. If there is a separate 3D accelerator it's probably not programmable, which means it's probably not correct to refer to it as a GPU. And all the processors will share silicon and physical resources in a deeply incestuous manner, so you may not be able to draw hard dividing lines between them the way you can with PC hardware. So the G1 could plausibly be described as a one-core two-core two-chip single chip device. If you're used to PCs, the mobile world may seem a little odd. And believe it or not, this is pretty *standard* for a smartphone processor. (Incidentally, if anyone can point me at a real datasheet for the MSM7201A, I'd be interested to see it. All I can find are marketing puff pieces.) -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Media Player Error -38,0
Mr Chaloo wrote: > Hi, > Have you found the solution of this error? > I am getting the same problem with mid sound playing. > Please reply me asap. This is the generic 'I'm confused, help me' error code. -38 corresponds in the source code to 'unknown error'. It seems to appear for a whole variety of reasons. There's no real way of figuring out what's going on other than to examine your code and make sure you're doing everything in the right order. Even then the error appear now and again on stream start, for me; I catch it and reinitialise the MediaPlayer, and the next time round it usually works. -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: MediaPlayer & seek on startup
David Given wrote: > I'm trying to play streaming music. The user has previously requested > that the stream start a certain way into the stream. How do I do this? [...] Does anyone have any suggestions on how do this? If I can't make this work, my app is basically stuffed, and nothing I've tried is working. Brief summary: I need to be able to tell MediaPlayer to start playing from somewhere in the middle of the stream, not the start. If I call seekTo() after prepare() then the user has to wait for the buffer to be filled twice, which can take up to thirty seconds, and they're not going to put up with that. Is there a way to tell it to prepare the stream (reading the stream header, etc) but *not* to fill the buffer until I tell it to start playing? That would work. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)' │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Re: MediaPlayer & seek on startup
Dave Sparks wrote: > You must always call prepare() before seekTo(). The player engine > needs to read the first part of the stream to identify the stream type > and required codecs and read the content index (if it exists). Well, yes, I'm aware of that. However, it doesn't just read the stream header, it spends 10-15 seconds buffering the initial stream. This is leading to a really poor user experience, as the user has to wait (and pay) for the first part of the stream to be buffered --- then the seek happens, it all gets thrown away, and the user has to wait (and pay) for *another* 10-15 seconds while the buffer gets filled from the correct location. Is there any way of streamlining this? Can I tell MediaPlayer to *just* read the metadata and not to try and fill the buffer, for example? -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] MediaPlayer & seek on startup
I'm trying to play streaming music. The user has previously requested that the stream start a certain way into the stream. How do I do this? What I'm finding is that if I do: mediaplayer.setDataSource(...); mediaplayer.prepare(); mediaplayer.seekTo(...); ...then the seek happens *after* the initial buffer is read, which of course is a waste [*]. But if I do: mediaplayer.setDataSource(...); mediaplayer.seekTo(...); mediaplayer.prepare(); ...then of course I get an IllegalStateException because the MediaPlayer hasn't been prepared yet! Has anyone managed to make anything like this work? [*] Actually, of course, I'm using prepareAsync(). In fact, what I'm observing is that calling seekTo() from the onPrepared() callback tends to confuse MediaPlayer and it hands me a -38 error and I have to reset and start again. It seems to only want to seek after the playback has had a chance to settle for a few moments. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)' │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Getting images off the network, via a cache
I have an app that's going to want to display quite a lot of thumbnail images, downloaded off the network. These are eventually going to be used as Drawables. As I'm going to be referring to them quite often, from one run of the app to the next, I want to cache them. What I've currently got is quite a lot of complex code that keeps an in-memory cache where I can ask for an image by URL, and then I'll get called back asynchronously when it's arrived and the Drawable is ready for use; I can then add this to my UI, replacing the placeholder thumbnail via a nice transition. It's all painful and fiddly. Given that this is the sort of thing that people are likely to want to do, are there any system services that will do it all for me, so I can throw away all my custom code? -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Android & J2ME project
brownbear wrote: [...] > I'm a new member of this group & a newbie in google android & j2me. Unfortunately Android doesn't actually support J2ME --- it's J2SE more than anything else. You're unlikely to be able to use any existing J2ME code. The documentation is excellent; try the 'getting started' pages on the left: http://code.google.com/android/documentation.html -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] ImageView & automatic sizing
I have a layout problem with ImageView. I'm trying to display an image, with a border drawn round it, at the largest possible size that will fit in an area without changing the aspect ratio. I'm doing this with a simple ImageView, with the border drawn using a Drawable attached to android:background. According to the specs, setting android:adjustViewBounds="true" is supposed to cause the ImageView to resize itself to match the size of the image it's displaying (after scaling). However, I'm finding that this doesn't seem to make any difference. I finding that I either have the ImageView expanding to fill all the available area (which means the border's not drawn in the right place), or shrinking down to the image's natural size (which means it's floating in the middle of lots of empty space), regardless of whether it's set or not. Which one I get depends on whether the ImageView's size is fill_parent or wrap_content. My XML looks like: ... ... /> I would have *thought* that what I want to make this work is (a) set the size to fill_parent (to make the maximum size available to the ImageView) and then set adjustViewBounds (to cause the ImageView to resize itself to match the image). The LinearLayout will then float the ImageView in the middle of the cell. Unfortunately this doesn't work. Any suggestions? Am I going to have to resort to code? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)' │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Re: How shall I need design my application when the device be rotated?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hackbod wrote: [...] > As far as canceling the "auto-adjustment" I'm not sure what you mean > -- if you mean you want to force one orientation, you can specify in > the manifest a fixed orientation to use. If you mean you don't want > to relayout the screen at all... well that is kind-of weird. :) I'd > be interested in knowing exactly what you want accomplish. Actually, we have a potential use case for this: Say we have a big chunk of third party code. This code can be set, on startup, to run in either landscape or portrait mode. However, once running, the orientation can't be changed without restarting the code, which is a heavyweight operation and may cause the user to lose data. So we'd want to query the orientation, initialise the code, and then somehow prevent the system from trying to change the orientation of our activity from then on. I think this is similar to what the OP wanted... - -- David Given [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJFeA2f9E0noFvlzgRArsoAJ9fflTTq4fVF7zRVE/RjdN8PH1xqgCguUcR ntaRjSJFfTxaGI+0hybiwak= =GqVE -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Updating From HTTP
Bobbie wrote: > Hey all, thanks for all your help so far! I have the following > function running on a timer every 20 seconds or so. However, every > time it runs, my user interface for this program (an EditText box and > a submit Button) freezes until the HttpPost is finished. Is there a > way for me to run this function "in the background" or something so it > doesn't freeze the interface? Is there a more efficient way to do > what I'm trying to do here? The "chatscreen" variable is a TextView. Yes, run it in another thread --- look up java.lang.Thread. Be aware that methods in another thread can't call anything in the UI directly, though; look up Handler. void doSomethingInBackground() { /* Here we're in the UI thread. */ final Handler handler = new Handler(); Thread thread = new Thread() { public void run() { /* Here we're in the background thread. */ /* perform blocking operation here */ handler.post( new Runnable() { public void run() { /* Back in the UI thread again. Tell the user we're * finished. */ } } ); } }; /* Start background thread, don't wait (will return immediately). */ thread.start(); } If you think the syntax is nasty, you're not the only one. Bear in mind that your activity may have finished by the time the thread completes. Also, if you're going to do this a lot, you'll want to reuse the Handler and Thread objects. -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Play custom audio format ?
Derek wrote: [...] > Thanks the MediaPlayer, it's possible to play MP3 and OGG. However, > how can we play other audio formats ? We have many audio decoders in > Java (jSpeex, Monkey Audio ...) that can convert (on fly) an encoded > audio stream to PCM stream. It means that we can have an PCM > InputStream but we don't see any method with InputStream as parameter > in MediaPlayer class ? This seems not to be really possible right now. It *is* possible to hack things together that you can do this --- for example, you can create a local socket, tell the MediaPlayer to stream from the socket, and then write data to the other end --- it's very slow and Dalvik isn't really up to the task of synthesising audio data on the fly, so the results are very unsatisfactory. Hopefully we'll get more codecs in a future version... -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Orientation Sensor yaw values. Is your G1 compass bad?
bryan wrote: [...] > For example, the range of offset from magnetic north is +/- 46 > degrees. The average offset is just under 20 degrees. Depending on how > I orient my G1, the error can go to 46 degrees off of magnetic north. > Has anyone here experienced similar results when reading yaw from the > sensor? I can't comment on the G1 specifically, but magnetic compasses are frequently scarily inaccurate if there's any metal around --- try it in different locations (but pointing in the same direction!) to see if the deflection varies from place to place. (Once scuba diving I found myself swimming in almost literal circles because I was a few metres away from an old magnetised torpedo, that was causing a complete 180° deflection. Even unmagnetised metal has a severe effect. Of course, if you're *not* standing on top of a lump of iron, +/- 46° does seem like a lot.) -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Problems streaming ogg files
Guillaume Perrot wrote: > Ogg files are not supported by android. > Android only supports mp3 and m4a files (amr audio codec). > I may be wrong but to check you can play your ogg locally with the > standard music application. Unfortunately I don't have access to my Android dev machine right now, but I'll try that later... are you sure Android doesn't support ogg? Ogg support was announced with some fanfare with the m5 SDK. Has it been removed again? -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Problems streaming ogg files
I'm trying to stream an ogg file over the network, but without success. MediaPlayer.setDataSource() throws an IOException: java.io.IOException: setDataSource failed.: status=0x8000 I know the destination file exists, and the same code works fine with mp3s, so this seems to be something specific to oggs. Looking at the source code, that status number seems to correspond to MediaPlayer's UNKNOWN_ERROR, which appears to be a catch-all for 'something broke', but I've been unable to track things down further than that. Does anyone know how I can make this work? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)' │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Re: Activity menu icons
Jason Parekh wrote: [...] > As an interim solution, you could, in your onCreateOptionsMenu, go > through each menu item and do: > > Intent intent = item.getIntent(); > if (intent != null) item.setIcon(packageManager.getActivityIcon(intent)); Thanks, that ought to do it --- but I can't seem to find any way of iterating through a Menu and looking at each MenuItem! The only way I can see of getting a MenuItem out of a Menu is to call Menu.findItem(); but that needs an id, and they're all likely to be 0. What am I missing? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)' │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Re: Making a distributed system
ThemePark wrote: > Point taken. I didn't think it would use up a lot of battery power, > but you're right, a lot of little bits certain would. It would be entirely possible to have the app only run when the device is charging; given that most people with smartphones leave them on charge overnight, this would still get you reasonable run time. There's an ACTION_BATTERY_CHANGED intent that you can register for to get notified when the AC power status changes, but I don't know offhand how you'd poll for the current status. > I've been reading about using stuff like messages > and threads in general, but I am unsure of what I should use > specifically in Android. You probably want to read up on this: http://code.google.com/android/reference/aidl.html Note that you only really need to do this for IPC between different apps on the same device. The most common use for this is to allow one app to communicate with a library that's actually part of another app --- ContentProviders, for example. For a distributed processing app, the most likely scenario is to have the actual calculator running as a background service, with a separate app communicating with it via IPC to show the results to the user, that only runs when the user actually wants to watch things happening. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)' │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Re: SSH to the G1 ?
Ian Vaughan wrote: > There must be a way in, if there is a way into the iPhone, then there > must be here!? It's worth remembering that Android, while it uses the Linux *kernel*, does not use the Linux userland, and should not really be considered a normal Linux system. Other than adb, which is pretty much useless on a real phone, it just doesn't *have* a shell --- there is no 'in' to get in to. What precisely are you trying to do? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)' │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Activity menu icons
My application extensively uses menus constructed from activities declared in the manifest, using Menu.addIntentOptions() to get the system to automatically merge in any appropriate menu items based on the current activities' URL. This is working very well. Unfortunately, I haven't figured out how to make icons appear for the menu items. The label is correctly taken from android:label on the activity's , or the activity's own label if one isn't specified, but android:icon appears to be completely ignored. Hunting for info, I found the following mailing list thread: http://groups.google.com/group/android-developers/browse_thread/thread/5ca8bc78fdaa9e69 ...of people running into the same problem with m5. Unfortunately, there wasn't a resolution. Has anyone got this working? If so, how? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)' │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Re: OpenGL light strange behaviour
Steff wrote: [...] > I am playing with OpenGL and especially light in OpenGL. I have tried > to set light in the GLSurfaceView application in ApiDemos (Under > Graphics / OpenGL ES). [...] > gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); > gl.glEnableClientState(GL10.GL_COLOR_ARRAY); By the looks of it, you aren't supplying normals. In order to make the lighting work you'll need to give a normal vector for every vertex in your shape. (So, if you want flat shading, each vertex of a triangle should have the same normal vector.) Yeah, this got me, as well. I eventually wrote my own routines to construct display lists from descriptions of polygons, calculating the normals automatically as it did so. Here's a good reference, complete with normal calculation code. You'll need to convert it from C to Java, but that's pretty easy: http://www.falloutsoftware.com/tutorials/gl/gl8.htm -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Problems writing to SD card of physical T-Mobile G1?
Pavel Antokolsky aka Zigmar wrote: [...] > Hi Jason! Thanks a lot for the tip - it did help. On other hand - I'm > stuck. I was hoping to use sd card as a medium to transfer data > between android app and usb host, but as it looks I can write either > externally or internally but not both at the same time. I guess > android developers had chosen not to implement fs synchronization, > thus disabling concurrent writes. No phones can do this --- it's a filesystem limitation; FAT simply can't cope with more than one concurrent user. Only really specialised filesystems can do that, and most of them require additional hardware to synchronise the different users. If you want to allow the PC and the phone to access the device concurrently, you'll need to use a file system server on the phone and proxy requests from the PC. JCIFS looks helpful here. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)' │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Re: Android Source Code Now Available
Romain Guy wrote: > That's what the SDK is for. If your app compiles against the SDK, you're good. Yes, but I'm more interested in making sure that *other people's* applications aren't doing anything they shouldn't be. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)' │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Re: Android Source Code Now Available
hackbod wrote: [...] > In other words, if you use private APIs, you can -only- > distribute the resulting app by having a carrier bundle it with a > phone. Just out of interest, do you have an offline API checker app that could, say, be run against applications before they get uploaded to the App Store? Or possibly that could be run as part of the upload process? It's conceivable it might be useful to have the *phones themselves* verify the app before installing them, too. (I'm thinking here of the ghastly mess Java ME is in where applications will either work, not work, randomly crash, or crash the phone, depending on which private APIs they're using. If there was a way of getting the phone to at least *warn me* if I was installing a dodgy app I'd be rather happy.) -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ ⍎'⎕',∊N⍴⊂S←'←⎕←(3=T)⋎M⋏2=T←⊃+/(V⌽"⊂M),(V⊝"M),(V,⌽V)⌽"(V,V←1⎺1)⊝"⊂M)' │ --- Conway's Game Of Life, in one line of APL signature.asc Description: OpenPGP digital signature
[android-developers] Re: How to have multiple Android projects in one Eclipse Project?
DulcetTone wrote: > That is the point, basically. Eclipse doesn't work like that, really. But you can go to Project->Properties->Project References to set up dependencies between projects, so they'll get built as a set. That allows you to put your common code in a separate project which your other projects refer to. does that do what you want? -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Algorithm writen in C
[EMAIL PROTECTED] wrote: > The idea is to develop the main application in java > code and this would "call" to the algorithm somehow, so the algorithm > could return a value for the main app. I know there are some libs > writen in C/C++ and I'm wondering if I could do so for my project, > write my own lib and call it from the main app. Currently the only way of writing stuff in C on Android is to embed it in the phone image itself. You can't do it from applications. However, if you don't need the code to be fast, you might be interested in this: http://wiki.brianweb.net/NestedVM/NestedVM It's a system for running C on Java by compiling the C into MIPS machine code and then converting the machine code into Java bytecode (which would then get converted into Dalvik bytecode). The result will be slower than rewriting the app in Java, but that may be sufficient for your purposes. -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: G1 for developers in Europe
Octavian Voicu wrote: [...] > There should be a special offer for developers so that they can buy it > online from anywhere in the world with no subscription, so they can > test their apps on the real thing. That would really speed things up > and make Android better much faster. Yeah, but that would provide an easy way for people to get their hands on an unlocked device and so avoid the 2-year T-Mobile contract, so I doubt it will happen. (I'd love one. Not on that contract.) -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: List background style
Romain Guy wrote: > There's a way to do this. Simply set your background texture on the > list items, but use a selector for the background. For the state > android:state_selected="true", simply use @android:color/transparent > as the background. This way, when an item is selected, its texture > won't be shown, and you will be able to see the list selector. Ah, I didn't know about state_selected (would you like a bug report on documentation for this?). Yes, that works fine. In fact, I've managed to simplify considerably and have put all the logic into the list item's background: http://schemas.android.com/apk/res/android";> That way I don't need to fiddle with the ListView at all. Incidentally, he also wants custom dividers in the ListView. I have that working, but along the way I found out that it doesn't seem to want to honour the dividerHeight attribute. The only way of setting the height of the dividers is to point divider at a fixed-height drawable, like a PNG file. Is this a bug, or simply something I'm not doing right? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] List background style
I'm drawing a ListView. My graphic designer has specified a texture for the selected item; that's fine, I just put it in a drawable and set the ListView's listSelector attribute. However, he's *also* specified a texture for unselected items. I can't figure out how to do this. What I've tried: - set the ListView's background to the texture... doesn't work because the texture is scaled to fill the whole list. - set the list item's background to the texture --- doesn't work because the texture is then drawn *on top of* the selector texture, so we don't see the texture any more. - do the above, and set ListView's drawSelectorOnTop --- doesn't work because the list selector texture is opaque, and now I don't see the list item at all. I've experimented with using a drawable; this is honoured for listSelector, but doesn't help because listSelector is only drawn once; but it's not honoured for the list item's background, so I can't do it that way. The only way out of this I can think of so far is to use code to manipulate the list item's background at run time. Not hard, but very nasty. There's got to be a cleaner way to do it --- does anyone know one? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] documentation?
Does anyone know if there's any documentation for the XML language used for specifying drawables? I haven't been able to find anything, and http://code.google.com/android/reference/available-resources.html#drawables doesn't mention them. Currently I'm working from the examples in the SDK, which are a bit minimalist, and there's quite a lot about them I'm having to guess at. For example, I'm particularly looking for a way of changing the gradient function or gamma to bias the gradient towards one end of the colour. Figuring out how to specify the minimum size would be nice, too... -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] Theme queries
I'd like to theme one of my ListViews. I'm having no luck. I can apply a theme to the activity itself, and that seems to be taking, but the theme doesn't seem to be working for the list entries themselves --- they're being created at run time by a SimpleCursorAdapter. Either I need to separately set the theme for each item (in which case how?) or else the list items are being drawn using various resources I haven't found yet (in which case what?)... does anyone have any fully working examples of a themed ListView? Also, I'd like to change the list selector drawable to different one. The image I want is a simple gradient, so I'd rather like to use a drawable gradient for that. Unfortunately, the documentation link describing how to define one in XML is broken. Does anyone know how to do this? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] SQL replication?
I have an app that wants read-only access to a fairly small MySQL database held on a remote server. For speed, I want to hold a copy of the database locally. (It only gets updated once a week or so.) What I'm currently doing is I've got a PHP script on the remote machine that dumps out the database in XML format. My app then reads this in, parses it, and populates the local database accordingly. This is horribly slow, even using a streamlined XML parser of my own rather than the achingly slow built-in one. Given that they both use SQL, there's got to be a better way of doing this. Could I, for example, simply get the remote server to do an SQL dump and throw this at SQLite without horribly compromising security? Are there any streamlined (i.e. fast) replication data formats I could use? Has anyone done anything like this who can suggest anything? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] Re: Easter eggs
Mark Murphy wrote: [...] > Aw, c'mon! "At the moment, the island matching the listed value is, um, > lost" wasn't a big enough clue? Personally, *I* just want to know who the karaoke singer in the MediaPlayer 'Play Audio From Resources' demo sound is. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] Re: Audio cache strategies
Josh Guilfoyle wrote: [...] > Also, in my tests, the MediaPlayer buffers poorly. It seems to take 2 > - 5 seconds to even gear up and make a connection for some reason, and > then it seems to buffer more than is necessary in certain > circumstances. I'd like to load a simple test up on the HTC Vogue and > see what more I can learn about how 0.9 behaves on real hardware. Well, with much trepidation I've ripped out all my cacheing code and am now using pure streaming --- and it all works far better! I'm not seeing any of the buffering problems, and it all seems to be quite snappy, even when seeking beyond the buffer limits. However, I completely agree about the onBufferUpdate() parameter --- it's completely useless. I think it's showing me the high-water-mark of the buffer. Without the matching low-water-mark, I can't doing anything useful with it. onSeekComplete() seems to be a bit questionable, too, as when I get events seems completely unrelated to whether it's actually finished buffering or not. I also notice that streaming Ogg Vorbis files fails with, yes, another undocumented error code --- is this known to not work? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] Re: Audio cache strategies
Josh Guilfoyle wrote: > This is exactly the sort of problems my application (http:// > five.googlecode.com) must contend with, and unfortunately I have came > to the conclusion that for 1.0, Android will simply not be able to > support our type of application. Oh, dear. [...] > I constructed simple tests which clearly demonstrate that > onBufferUpdate is fired with entirely different metrics that I cannot > understand, but clearly do not represent buffer fill percentage. In > my tests, playback started anywhere from 5% to 25% "buffer fill > percentage", though it seemed more like the buffer fill percentage was > total file progress (but not quite). Likewise, the buffer fill > percentage never declines, so it isn't possible to detect when a song > chokes. Is that on m5 or 0.9? I know there are a lot of bugs that have been fixed in 0.9 (and still some to go...). Also, how well does MediaPlayer work streaming off the real internet? Is the buffering effective? -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Easter eggs
Peli wrote: [...] > * In the release notes for the 0.9 SDK: "We regret to inform > developers that Android 1.0 will not support 3.5" floppy disks. " > http://code.google.com/android/RELEASENOTES.html Do Android devices support USB mass storage? Because if so, it should just be a matter of plugging a USB floppy in... (Entertainingly enough, my USB floppy drive controller claims to support 8" floppies as well as 5.25" and 3.5".) -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: MediaPlayer in 0.9?
blindfold wrote: [...] > openFileOutput("myfile.wav", Context.MODE_WORLD_READABLE | > Context.MODE_WORLD_WRITEABLE); > > Play using MediaPlayer with > > setDataSource("/data/data/mypackage/files/myfile.wav"); I bet the problem (or possibly feature) is that MediaPlayer doesn't run with app privileges, and so can't read application-owned files unless they're o+r (which is what WORLD_READABLE maps to). My files were being created with the default umask. -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Audio cache strategies
I'm currently working on a custom audio player app for an online music site. It has the following main requirements: a) I need to be able to play music without waiting for it to download. b) I wish to cache the music locally so that the user's favourite tracks don't need to be downloaded again. Currently my strategy is to download the files locally and discard the oldest ones when I need more space, keeping all the metadata in an associated SQLite database; but this approach is rather problematic and very brittle due to having to keep the database and the files in sync, issues with ensuring that a file isn't removed when something else is wanting to use it, etc. Not the least of which is that caching entire files means using up rather a lot of disk space --- some of my music files can be 15MB+. Also, MediaPlayer appears to be very picky as to what it plays from: it insists on playing from a file, or at least a file descriptor, and when you start playing it measures the length of the file and won't play past the end point, which is a bit of a problem if you haven't finished writing it yet. At least 0.9 has fixed the issue where getDuration() used to calculate the duration of the media based on the physical file length. Can anyone suggest any alternative approaches to doing this? What I'd *really* like to do is to be able to store my entire cache in a single huge fixed-size file, optionally on the SD card, and stream fragments directly to MediaPlayer; but I don't think that's possible and Java would probably be too slow anyway. Alternatively, a block-level cacheing HTTP proxy would do almost as well. Does Android have one? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] Re: MediaPlayer in 0.9?
Steve Oldmeadow wrote: > Where are you storing the file? There is a change with the > MediaPlayer where it can't open files in the application's data area > for security reasons. Yes --- that was the problem. I now have it all working. Wonderful! Thanks! (Oddly enough, though, I'm still seeing an occasional what=-4 error --- however, since my app is setup to restart the MediaPlayer on error (as a bug workaround from m5), and the error goes away on subsequent attempts, it all appears to work fine. Very odd.) I shall now go and file a bug on what=-4 not being documented... -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] Re: MediaPlayer in 0.9?
Joa wrote: > Here's one more link which describes permissions No, there isn't! Did you mean to include something? I've had a look at the permissions, but don't see anything obvious --- the only two audio-related permissions appear to be MODIFY_AUDIO_SETTINGS and RECORD_AUDIO, neither of which seem to be relevant to me (and don't work anyway). Is there more documentation anywhere on what the various permissions actually do? All I've found is the long list of names here: http://code.google.com/android/reference/android/Manifest.permission.html -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] MediaPlayer in 0.9?
I have an application that's a specialised streaming audio player, designed to play music from a particular online archive. I'm using the time-honoured technique of downloading into a file and telling MediaPlayer to stream from the file. This all worked on m5, but on 0.9 it fails: I call setDataSource(), and then prepareAsync(), and immediately get back an undocumented error with what=-4 and extra=0. Does anyone know what this means? In addition, has anyone compiled a list of what's changed in MediaPlayer in 0.9? I want to know how many of my bug workarounds to get rid of! What I'm actually *trying* to do is to stream audio via a large, persistent file cache under application control; does the new MediaPlayer provide enough control of the buffering system to do this automatically? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] Re: 'Keytool error' when building
nazurro wrote: > Hello, > > I have the EXACT same problem, want to try developing for Android but > I just can't get it to work: > > Ubuntu 8.04 > Eclipse 3.3.2 > JVM: java-6-sun > > I would be very happy for suggestions. Beats me. Sorry. (That is, in fact, almost exactly my setup --- I'm using Eclipse 3.4.) The only thing I can think of is that on my system, when it worked the debug.keystore file was being created from the command line and when it failed it was being created via Eclipse; so you might be interesting to have a try recreating your keystore from the command line... but I'm afraid I don't know how. And at this point I'm a little adverse to playing with my system and breaking it again! -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] Re: 'Keytool error' when building
Megha Joshi wrote: [...] > Your ADT error might be due to the keytool issue related to locale...see > the link below: > http://code.google.com/android/kb/troubleshooting.html#signingcalendar I'm UKian, and as far as we know we use the Gregorian calendar too... Creating and building an empty project on the command line produces what appears to be the same error: debug: [echo] Packaging bin/ActivityName-debug.apk, and signing it with a debug key... [exec] Current OS is Linux [exec] Executing '/home/dg/apps/android-sdk-linux_x86-0.9_beta/tools/apkbuilder' with arguments: [exec] '/tmp/myproject/bin/ActivityName-debug.apk' [exec] '-z' [exec] '/tmp/myproject/bin/ActivityName.ap_' [exec] '-f' [exec] '/tmp/myproject/bin/classes.dex' [exec] '-rf' [exec] '/tmp/myproject/src' [exec] '-rj' [exec] '/tmp/myproject/libs' [exec] [exec] The ' characters around the executable and arguments are [exec] not part of the command. [exec] null And, indeed, running apkbuilder directly from the command line just produces: null > Also, someone else on the group..was able to resolve a similar Generic > ADT error by switching back to JDK 5 from JDK 6. Both java-1.5.0-sun and java-6-sun fail in precisely the same way. ... UPDATE: I just tried deleting the debug.keystore file and rerunning apkbuilder, to see if any interesting messages came out... and everything works now. So obviously some of my fiddling managed to fix something, but I don't know what; I'd already *done* that. So while this appears to be all fixed now, I don't know why --- so I'm going to go ahead and post this message in case anyone else has the same problem and can clarify. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] Re: 'Keytool error' when building
Yalcin wrote: > I can remember similar problem on my installation. > did you get the newest ADT? > ADT-0.7.1.zip > hier ist the link: > http://code.google.com/android/adt_download.html Yes, it's all up to date. I've tried recreating the project, and even creating new blank projects, and nothing works. Anyone have any ideas? If I can't run my app, I'm a little stuck... (Is it possible to build projects from the command line?) -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] 'Keytool error' when building
I have just upgraded from m5 to 0.9 on Linux using the ADT on Eclipse 3.4, and (after fixing my program) I am finding that it's refusing to build anything. The project I'm using was created on m5 and I'm now using it on 0.9. I get the following in the Problem pane: Type: Generic ADT Problem Location: Unknown Description: Error generating final archive: null ...and the following is appearing in the console: Signing Key Creation: keytool error: java.lang.IllegalArgumentException: java.io.IOException: Invalid char: (There are two spaces after 'char:'.) Once at this point, the ADT seems to think everything is fine; but my .apk hasn't been created and attempting to run the program fails (of course). I have to manually clean the project to make anything happen again. I've deleted my ~/.android directory as per recommendations, but it has no effect. I suspect Eclipse has something confused somewhere as part of the upgrade process; the Build Configurations menu appears greyed out, which disturbs me slightly (shouldn't I be able to select between Release and Debug)? Any suggestions? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_ signature.asc Description: OpenPGP digital signature
[android-developers] Re: how to run an application compiled with gcc
atilar wrote: > I don't know whether android support openoffice or not, so i have this > question. If not, i have to run it as native C application. But i > still wish it is supported or any one can give me an answer? thanks No, OpenOffice doesn't work, and mostly likely never will. Android is only uses the Linux kernel, it's not a full Linux operating system, and as such is missing lots of things needed to make arbitrary applications work (like X). You will very likely only ever be able to run specially built Android applications on an Android device. -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to run an application compiled with gcc
Josh Guilfoyle wrote: > This isn't entirely true. While Java is the only officially supported > language, a quick Google search has revealed that folks have figured > out how to use the ARM toolchain to build native C applications and > even JNI libraries for use in Java. Yup; however, it is currently not possible to do so *usefully* --- there's no way to provision JNI libraries onto the system via .apk files. (The system will only load libraries from /system. Java applications can't write there.) And plain executables are probably useless due to an inability to communicate with the Java world for doing things like UI. (Although I'll admit that I haven't tried playing with Runtime.exec() yet; it might be possible to launch an app that way and communicate with it via named pipes. Probably not worth the bother, though.) Given that there are also a number of rather critical bugs in things like the JNI shared library loader, I would currently not recommend going this route except for a proof-of-concept. Apart from anything else, Google's quite likely to redesign all this in the next release... -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Re: how to add progress bar with media Player??????
Josh Guilfoyle wrote: > Simply using the activities message loop to schedule an update message > every second. The resolution of this timer will be sufficient to > report seconds of play to the user, however if you feel that it is > necessary to calibrate further you can invoke > MediaPlayer#getCurrentPosition inside your message handler. Do be aware that getMediaDuration() is (a) very slow, (b) causes breakup of the audio when you call it, (c) is inaccurate --- it bases the length on the length of the file in bytes rather than summing the individual frames --- and (d) managed to crash when I fed it a malformed .ogg file. -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Check within App whether running on Android platform?
kobica wrote: [...] > It's a bit more complicated than that. I would like to create a common > code to run on Android and Sun JVM. > Android UI and swing UI Apps would be using that common code. > Inside that common code, at time of init, I would like to know what is > the VM type in order to instantiate the right objects from a specific > factory. Can you not pass the appropriate factory into your common code's init method? I've used this method successfully on other cross-platform apps. Apart from anything else, trying to do the test at *run* time means you have to ship both factories with your app --- which as they're platform specific, mean that the unused factory is most likely going to want to refer to unavailable system classes, which will make life interesting. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Re: SDK Update?
Mark Armendariz wrote: > Josh, I have to agree with Joa. Thanks for the inside info!! The > fact that sdk updates are withheld from the earliest of adopters is > ridiculous. Yes, I agree that this is clearly unacceptable. Obviously we should immediately demand our money back. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Re: Streaming in android
padma prabhavathi wrote: [...] > Do u know anything about tunewiki?If u know anything about it then kindly > give me some information about it. I don't know who u is, and I don't know how tunewiki works, but if it's anything like the streaming audio app that *I* wrote, it works by using one thread to download the MP3 into a file, and then telling MediaPlayer to play from the file in another thread. This approach works, but isn't really adequate; you need to pad the file out with zeroes to make it the right length otherwise MediaPlayer gets very confused about how long the audio is, and it *still* gets very confused (and crashes) if you use oggs instead of MP3s. But this is strictly a workaround, and a pretty clunky and unreliable one. MediaPlayer is *supposed* to be able to open remote URLs directly, but that doesn't work yet. -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Streaming in android
padma prabhavathi wrote: [...] > Can anyone please tell me whether streaming is possible in > android.Till now i saw tutorials on playing video and audio files that > download into a folder and play. No. It's not. Trying to do streaming causes MediaPlayer to produce various bizarre and undocumented errors, which probably all boil down to 'not supported yet'. -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Logcat loses cat
Nickname wrote: [...] > With M5 SDK, the current Logcat window always loses log messages every > time application is re-launched, so I need to close the current Logcat > window and re-open another one to get the log messages for the re- > launched application. I don't use the logcat window because I find it's very slow and cumbersome --- instead I start an xterm and do 'adb logcat' in it. This gives me much the same effect, but it's considerably faster and more flexible. Filtered logcats can be done with 'adb logcat | grep keyword'; you can run several at once. Windows users should be able to use 'adb logcat' from a DOS box, but I don't think you've got a grep equivalent as standard. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Re: Google PLEASE don't let Android to dye
Wiktor wrote: > Gee... I really believe that Google developers are just hiding > Android's real progress, and hoping it's doing just fine. But I do > admit that even if Google has many innovative applications and ideas > they can't do simple stuff like proper documentation. Well, I used to work for a company that produced an embedded OS with SDK, and let me tell you, the OS is the *easy* part of the job. You would not believe how incredibly, hideously, radically hard a good SDK is to do. I'm actually really impressed at how *good* the Android SDK is given its prebeta state and rate of change. And compared to a lot of *traditional* mobile phone operating systems, the API documentation is outstanding --- like, there is some! -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Re: Google PLEASE don't let Android to dye
Danny wrote: [...] > But yeah, it is time for a new SDK release. It's a little tiresome > working with old documentation that still references the M3 build. I'd be very surprised to see anything any time soon, for one simple reason: m5 is full of bugs, but is almost usable. A newer, more stable release would be usable, just. If they released it, someone would instantly slap it on a phone and go into production, simply to cash in on the Google brand. And it would suck, because it's not finished. So rather than generate the huge amount of bad press that would cause, I think they'd be far more likely to generate a small amount of bad press instead by keeping things quiet until they have something that *really* works, and then making the announcement as a real device and SDK go into production. m3 and m5 have achieved their purpose; there are a lot of programmers out there who know enough about the OS to write apps on it, and they've sourced a reasonable number of private beta testers. -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Secure area inside android
Justin (Google Employee) wrote: [...] > "Safe" is vague. Based on hackbod's information it would be nearly > impossible to gain access to an application's private files. However, > there are always extraordinary possibilities such as a privilege > escalation exploit allowing a user or process to gain root or the user > physically modifying the devices and removing internal storage media. > Both of these possibilities are extremely remote. Is it likely that production phones will have the debug interface? Because while a privilege escalation is, as you say, not particularly likely, it wouldn't be necessary if the user could just plug their phone into a PC and do 'adb shell'! -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Secure area inside android
hackbod wrote: > (a) it uses a FAT > filesystem and... I'd just like to emphasise that if people write code that uses the SD card, this needs to be born in mind --- FAT has a few rather different semantics to a real Unix file system. Apart from the 2s-granularity timestamp, it also doesn't support sparse files. I discovered this when I found that a simple call to RandomAccessFile.setLength() on FAT was taking 45 seconds to complete; rather than simply adjusting the length of the file as it does on yffs2, it was writing 15MB of zeroes to the card. [...] > Out of curiosity, are you interested in protecting your data from > access by the user, or malicious access from others? I don't know what his application is, but if it's anything like mine, we need to store secure hashes of data files to ensure that the user's not tampering with them. I know this is actually impossible to do, but we don't need perfect security, merely *good-enough* security; we want to make it sufficiently hard to produce fake hashes that most people won't bother, and in particular we'd need a scheme that ensured that if the security was broken on one device, it's not also broken on all other devices. For example, we could store an encrypted datafile with a key based on the application signature itself seeded with the device ID. Since the key can be calculated with code, it wouldn't be stored anywhere, so any attacker would have to extract the key from a running program (which is quite hard!); and even if someone did manage this and was able to decrypt the datafile, they'd need to repeat the process on every other phone. But as this is a lot of work, it'd be much more convenient if there was a proper secure datastore on the device. Unfortunately the concept of 'secure (from the user)' and 'open device' are probably antithetical... -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Spinner - No selection
Mark Murphy wrote: > David Given wrote: >> Simplest solution is probably to use a custom ViewBinder on your >> SimpleCursorAdapter that adds a '(no selection)' row to the spinner. > > Can a ViewBinder add rows? I don't see how given the API. Yeah, if you're mapping the Spinner's data directly onto the database, I don't think you can do that. I'd assumed that he was mapping the database onto a ListView and the Spinner was just another widget in the list item hierarchy, which now I think about it probably isn't the case. -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Spinner - No selection
Shaimailit wrote: [...] > I would like to enable no selection in the spinner itself (like > windows combobox style), without using other controls, like checkbox. > I forgot to mention an important issue: I am using the > SimpleCursorAdapter, which means I get the values from DB table. > Therefore, I prefer to manipulate the spinner itself, instead of > adding fictive record to DB. > Is that possible? Simplest solution is probably to use a custom ViewBinder on your SimpleCursorAdapter that adds a '(no selection)' row to the spinner. That way you don't need to fiddle with the database but can still massage the data any way you like when populating the spinner. -- David Given [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Question About AndroidManifest.xml and resources
Wesley wrote: [...] > 1. Basically the error mean I did not declare activity in manifest > where generate this error when I start activity... What I intent to do > is to start activity without declare it at manifest... How can I hard > code those manifest info inside my code to start an activity? I'm not sure you can. I believe you have to declare activities in the manifest for them to work at all. However, if you're going to start each one explicitly, you don't need to declare it with any parameters: Intent intent = new Intent(); intent.setComponent(new ComponentName(this, SpecialActivity.class)); startActivity(intent); When declared like this, the *only* way you can start it is to create an intent and use setComponent(), so you don't have to worry about other people launching your activity when they're not supposed to. Does this match what you're trying to do? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Re: Assorted API questions
Mark Murphy wrote: [...] > > For that matter, are there any rules as to how >> an application should use SD card space? > > You'll need a Googler to answer strictly about "rules". > > That being said, I recommend you consider the SD card contents to really > be the user's prerogative in terms of layout and contents as much as > possible. Some might have an SD card populated from some other device > that they're bringing over (e.g., loaded up with MP3s). It's also quite > possible that they'll be sharing the SD card with other devices. Hence, > the less intrusive you are on how the SD card can be used overall, the > happier users will be. So, for example, forcing MP3s to fit in some > specific directory structure because it's convenient for you might not > be convenient for the user. What I need is a biggish cache for downloaded data --- hundreds of megabytes, and so won't fit on internal storage. It's not intended to be user-accessible. I note that Android puts a /android directory on SD cards containing the MediaStore database; it would be nice if there was an API for finding this directory and letting applications put stuff there... Of course, I still need a way of finding out how much free disk space there is first, to make this all work properly. It appears Java can't do this! There's an 11-year old bug on Sun's website asking for this ability. Apparently it'll be in Java 6... -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Assorted API questions
I have a number of fairly simple questions. I thought it more simple to batch them up than ask each one separately... (a) Does Android have any asynchronous I/O support? In particular, I'm trying to download a file via HTTP, and am currently having to use a helper thread to do all the work. This being Java, this then leads to manic thread hell, especially when I have to cancel a download currently in operation. I'd love to be able to do this from my main UI thread. (b) How can I determine the amount of free disk space on a particular path? (c) How do I find the path of the SD card (and, indeed, whether the SD card is mounted at all)? For that matter, are there any rules as to how an application should use SD card space? (d) How do I launch the web browser on a particular page? The obvious thing (create an intent, setData("http://...";), startActivity) does indeed start the web browser --- but at the Google home page, not my specified URL. Also, it asks me whether I want to start it with the browser or the browser first, which is very odd. (e) Is there a style guide I can look at so I can figure out how to design things like options dialogues? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Re: Smooth image scaling
Romain Guy wrote: [...] > You need to enable bitmap filtering on the Paint first. Yup, that did it! Thanks, guys. -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Smooth image scaling
I'm trying to scale quite a large image (500x500 pixels or so) to fit on the screen. The standard Canvas scaler appears to use a simple nearest-neighbour algorithm, which results on really nasty aliasing and horrible jaggies. Does Android contain any interpolating scalers? My next step is to start playing with OpenGL, but I'm not sure if the Android implementation actually supports the various texture interpolation algorithms --- also, I'm not sure they'd help anyway given that I'm scaling down, not up. Given that it's also quite a lot of work I thought I'd better check first! -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Re: Can one play a ByteArrayInputStream audio with MediaPlayer?
blindfold wrote: [...] > Basically all phones from Nokia support it, as well as several > phones from Sony Ericsson and Motorola. I'd be careful. I was working on one mobile phone system (and for obvious reasons I can't tell you which one it was) and got a chance to look at the source code for this stuff. To my horror I discovered that what the streaming audio code actually did was to read the entire stream into a byte array and play it from there! So just because they claim support for this kind of stuff doesn't mean it's actually supported *well*... -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Re: Can one play a ByteArrayInputStream audio with MediaPlayer?
blindfold wrote: [...] > However, in android.media.MediaPlayer I only find create() for URIs > and > for resources, and not for ByteArrayInputStream!? Does that mean that > Android cannot be used for in-memory audio synthesis? Or do I overlook > some alternative way of programming in Android? MediaPlayer.create() is just a convenience function --- you ought to be able to do: FileDescriptor fd = something.getFD(); MediaPlayer mp = new MediaPlayer(); mp.setDataSource(fd, "audio/wav"); // FIXME check MIME type! Unfortunately the documentation (which is unevenly indexed) doesn't mention getFD() on anything other than file streams. There *may* be a way somewhere of being able to create a Unix pipe, opening it, and giving MediaPlayer a FileDescriptor that way, but I wouldn't know how. I'm currently writing an app using MediaPlayer extensively, and my experiences indicate that it's extremely touchy --- large chunks of it don't work, error reporting is poor, it's missing key bits of functionality (such as synthesised audio!) and it's very touchy. If you do anything the slightest bit wrong it has a tendency to crash your app. You might want to wait for the next SDK, or mug a top-50 winner... -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Re: ListActivity woes
Mark Murphy wrote: [...] > If you're sure your data set won't be a-changin' underneath you, you > could try using an unmanaged cursor. However, if other activities have > the capability of modifying the data you're showing in the list (e.g., > it's a public content provider), then I suspect you *want* to requery > upon the activity restarting, lest you show stale data to the user. Yup, switching to an unmanaged cursor fixed it. I also checked that my ListView automatically notices when my database update thread modifies the database; that still works, so manually requerying is obviously unnecessary. Thanks! Romain Guy wrote: >> On a related note, with a ListActivity, is it my responsibility to save >> > the selected item in the icicle on freeze and restore it on thaw, or >> > will the ListActivity do it for me? > > Not in post-M5 SDKs :) > > A lot of work went into ListView's state saving after M5 so you might > want to wait until the next public release of the SDK before trying to > work around this issue as it is probably handled for you already. Fair enough. I'll wait for the next SDK before tackling the freeze/thaw issue; hopefully the problem will just go away! -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] ListActivity woes
My application is displaying a list of items from my database, in classic Android style, using a ListActivity and a SimpleCursorAdapter. So far, so good. However, when I select my item, move to another Activity, and then press BACK and go back to my ListActivity, I find it's deselected its item and scrolled all the way to the top. The ListActivity hasn't been stopped or destroyed, merely frozen, so I'm surprised it's doing this. Does anyone know why? And, more importantly, how can I stop it? On a related note, with a ListActivity, is it my responsibility to save the selected item in the icicle on freeze and restore it on thaw, or will the ListActivity do it for me? If it is my job, does anyone know how I can determine the selected item position given a cursor ID? (ListActivity provides getSelectedItemId() which returns the id of the currently selected item, but it *doesn't* provide a function to select an item given the id --- instead it requires the list index.) -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature
[android-developers] Audio streaming
Has anyone ever gotten MediaPlayer to play audio streams directly off the network without having to download them first? Here is my naive code straight out of the manual: ---snip--- _player = new MediaPlayer(); _player.setOnPreparedListener(this); _player.setOnErrorListener(this); _player.setOnBufferingUpdateListener(this); _player.setAudioStreamType(AudioSystem.STREAM_MUSIC); _player.setDataSource("http://myurlhere/file.mp3";); _player.prepareAsync(); ---snip--- If I use prepareAsync(), onError() gets called with the mysterious parameters 1, 0. If I use prepare(), I get an equally mysterious IOException with no detail string. I notice a number of people have tried this --- has anyone actually succeeded? -- ┌─── dg@cowlark.com ─ http://www.cowlark.com ─ │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup signature.asc Description: OpenPGP digital signature