Android 如何从自定义目录加载缩略图?

Android 如何从自定义目录加载缩略图?,android,thumbnails,fetch,Android,Thumbnails,Fetch,我已经搜索了很多,但我从Url或Http获取了一些样本, 但是我实际上需要从我自己的sdcard目录中获取图像的缩略图,而不需要访问Android默认缩略图目录,这就是我需要从 mnt/sdcard/myown/1.png 有人能帮忙吗 提前感谢。环境。getExternalStorageDirectory()返回“/mnt/sdcard” 您的layout.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xml

我已经搜索了很多,但我从
Url
Http
获取了一些样本, 但是我实际上需要从我自己的
sdcard
目录中获取图像的缩略图,而不需要访问
Android
默认缩略图目录,这就是我需要从
mnt/sdcard/myown/1.png

有人能帮忙吗


提前感谢。

环境。getExternalStorageDirectory()返回“/mnt/sdcard”

您的layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/android" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Change Image" />

</LinearLayout>


我也看过ImageLoade.jar和universal image loader,但我没有得到任何要求。i@Dmytro Danylyk你能告诉我如何在点击按钮时显示图像吗?我是android新手
@Override
public void onCreate(Bundle savedInstanceState) {
    button1 = (Button) findViewById(R.id.button1);
    button1.setOnClickListener(onClickListener);
    image = (ImageView) findViewById(R.id.imageView1);

}

private OnClickListener onClickListener = new OnClickListener() {
    @Override
    public void onClick(final View v) {
        switch(v.getId()){
            case R.id.button1:
            String imagePath = Environment.getExternalStorageDirectory().toString() +"/myown/1.png";
            Bitmap bitmap = BitmapFactory.decodeFile(imagePath);
            image.setImageBitmap(bitmap);
            break;
        }
    }
};
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/android" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Change Image" />

</LinearLayout>