0
내 활동이 SD 카드의 이미지가 포함 된 모든 폴더의 엄지 이미지와 이름을 포함하는 목록을 생성하는 지점에서 멈추었습니다. 1. 어떻게해야합니까? 이미지가있는 폴더 만 필터링 하시겠습니까? 2. 폴더의 첫 번째 이미지에서 어떻게 엄지 이미지를 얻을 수 있습니까?Android- 모든 이미지 폴더의 이름 만있는 목록 만들기
내 활동이 SD 카드의 이미지가 포함 된 모든 폴더의 엄지 이미지와 이름을 포함하는 목록을 생성하는 지점에서 멈추었습니다. 1. 어떻게해야합니까? 이미지가있는 폴더 만 필터링 하시겠습니까? 2. 폴더의 첫 번째 이미지에서 어떻게 엄지 이미지를 얻을 수 있습니까?Android- 모든 이미지 폴더의 이름 만있는 목록 만들기
How do i filter only those folders with the images
폴더의 파일 확장자를 확인하여 이미지 유형인지 확인할 수 있습니다.
How do i get the thumb images from the first image in the folder
압축 다음
public Bitmap compressBitmap(String filePath, int requiredSize)
{
File file = new File(filePath);
if (file.exists())
{
try
{
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeFile(filePath, o);
// The new size we want to scale to
final int REQUIRED_SIZE = requiredSize;
// Find the correct scale value. It should be the power of 2.
int width_tmp = o.outWidth, height_tmp = o.outHeight;
int scale = 1;
while (true)
{
if (width_tmp/2 < REQUIRED_SIZE || height_tmp/2 < REQUIRED_SIZE)
{
break;
}
width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
}
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
return BitmapFactory.decodeStream(new FileInputStream(file), null, o2);
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
return null;
}
return null;
}
를 사용하여 더 작은 사이즈로 파일