我的代码是:
public Bitmap loadPhoto(Uri uri) {
Bitmap scaled = null;
try {
scalled = Bitmap.createBitmap(
MediaStore.Images.Media.getBitmap(getContentResolver(), uri),
0,0,90, 90);
if (scaled == null) { return null; }
} catch(Exception e) { }
return scaled;
}
Run Code Online (Sandbox Code Playgroud)
在这之后.我在ImageView中显示缩放.每张图片都来自设备相机.
每次,我都会收到错误:我从相机显示三张照片后内存不足.怎么解决这个?
我\b在Java Regexp中尝试过(这意味着一个单词的最后一个字符),但这不起作用.
String input = "aaa aaa";
Pattern pattern = Pattern.compile("(a\b)");
Matcher matcher = pattern.matcher(input);
while (matcher.find()) {
System.out.println("Found this wiki word: " + matcher.group());
}
Run Code Online (Sandbox Code Playgroud)
有什么问题?
我像这样使用AnimationDrawable:
ImageView rocketImage = (ImageView) layout.findViewById(R.id.animation);
rocketImage.setBackgroundResource(R.drawable.progress_blue_animation);
rocketAnimation = (AnimationDrawable) rocketImage.getBackground();
rocketAnimation.start();
Run Code Online (Sandbox Code Playgroud)
此代码适用于Android 3.0/4.0/4.1/4.0,但在Android 2.2中不起作用.如何解决这个问题呢?