Android :: Optimizing Very Big Switch?
Mar 26, 2009I have switch with 255 cases in my project - DroidGear... How i could optimize it?
View 6 RepliesI have switch with 255 cases in my project - DroidGear... How i could optimize it?
View 6 RepliesI am developing a mobile application that involves complex image processing operations. The app is designed in Java while the core image processing ops are implemented in native code, and compiled using the Android NDK.Now, I know that native code will *not* yield any significant performance improvement over Java code, and that the NDK purpose is only to support re-use of code libs (or to quickly integrate legacy code).are there any resources/tips-n-tricks/white papers/ samples on optimizing image processing algorithms for Android? To be even more specific, I am looking out for optimizing memory operations (cache misses, memory stalls, etc.). I profiled my application code and came to the conclusion that memory issues are causing the *maximum* performance penalty. (Nothing surprising over there, it is expected, but just verified with profile data as well).
View 1 Replies View RelatedI have been trying to optimize my single thread app which loads a bunch of tiles that makeup a large bitmap.The app was becoming very sluggish when it would load the new tiles into system memory.I'm now looking trying to use Async Tasks for this purpose. The app detects which tile is in the top left in a method called by onDraw, creates a string that contains the path of the bitmap in the Assets folder, and then checks to see if the bitmap is null before drawing. If it is null, it will load it into memory. My idea was to process the bitmap in DoBackground, and in postExecute trigger a view invalidate to display the async loaded bitmap. Few questions:
1.) can i execute my aSync task for each bitmap? (this statement: new myAsyncTaskManager().execute(bitmapPath); if not, what is the best way to go about it since the only thing aSync will do is just load bitmaps into memory?
2.) Is it possible to set the priority aSyncTask if the bitmaps load too slow?
3.) Is there a better way to go about this? im certain it is the bitmap loading, and not the canvas drawing that slows down the app.
My temporary aSync code:
private class myAsyncTaskManager extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... bitmapPath) {
Log.e("sys","i ran using aTask");
try {
bitmapArray[rectBeingDrawn] = BitmapFactory.decodeStream(assetManager.open(imagePathToLoad));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} return null;
}
@Override
protected void onPostExecute(String result) {
// execution of result of Long time consuming operation
mCampusMap.invalidate()
I have list view with fairly complex list view items consisting of several image views, several text views, progress bars, etc. Depending on the state of the item some of these elements can be show and some are hidden. I understand that listview recycles views. Right now I am dealing with slow listview scrolling especially on lower powered devices. What's the best way to deal with this problem?
I already optimized each list item view as much as I could. Now I am facing with what's the best? Use one single view with many children for all items and hide and show various children depending on the item state. This way I do not inflate each item view as list is being scrolled but need to show and hide constantly various child views.
Another approach is to build item view dynamically each time view is requested in the adapter getView method. In this case I can only add at run time those elements that are truly needed for current item state but this requires inflating item view every time.
Finally the third approach is most extreme is to have one custom view and draw everything myself. This of cause requires a lot of work.
I'm looking for tips, tricks and resources on optimizing a website design for Android's browser.
I'm building an Android app and some of the functionality will be accessible through a web interface.
Who can optimize apps for tablets.
GT-N8013
I have the Optimus 2X, which seems to struggle playing flash videos that are higher than 480p, yet the Motorola Atrix which also uses the Tegra 2 SoC manages to play 720p flash videos smoothly.
Could this be caused by LG not optimizing the software properly? Would a custom ROM possibly fix this problem?
Without going crazy, I've searched the forums and haven't found many topics to address this. Apologies in advance if such topics, in face, exist.I've had my Eris for nine months, and I've never really messed with the Gmail app/storage settings much. But I'm noticing that it's taking up around 50MB of storage on the phone. I have it set to sync 2 days. I have five labels that get synced. My Inbox, and one other label, are set to "Sync all;" the other three labels are set to "Sync 2 days."Any time I try to change the settings or how many days to sync (like changing everything to 2 days, or 1 day), it winds up eating more of my phone's internal storage, but for an app to use a third of the total storage seems a bit extreme to me. My Gmail app is showing 332KB, of which, 52KB is data and 280KB is the app. There is no option to clear the cache. I can Manage Space or Clear Data, though. My Gmail storage is showing 49.89MB, of which, 276KB is the application. There is no option to clear the cache or manage space, only clear the data.Also, while I'm on the topic, is there any reason for the discrepancy between how much space the Market says a given app occupies, versus what the phone says? Example: The Market says Maps uses 4MB, or so. My phone shows it occupying twice that much space. Facebook is allegedly 1.5MB in size, but it takes up four times as much space on the phone. There is no cache to clear, and I have everything disabled that can be disabled. What's using up so much space in these apps?
View 5 Replies View RelatedHow does one use Autokiller correctly? I want to make sure I'm optimizing my system to get even more battery than I am. Typically I pull over 24 hours on a charge. Want to see if I can get over two days. Thanks in advance Nitsuj17 and Saps =P
View 5 Replies View RelatedI currently use a Nokia E71 and quite like a lot of the features I have setup on it, although in the next few months my contract is up and am interested in replacing this device with a htc desire or similar, since I think Nokia haven't delivered enough with the E72. Although, before I do I'd like to understand a bit more about what the Android platform (2.1)
View 4 Replies View RelatedCan anyone recommend an app to remotely switch off a PC (e.g. over wifi)? Off Remote does this for iPhone / iPod, and I'm trying to find an equivalent for the Nexus One.
View 3 Replies View RelatedSo I made LP my default launcher by checking the "make default" box which of course disables the choice. I'd like to switch back to ADW. Without un installing LP is there a way to switch back to ADW?
View 1 Replies View RelatedI saw a thread about this the other day, and cant find it for the life of me. basically, it lets you use swype or something in portrait, and switches to a multitouch keyboard in landscape. any idea what it was called?
View 3 Replies View RelatedHow to switch off Radio, bluetooth and wifi in android ? Can I enable airplane mode ?
View 6 Replies View RelatedI'm currently working on an application, designed around a TabActivity.Tab1 has a button and I would like when the user click it, it switches to Tab2.
View 10 Replies View RelatedI 'm beginner in Android ,To start with i was asked to do a simple task ,i need to make blue and red screen appear on the screen alternatively , to achieve this i wrote two layout files 1. main.xml -- for to display red screen 2. sub1.xml -- for to display blue screen
In oncreate() i wrote
for(int i=0;i<20;i++) { setContentView(R.layout.main); try { Thread.sleep(500); }catch(Exception e){} setContentView(R.layout.sub1); }
but this doesn't work ,why ? Please help to understand the concept
I want to block the functionality switch between Applications in my Activity. Is it possible ?
View 1 Replies View RelatedDoes anyone know whether there is an app that could automatically switch between 2G-3G? Or if anyone is working on such app. Idea would be that user could define which apps can activate 3G mode ie. browser, etc that require higher speed and after application quit's (for example with automated task killer) the phone would switch back to 2G. This would save battery without a hassle to switch manually. I know that there are widgets that takes you to switch option with few clicks, but still. Is there any technical issue that would prevent to make such app? I am not a programmer so take it easy.
View 1 Replies View RelatedIm creating a simple game using a SurfaceView for drawing the Graphics. It works fine, but now I tried to add a title screen, which is (for now) only a LinearLayout and a Start-button, specified in XML. However, when I click this button and try to switch to my SurfaceView (By doing setContentView(R.layout.game), the screen turns black. But if I do setContentView(R.layout.game) immediatly in my Activity.onCreate it works. But not if I start with my Title-screen and then try to switch
View 3 Replies View RelatedWork pays for my phone and we are switching from Sprint to At&T. I just bought a Samsung Moment at the end of last year. I'm not real hip on getting an iPhone. It looks like I'm down to 2 choices: Nexus One and Motorola Backflip.So can you help me out here on pros and cons or what would work better for me? I don't know very much, or anything at all, about cell phones.
View 2 Replies View RelatedI wanted to know how to switch beteen GPS and Network providers.Iam now busy with making a program that shows the location of the phone holder on the google map. I want to make use of both the GPS provider and the network provider. I prefer using gps. When gps is not temporarily unavailable then the program chooses for the network provider. But when the gps is available again I want the program to use the gps again.At this moment my program is only able to switch to network provider when gps is not available but it cant check whether gps is back again.
View 2 Replies View RelatedMy wife and I are on Sprint with Curves and were looking at the Evo and Epic.I am trying to find the best place to start when comparing BB features to the appropriate Android feature.Is there a place for Android for dummies?
View 8 Replies View RelatedI hope I am posting this in the right area. I am a current BB user and looking to move to Android. I would like to know what the group thinks on this question. I am looking to get either a Evo or a Galaxy Tab. I basically live on my BB. Web surfing, email (personal and work), music player, text etc. which would the group buy evo or galaxy tab. Also any idea as to what the pricing will be from Sprint on the tab?
View 8 Replies View RelatedIn android, I have a TabActivity with 2 tabs and each tab has it own activity (say ActivityA and ActivityB). When I am on ActivityA, and I click on ActivityB's tab, how does the ActivityA knows it is no longer the active Tab?
View 1 Replies View RelatedOn the 2nd of this month i switched to the Eris and I absolutely love ALMOST everything about it. The main problems I have are the lag and the no flash. The lag is a lot worse than i thought it would be. I didn't think I would mind no flash when I bought it but didn't realize how much I was going to miss not having it. From what i have read it seems like the incredible would fix both of these problems. I got the phone for only $29 because i signed up for a new two year contract. What are my opinions for switching to an incredible since i will still be in the first 30 days when the incredible is released. about how much extra will it cost me? Thanks for any tips or advice.
View 3 Replies View RelatedOK, here is my dislike about this phone. I switched to the Evo cause my DH was obsessed with getting one. I had a Blackberry for the last 2 years and one of the things I liked about the phone was ie: If I was on a call and needed to get a phone number for someone, I could put the phone on speaker, switch applications and access my address book, find the number and then go back to the phone screen. It also worked with any other application I wanted to view while on the phone. It seems that the Evo is not capable of this function.
Not sure if this was the right thread to post on but figured I'd try it. The other down side to the Evo is not having the cut and paste function. Or, is it that I just don't know how to do this yet.
I need help coming up with a way of executing the following sequence using some type of view or layout combination in Android:I have 3 image objects... say object A, B, and C...I have tried every combination of Threads, AsyncTasks, Handlers, custom layouts, AnimationListeners, etc. but everything I've tried has failed.
If only the ViewSwitcher could take more than 2 views.
Currently I have a TabHost implemented with 3 tabs each containing a separate activity. My question is how do I switch between tabs from within one of the activities that is located inside the tab host. I've looked everywhere and have been unsuccessful in finding a real answer to this problem.
View 4 Replies View RelatedIt seems like every example I can find of switching between Activity's involves creating an Intent and passing in the context of a View via an OnClickListener associated with a button.But what if you just decide you need to switch Activity's? In my case, a Preference value is causing an Activity switch. How do you create an Intent that can cause an Activity switch without an associated OnClickListener?
View 4 Replies View RelatedI'm doing a research on Cellular-WiFi switch and finding any mechanism to handle cellular hand off.As far as i've found,an http request is routed through WiFi network if connected even gprs/cellular connection is present.
My queries are:
1)Does this switch happens automatically ? If yes,which part of framework or code does that?
2)Does the http request drop in such situation due to cellular hand off ? Is there any way to handle such hand off ?
3)Does gprs cellular connection reconnects automatically when WiFi gets disconnected ?
4)Which type of alerts or notifications normally user gets in such situations ?
Yours feedback and inputs will be of great help for me in this activity.