Android :: Reduce String Allocations
Nov 11, 2010
I've managed to get my allocations down to next to nothing using DDMS (great tool), this has drastically reduced my GCs to about 1 or 2 every 3 minutes. Still, I'm not happy because those usually cause a noticeable delay in the game (on some phones) when you interact with it.
Using DDMS, I know what the allocations are, they are Strings being converted from integers used to display game information to the HUD.
I'm basically doing this:
CODE:.................
This happens once each frame update and the HUD system is modular so I plug things in when I need and this can cause 4 or 5 hud elements to allocate Strings and AbstractStringBuilders in DDMS.
Any way to reduce these further or eliminate all the String allocations and just reuse a String object?
View 2 Replies
Feb 26, 2010
I did a dumpsys meminfo of my app and each time I go in and out of my activity the asset allocations grows i.e
CODE:............
Is this a concern? What can I do to avoid this? I have a feeling this is the reason for the growing memory usage.
View 2 Replies
View Related
Sep 24, 2010
Are you meticulous in removing all per-frame heap allocations from your game? (At least the allocations that you can control and that have practical alternatives.)
While trying to reduce per-frame heap allocations from my running game, I found that method
android.opengl.Matrix rotateM(float[] m, int mOffset, float a, float x, float y, float z)
Does a heap allocation. This means maybe 10 or so extra heap allocations per frame and is the only per-frame allocation left in my application (well, the only one that I can directly control). I am thinking of replacing this with my own version - one that does not do any heap allocations.
I also had some lists that I replaced with my own list implementation because I found that some standard list iterations would create new iteration objects, putting more pressure on the heap and forcing more frequent garbage collection.
I know that I can't eliminate all the heap allocations. In particular, input seems to trigger a bunch of allocations.
I can't help but think that anything reasonable I can do to reduce pressure on the heap will improve the user's experience (if garbage collection is going to stall my game). Obviously there are diminishing returns at some point, so ultimately I have to make a judgement call.
View 8 Replies
View Related
Jul 7, 2010
In my android app, is there any way to get the total amount of memory my application is taking up, in the code. I'm using lots of large bitmaps, so it must include external allocations as well. I must, however, be able to get the number in the code, so that I can dynamically adjust to fit the budget I have.
I also need a way to get the total amount I have available (16Mb or 24Mb) as well.
View 1 Replies
View Related
Aug 3, 2010
I'm trying to use DDMS to track my allocations, but it only finds my activity if I run it on the emulator. If I run my app on my phone it can't find it, even though it finds the phone. Is there anything specific that I need to do that I might have missed?
View 9 Replies
View Related
Jun 29, 2010
I have the localized strings file that is used in the Iphone app that I work on to port to Android. Are there any tools that go through the file taken from the xcode project and build the xml needed to use the strings in android? This tool should be easy to build but I appreciate any pointers to already working tools.
View 4 Replies
View Related
Oct 1, 2010
In Android, capturing date from datepicker and storing as string in sqlite. Sorting by date doesn't work because they're strings (unless I'm doing it wrong.I've googled this issue for ~5 days, and it looks like there should be a way to capture the date from the date picker, convert it to a Long, store it in sqlite as a Long, select and sort on the Long date value, then convert the Long back to a "mm/dd/yyyy" string for display. I've tried various combinations of parse statements, Date, FormatDate, etc. with no luck at all.On activity start, get today's date and display it in button which calls the datepicker.Capture new date from datepicker (if one is entered), save it as a long to sqlite.On opening an activity showing a listview of records, select from sqlite with orderby on date (Long), convert Long to "mm/dd/yyyy" string for display in ListView.
View 3 Replies
View Related
May 5, 2009
If there's anyway way I to access the String values of String resources statically? e.g. a static equivalent of Context.getString(...)?
View 5 Replies
View Related
Nov 12, 2010
I have preferences where you can enable/disable what items will show up on the menu. There are 17 items. I made a string array in values/arrays.xml with titles for each of these 17 items.
I have preferences.xml which has the layout for my preferences file, and I would like to reference a single item from the string array to use as the title.
In the Android developer reference, I see how I can reference a single string with XML, but now how I can reference a string from an array resource in XML.
View 3 Replies
View Related
Aug 4, 2010
Can anybody give me some clue that how to convert binary string into a string(english). I have tried and googled so much but couldn't find an answer.
View 1 Replies
View Related
Jul 27, 2010
I have a class that creates a view to gather data via a function getView() that provides a view with an EditText.This class has also has variable answer.When the user chances the EditText I want to store the content of the EditText in answer.If I would use an onKeyListener I fear that the answer will probably get stored before the last letter is entered.Is there a good way to handle this in the getView() function via some other listener?
View 1 Replies
View Related
Nov 11, 2010
I have made a service which extends Service in android, and running in the background of my android app. What I want from this background service is to get the euro to dollar exchange rate from a finance website, I have my service ready, it can periodically run a function, I am now need to implement the function to get the euro-dollar rate from a website, there are many this kind of website, my question is, how can I get the currency rate as a string from the website, and pass the string to my service?
View 2 Replies
View Related
Aug 26, 2010
I have an Android app where I want to check to see if an app name that is installed matches a string passed to the function containing this code.Assuming you called checkInstalledApp('SetCPU'); and the app name on the phone is called the same thing it should return true. However, it never does. I logged the results and it should match up but it does not. Can anyone please enlighten me as to why this doesn't work?
View 3 Replies
View Related
Nov 16, 2010
Does anyone have any idea how to find the n-th field (string) in a delimited string where the delimiters (separator) could be either a single char or several chars.and the syntax for user-defined function is FindNthField(string,separator,position)so position 3 would return three,The separator in use would actually be Chr(13).This has to run on Android and so should be efficient.
View 3 Replies
View Related
Oct 28, 2009
I want to get an array of strings reading from arrays.xml file we add in android values/ folder. Could any one kindly give a solution for this. Otherwise I will have to input each these entries in strings.xml and take them to java code using getResources()getString()
View 2 Replies
View Related
Sep 7, 2010
Is it possible to have a string value in string.xml of the sort " some string PLACEHOLDER1 some more string" so that the place holders can be assigned the value at run time.
View 1 Replies
View Related
Aug 19, 2010
I have installed Power Strip, and the very first time I was asked to use my preferred home screen, I selected the existing one (using a GS).
What I want to do is to have Power String dock displayed if I do a double click on the home key. I played with the settings but it seems that it doesn't work. Any hint?
View 13 Replies
View Related
Aug 21, 2009
Many times (not all the times), my emulator is running 100% of one of my two CPUs on the machine. Can anyone tell me why it is so, and how can I reduce the cpu usage?
View 13 Replies
View Related
Aug 22, 2009
Reducing Lag Due to Location Based Services (Tested with myTouch)Only use GPS or Network Based Location services but don't have both enabled at the same time.I purchased the myTouch on 08/20/09 running Firmware 1.5 (Cupcake), Build Number COC10. I am also using the 4GB card that came with the phone.I found that Sherpa and Google maps tended be less than accurate and lagged significantly despite being in Downtown Seattle with 2 - 4 bars of service depending on building density.I also had Pedometer running (a free app from the Market). Sherpa was exteremely laggy to the point of being useless in both Carsel Mode as well as Map Mode. I didn't use Satillite nor Street View in any of my testing.
When I killed Pedometer, I found Sherpa seemed to improve a bit, but still, it was very clumsy to use due to lag. I then looked at "Security and Locations" services and saw both "Use wireless netowrks" and "GPS" enabled. I first disabled "Use wireless netowrks" and saw an immediate improvement in Sherpa. I reenabeld the Pedometer and still got a good response from Sherpa and Google Maps including reduced lag and more precise location. I then disabled GPS (and told the applications to cancel when asked to enable) and enabeld Network based services. Sherpa, Google Maps and Pedometer all responded well, location services improved in accuracy and little lag.
View 5 Replies
View Related
Sep 28, 2010
When I install my app on the phone to test, it is showing up to be a HUGE size, 11.35 MB. It is a very simple app that lets user browse through fun-facts. The only reason I can think of is that there are 14 JPEG files in the drawables which serve as background images of the fun-facts. The average size of these is about 500 KB.I'd like to trim the size of my app, so as not to use up the precious resources on the user's device. Other than just getting rid of the pictures, are there ways to optimize the size of apk file?
View 4 Replies
View Related
Mar 31, 2009
I just want to read <string-array> resource elements into a String array. I don't want to make a view or anything and mess with adapters - just want to transfer the elements. Is there a built in class for this? Or do I need to treat the resource file as a regular file?
View 3 Replies
View Related
Jul 27, 2010
There are quite some pit falls that an application developer may hit. In order to simplify life Sony Ericsson Developer world has produced a little guideline called "Android Application Coding Guidelines - Power Save".
View 2 Replies
View Related
Feb 1, 2009
In the Android phone, while I am watching YouTube videos, I may reduce the audio volume. Once I am done watching, I close all applications and leave the phone. Then when there is a incoming call, the ringer is very feeble. I may miss that call.Can you make the volume adjustment apply only for that application? I don't want the ringer volume get changed.
View 11 Replies
View Related
Jan 7, 2010
I want to reduce the boot up time of android.I have tried removing some stuff such as not required .apk from the / system/apps folder.from init.rc file some services which is not required.my kernel uncompressing is taking 11 sec almost.how can reduce that.one thing is that i can remove the drivers which are not needed but i am not finding any .config file to remove it?From where can i remove the not required driver from kernel code?What all other stuff can i remove to reduce boot up time?
View 2 Replies
View Related
Jun 2, 2010
in my application i have to read xml from web-service, it is working fine, but major problem is it is taking more time to parse data, though same data is taking less time on iPhone and Blackberry. i have similar code on blackberry it is taking less time to parse. is any fast parsing process in Android? if any body know kindly reply me.
View 3 Replies
View Related
Feb 3, 2013
I am using Eclipse for Android development and Latest version of Android SDK (Running XP, 2Gb Ram)
1. when run clicked, previously executed emulator appears first then emulator default screen appears, only last current actual output appears
2. when clicked to close takes too much time (2 mns) for the emulator to disapper
3. in short execution time exceeds development/coding time in the testing process
is anyway to reduce such execution time
View 8 Replies
View Related
Nov 7, 2010
I'm finding my screen is too bright for me to read with in bed at night, even when set to the dimmest setting and with the background black and the text brown. I had this same issue with my old Palm Tungsten E2, but there was a program that allowed the screen to be adjusted to even lower than the manufacturer's level. Is there a similar app for Android? (Actually, I find my screen too bright at the best of times, too.)
View 8 Replies
View Related
Apr 1, 2010
I added google-collect-1.0.jar to my Android project and it made a 50K .apk into a 250k .apk (both Release). This was all through using a single method Lists.newArrayList(). Is there any way to reduce the overhead?
View 1 Replies
View Related
Oct 14, 2010
I'm playing video on Android using media player via RTSP. The player takes about 12s to buffer before it starts playing. Anyone know how I can convince the player to buffer less? I have full control over the RTSP server and the SDP it returns.
View 1 Replies
View Related
Jul 9, 2009
I know the Android SDK provides many Sensor class to use to get data or do something. I already verified my driver of sensor to get data successfully under linux kernel-2.6.29 I use I2C protocol to communication with my device, so I put sensor code under drivers/i2c/chips NOW I want to add my sensor into Android and I hope to link Android Sensor class with my device to reduce develop my application. How to do for this goal? Could I need to modify application framework or Libraries or another driver type for new device? I big your help
View 3 Replies
View Related