[android-developers] Re: Options for sound in games
I've found SoundPool to be more reliable when you use ogg format files. Anything else causes trouble. For example sounds wont play or exceptions are thrown. On Jan 14, 10:13 am, Neilz neilhorn...@googlemail.com wrote: Well I've got mine working fairly well by using a SoundPool which only instantiates the sounds once, at application start up, rather than everytime the game is played. I don't get any locking problems now. (A quick search on SoundPool brings up several posts on the problem). But sometimes the sounds just fail to load, and give a message saying Sample x not ready. A reboot seems to solve it, but it shouldn't have to... On Jan 12, 3:41 pm, OldSkoolMark m...@sublimeslime.com wrote: I use SoundPool in my metronome application. Very short clips repeating at up to 300BPM, no problem. I'd like to know what the known issues you refer to are, as so far, I haven't been burned by any of them, and would like to steer clear of them going forward. On Jan 12, 7:14 am,Neilzneilhorn...@googlemail.com wrote: Hi all. I'm developing an app where I want to play a regular sound clip, like for example when a ball bounces or a rocket fires, small wav files which are called repeatedly. I have been using the android.media.SoundPool class - but this has known issues and after a few runs it locks up the application. As far as I can tell from my research, this has not been fixed, which is really frustrating as it's been the case since 1.5. What other options do I have? There are plenty of games on the market which use sound, so there must be something out there! -- 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: Sleeping thread vs. new thread
It is not a good idea to create a new thread every 100ms. As you noted there are overheads associated with thread creation. In a past project we noticed a significant memory impact from creating hundreds of thousands of new threads (albeit on windows system) If you don't want to use the sleep paradigm (which is a perfectly acceptable approach IMO) you could use an executor from java.util.concurrent which will use a thread pool to service your threads instead of creating a new thread every time. Just use one of the static methods in java.util.concurrent.Executors to create the executor and then submit runnables to it. On Jan 5, 11:03 am, Noonien Soong nooniensoong2...@gmail.com wrote: I am currently working on some communications code. Basically I am sending HTTP Requests to my server at an interval of lets say around 100 ms. The code is neatly placed in a Service and I am using threads in order not to block my UI. What I have right now is basically a cycle like this. 1. Schedule a handler to call a runnable myHandler.postDelayed(myRunnable, 100); // 100 ms 2. Inside the runnable's run method I create a new Thread Object. mThread = new Thread( this); 3. Then I run the thread. mThread.start(); 4. the run-method of the thread finishes at some point, either because e.g. a timeout-exception occured or because it finished after it received and correctly handled the server's response. 5. If everything's fine, I will then post the handler again. Back to 1 == loop! I've seen a lot of Java-examples online that all contain a loop inside the thread's run-method which is constantly paused using .sleep() and then runs again in order to do the work. I am wondering wether my approach is ok in Android. While I am aware that there must be some overhead when I create a new Thread object for each cycle, I wonder if it makes a huge difference, and if maybe the implications of having a thread constanly sleeping in memory ( especially if it is inactive for a longer time ) might not be bigger? I somehow feel it's not an elegant solution to have a while loop in a thread with a sleep simply to keep it alive Any comments grealty appreciated! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Have you tried the event send EV_KEY command in android emulator console ??
It just cann't work ,and without any reason Will anybody please tell me y ?? Any comment will be much appreciated! BTW, the command event text string does a very nice work, --~--~-~--~~~---~--~~ 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 with screenshot
hi,guys~! i've been playing around on g-phone test for a few days,But i'm really confused on how to get current screenshot,One way is to use getrootview()-getdrawingcache() method,providing that a View on the screen is already known ;But the statusbar is lost,What's more,if i launch an activity from an instrumentation class,i just couldn't get any View presently shown on the screen,so i tryed to make it the following way,but it also makes no sense: first new a View based on the target context: View v=new View(this.getTargetContext()); Then i tryed the focussearch() method and several others provided in the SDK,but i got nothing but the nonepointer exception,真TM郁闷。。 So, Any idears ?? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to create .apk file from the resurces that are given fro Android market
Actually that is the APK file, Just pick another .apk file,Change it's postfix to .zip,Decompression it and you will see everything. Hope this helps! On 12月17日, 下午6时38分, Asif k asifk1...@gmail.com wrote: Hi All, I have downloaded one application from adroidgear.com and application is not given in the form of simple source code or .apk file but given a folder which contains 1) META-INF 2)res 3)android-manifest.xml 4)resources.arsc 5)classes.dex even I cant see the conents of android-manifest.xml. what to do to run this application?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---