2013年9月1日星期日

android how to browse a folder of picture

android how to browse a folder of pictures? To read drawable in it, or you can directly browse? Best part of the part of the buffer was read, I hope everyone gets advice
------ Solution --------------------------- -----------------
Traverse Folder called BitmapFactory.decodeFile (String pathName) read ah ~
------ Solution ----- ---------------------------------------
with Gallery component to show
------ Solution ------------------------------------------- -
ah, I have an asynchronous load images, and you look at it.
/ **
* Method name: showPapers

* Method description: asynchronous loading wallpaper

*
* @ param adapter
* @ param wallpaper
* /
private void showPapers (WallPaperAdapter adapter, ArrayList list, String wallpaper) {
ImageLoadTask task = new ImageLoadTask (list, adapter, 5);
task.execute (wallpaper);
}

package com.jftt.smart.activity.task;

import java.util.ArrayList;

import com.jftt.smart.activity.adapter.WallPaperAdapter;
import com.jftt.smart.pojo.PathName;
import com.jftt.smart.util.SceneUtil;

import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.util.Log;

public class ImageLoadTask extends AsyncTask {
private static final String TAG = ImageLoadTask.class.getSimpleName ();

private WallPaperAdapter adapter;
private ArrayList list;
private int index;

public ImageLoadTask (ArrayList list, WallPaperAdapter adapter, int index) {
Log.i (TAG, "ImageLoadTask ()");
this.list = list;
this.adapter = adapter;
this.index = index;
}

@ Override
protected void onPreExecute () {
Log.i (TAG, "onPreExecute ()");

}

@ Override
protected Void doInBackground (String. .. papers) {
Log.i (TAG, "doInBackground ()");

String selectedpaper = papers [0];
BitmapFactory.Options options = new BitmapFactory.Options ();
options.inSampleSize = 16;

for (int i = index; i PathName bean = list.get (i);
bean.image = SceneUtil.decodeBitmap (bean.path, options);
if (selectedpaper! = null && selectedpaper.equals (bean.path)) {
bean.checked = true;
}
publishProgress (bean);
}

return null;
}

@ Override
public void onProgressUpdate (PathName. .. beans) {
Log.i (TAG, "onProgressUpdate ()");
if (isCancelled ()) {
return;
}
PathName bean = beans [0];
adapter.add (bean);
adapter.notifyDataSetChanged ();
}

@ Override
protected void onPostExecute (Void result) {
Log.i (TAG, "onPostExecute ()");
}
}


------ reference ------------------------------------ ---
then later how to get images like mobile browser for browsing as it is that you can slide around a browser?
------ reference --------------------------------------- < br> Do not drawable
Do not decode
first take thumbnail
usually have their own cache management mechanisms.
------ reference --------------------------------------- < br> Will the program can call the system directly browse a folder under the picture or video? android system comes with picture browsing seems to only display a picture, I need to display a folder of images, but only shows this folder. I do not know how to do?
------ reference --------------------------------------- < br> landlord to solve this problem yet, hoping to get your help, my number is 1297234270@qq.com

Thank you.
------ reference --------------------------------------- < br> with demand ah landlord 463224714@qq.com
------ reference ------------------------- --------------
landlord seeking the same, thank you, 503323409@qq.com
------ reference ------------ ---------------------------
helpless! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !

没有评论:

发表评论