memory - What is an Efficient way to load apk icons in Android? -


i working on small file manager helping me learn android development , ran few issues loading apk icons apk files. trying load icon assoicated apk. planning on loading in adapter.

here method using:

  public bitmap getapkbitmap(file f) {         packageinfo packageinfo = getcontext().getpackagemanager().getpackagearchiveinfo(f.getabsolutepath(), packagemanager.get_activities);         applicationinfo appinfo = packageinfo.applicationinfo;         if (build.version.sdk_int >= 8) {             appinfo.sourcedir = f.getabsolutepath();             appinfo.publicsourcedir = f.getabsolutepath();         }         drawable icon = appinfo.loadicon(getcontext().getpackagemanager());         bitmap bmpicon = ((bitmapdrawable) icon).getbitmap();         return bmpicon;     } 

problem:

it works ok, problem whenever have lot of apks, or scroll little fast, app crashes , run few memories. plus whenever scrolling, laggy , isn't smooth @ all.

you need implement lazylist show images on demand. solve memory problem.

another thing consider scale images down if big. solve laggy list problem.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -