Skip to main content

Home/ Android Dev/ Group items tagged images

Rss Feed Group items tagged

Vincent Tsao

[Take a Break] 悬崖搭帐篷 - 2 views

image

fun

started by Vincent Tsao on 17 Feb 11 no follow-up yet
Vincent Tsao

Exploring the world of Android :: Part 2 « JTeam Blog / JTeam: Enterprise Jav... - 1 views

  • But in practice, you will notice that the AsyncTask is limited to 10 threads. This number is hardcoded somewhere in the Android SDK so we cannot change this. In this case it’s a limitation we cannot live with, because often more than 10 images are loaded at the same time.
    • Vincent Tsao
       
      使用AsyncTask类开辟的线程还有数量限制?必须小于10,这个倒是以前没有注意到的,要看看源代码怎么实现的
  • I’ve shown you how to improve performance of a ListView in three different ways: By loading images in a seperate thread By reusing rows in the list By caching views within a row
  • ...1 more annotation...
  • Notice that I used a SoftReference for caching images, to allow the garbage collector to clean the images from the cache when needed. How it works: Call loadDrawable(imageUrl, imageCallback) providing an anonymous implementation of the ImageCallback interface If the image doesn’t exist in the cache yet, the image is downloaded in a separate thread and the ImageCallback is called as soon as the download is complete. If the image DOES exist in the cache, it is immediately returned and the ImageCallback is never called.
  •  
    这个帖子完美解决了Image lazy load的性能问题, it works~
Kiran Kuppa

Image Loading Library - 0 views

  •  
    "In this part, we are going to talk about some image libraries using which we can load image(s) asynchronously, can cache images and also can download images into the local storage."
Vincent Tsao

Issue 1480 - android - Intent android.media.action.IMAGE_CAPTURE returns an image with ... - 0 views

  • On an HTC Hero, this EXTRA_OUTPUT doesn't even work. It doesn't put your picture in the file you specify, but it hands it to you thru a Mediastore uri. Apparently, the only way to get a full size picture is to do all camera handling in your app instead of using the IMAGE_CAPTURE intent.
  • I think Google have missed a trick on this one. They have defined standard intents for media capture, but not specified standard responses (ie. the "data" parameter in the onActivityResult Activity callback method). Other Android vendors (e.g. HTC Hero) have created their own Camera applications that handle the standard IMAGE_CAPTURE intent, but return different data & have different ways to save/return the image information. All I want is to be able to fire a IMAGE_CAPTURE intent from my own app, and get back a Uri reference to the captured image. Simple. I have no requirement to further manipulate the image .. I just need the Uri to store in my app's database for future reference.
Vincent Tsao

Android - How do I do a lazy load of images in ListView - Stack Overflow - 2 views

  • public class DrawableManager { private final Map drawableMap; public DrawableManager() { drawableMap = new HashMap(); } public Drawable fetchDrawable(String urlString) { if (drawableMap.containsKey(urlString)) { return drawableMap.get(urlString); } Log.d(this.getClass().getSimpleName(), "image url:" + urlString); try { InputStream is = fetch(urlString); Drawable drawable = Drawable.createFromStream(is, "src"); drawableMap.put(urlString, drawable); Log.d(this.getClass().getSimpleName(), "got a thumbnail drawable: " + drawable.getBounds() + ", " + drawable.getIntrinsicHeight() + "," + drawable.getIntrinsicWidth() + ", " + drawable.getMinimumHeight() + "," + drawable.getMinimumWidth()); return drawable; } catch (MalformedURLException e) { Log.e(this.getClass().getSimpleName(), "fetchDrawable failed", e); return null; } catch (IOException e) { Log.e(this.getClass().getSimpleName(), "fetchDrawable failed", e); return null; } } public void fetchDrawableOnThread(final String urlString, final ImageView imageView) { if (drawableMap.containsKey(urlString)) { imageView.setImageDrawable(drawableMap.get(urlString)); } final Handler handler = new Handler() { @Override public void handleMessage(Message message) { imageView.setImageDrawable((Drawable) message.obj); } }; Thread thread = new Thread() { @Override public void run() { //TODO : set imageView to a "pending" image Drawable drawable = fetchDrawable(urlString); Message message = handler.obtainMessage(1, drawable); handler.sendMessage(message); } }; thread.start(); } private InputStream fetch(String urlString) throws MalformedURLException, IOException { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet request = new HttpGet(urlString); HttpResponse response = httpClient.execute(request); return response.getEntity().getContent(); } }
  •  
    shared by Altchen
  •  
    呵呵.我看那框那么小还不太敢复制代码.= =!
Vincent Tsao

Lazy Loading Images in a ListView - consensus approach? - Android Developers | Google G... - 0 views

  • I haven't looked in details at the 3 other approaches but I know that a big difference between what I do in Shelves and what I've seen done in other places is how user interaction is handled. Shelves listens to scroll events on the ListView and tries to identify taps vs scrolls vs fling to always give priority to the UI. For instance, when you touch the screen to stop a fling, Shelves starts loading images, but does so only after a very short delay so that if you are touching the screen to fling some more, the fling animation won't stutter because of the extra work load. But that's details.
    • Vincent Tsao
       
      From Romain Guy, the author of Shelves app
Vincent Tsao

[筆記]讓Android emulator連intranet « 更夜 - 0 views

  • [通用部分] 如果開了一個以上的模擬器的話請自行加adb參數 0a. 先adb pull /system/etc/hosts hosts抓回local來修改。 0b. 在原本的 127.0.0.1 localhost 加上新的行,寫入你需要的對應如 192.168.1.15 mytestsite,存檔。 1. adb remount (才不會發生Read-only file system錯誤) 2. adb push hosts /system/etc/hosts
  • [2.0.1, 2.1 only] 這兩個版本會在這邊丟出錯誤訊息,分別為 failed to copy 'hosts' to '/system/etc/hosts': No space left on device failed to copy 'hosts' to '/system/etc/hosts': Out of memory 解決方法是,開啟模擬器時不要直接從 AVD Manager介面開,請下指令: $ emulator -avd youravdname -partition-size 128 接著再對這個模擬器使用上面的 hosts修改大法就不會出現錯誤了。 partition size的單位是MB,預設似乎是64。從adb shell 用 df 指令觀察的結果,/system 和 /data 都會被這個設定成這邊指定的值。而1.5, 1.6 的 image 因為剛好沒超過 64MB,還剩下一點空間,所以 hosts 還寫得進去,而 2.x 的 image 有 七萬多K,mount之後 /system 這個 partition 看起來就是全滿,剩下空間 0K。因此 hosts變肥後無法寫入,真的是因為partition爆了。事實上正常的手機確實也不需要留空間給user hack…模擬器還讓我們調參數已經很偷笑了,可惜AVD Manager 的 Start 沒地方可以設定 partition size。若有此需求的話只好麻煩一點手動下指定開emulator囉。
Vincent Tsao

List view with textviews and imageview, best practices - Android Developers | Google Gr... - 0 views

  • 1. you can look at the video from Google IO conference 2009, called Turbo charging your UI's by Romain Guy; he discussed some of the optimizations you can do when working with ListViews. 2. You can read Mark Murphy's series of ListView tutorials at android guys titled Fancy ListViews: http://www.google.co.in/url?sa=t&source=web&ct=res&cd=4&ved=0CBYQFjAD...
Vincent Tsao

[Disccuss] lasy load of images in ListView - 2 views

ah~ ,看来Diigo groups展示代码的样式得改进了.....

android "lazy load" listview tech

Vincent Tsao

sqlite3 in adb not in 2.2? - Android Developers | Google Groups - 0 views

  • Then I went ahead and installed 2.2 and now when > I type sqlite3 in the shell it says sqlite3 not found....  Any ideas? Well, it's in the 2.2 emulator image, for what that's worth. -- Mark Murphy (a Commons Guy)
  •  
    Android 2.2 的真机中不再有sqlite调试工具了? WTF! ! !
  •  
    求助于China android dev开发小组,有了解决办法: step 1: 从其他真机或者模拟器的 /system/xbin目录下copy一份 sqlite3 step 2: 进入shell执行chmod a+x sqlite3 或者 chmod 777 sqlite3 大功告成
Vincent Tsao

webView load Data problem - Android Beginners | Google Groups - 0 views

  • sagar wrote: > Hello, > I have following code to display webview's background. > wv.loadData("<html><body background=\"file:///android_asset/lbh.png > \">"+data[0],"text/html","utf-8"); > here the data[0] contains the data to be displayed... > Data is displayed fine.. > but background is not displayed. > I can only use this method..i dont knw why i can t access android > assets.. > I have placed that image in assets folder already.. Try loadDataWithBaseUrl() instead of loadData(), supplying some bogus value for the base URL (e.g., fake://why/o/why/is/this/needed).
    • Vincent Tsao
       
      用loadDataWithBaseURL接口才能访问asset中的资源文件,且baseurl不能为null
Vincent Tsao

myandroidwidgets - Project Hosting on Google Code - 0 views

  • A bunch of sample apps for Android. Simple workarounds and examples for doing things on Android. Custom Progress Bar - A customized Progress Bar for android with your own animation Drag and Drop widgets on Android Ongoing notifications on Android HTML with images in a Text View Custom Expandable List Views on Android Custom List View - Phonebook Example Custom Title Bar Android WebView, Javascrip and CSS Unzip files on Android
Vincent Tsao

Android SDK Quick Tip: Sending Pictures the Easy Way - 0 views

  • Intent picMessageIntent = new Intent(android.content.Intent.ACTION_SEND);  picMessageIntent.setType("image/jpeg");    File downloadedPic =  new File(      Environment.getExternalStoragePublicDirectory(      Environment.DIRECTORY_DOWNLOADS),      "q.jpeg");    picMessageIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(downloadedPic));  
Vincent Tsao

kaeppler/droid-fu - GitHub - 6 views

  • Droid-Fu offers both support classes meant to be used alongside existing Android code, as well as self-contained, ready-to-be-used components like new adapters and widgets. The areas tackled by Droid-Fu include: application life-cycle helpers support classes for handling Intents and diagnostics better support for background tasks super-easy and robust HTTP messaging powerful caching of Objects, HTTP responses, and remote images custom adapters and views I suggest you read this introductory article, and anything that follows.
  •  
    大哥你有覺得這個比AsyncTask好用嗎?
  • ...2 more comments...
  •  
    BetterAsyncTask本质就是AsyncTask,我想在用法上应该没有太大区别 但AsyncTask有个硬伤就是它的life-cycle对当前的activity的life-cycle有依赖,容易引起FC,而BetterAsyncTask解决了这个问题,Ref: http://groups.diigo.com/group/android_related/content/introducing-droid-fu-for-android-betteractivity-betterservice-and-betterasynctask-brain-flush-2838716 当然还有其他解决办法,我自己偏向于 IntentService + Broadcast mechanism的解决方案
  •  
    難怪你會搜尋到我布落格 呵呵
  •  
    哈哈,其实是我几个月前看了你的blog后,才有了更多的认识的
  •  
    在我最近的案子裡 幾乎很少機會用到IntentService。 我目前唯一用到的是AsyncTask, 而且那還是我硬用,才有機會用到它。
1 - 20 of 21 Next ›
Showing 20 items per page