android - optimizing bitmap loading by using aSyncTask -
I'm trying to optimize my single thread app that loads a big bitmap makeup to a bunch of tiles is. This app was very slow when it would load the new tile in the system timer. Im now trying to use Async's work for this purpose, the app detects that in a method called by ODW, what is the tile at the top left, creates a string that has a bitmap path in the Asset folder, And to see if there is a bitmap tap before drawing. If it is empty, it will load it in memory. I thought it was processing at bitmap in DoBackground, and a view is invalid for displaying async loaded bitmap in postExecute. Some questions:
1.) Can I perform my SSCC work for each bitmap? (This statement: New myAsyncTaskManager (). Execute (bitmap path); If not, what is the best way to go about it because a sync that only does the same thing, can it load the bitmap in memory only?
2.) Is it possible to set a SICTT preference to slow down loads of betamaps?
3.) Is there a better way to go about this? It is certain that this is a bitmap loading, and canvas drawing which slows down the app.
My temporary one sync code:
private class myAsyncTaskManager AsyncTask & lt; String, zero, string & gt; {@Override protected string doInBackground (string ... bitmap path) {Log.e ("sys", "I was using a task"); {BitmapArray [rectBeingDrawn] = Try BitmapFactory.decodeStream (assetManager.open (imagePathToLoad)); } Grip (IOException E) {// TODO Auto-Generated Catch Block e.printStackTrace (); } Return tap; } @ Override Protected Zero on postextech (string result) {// execution mcampusMap.invalidate () as a result of long-running consumption operations; }}
adding a new answer to your completely new question :)
-
Depending on the amount of bitmap you have so much? You do not want to create dozens threads. After all, you have only one core on your hardware, so with many threads you will not have to buy anything - reference switching will only let it drown if you have a lot of bitmap, then you can use bitmap Wanted and can work through it. For this, a thread and handler would really be better.
-
It is. Normally, I lower the worker thread to a priority level with the main thread.
Comments
Post a Comment