我有一个列表视图,每行都有一些日期和文本.我可以将这个listView分组到iPhone中,并在它们之间使用标题组.这在android中是可能的.请帮忙.即我需要在Listview行之间有标题栏,以便每个标题下面的行将成为一个组,如果我使用日期对其进行分组.
我的drawable文件夹中有大量资源.所有大小都超过500KB.我必须在srollView中一次性加载所有这25个图像.像往常一样,我的内存不足.有没有办法以编程方式减小图像的大小.
我有这个功能,但它的参数是一个文件,我不知道如何从drawable创建一个文件.
private Bitmap decodeFile(File f){
Bitmap b = null;
try {
//Decode image size
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
FileInputStream fis = new FileInputStream(f);
BitmapFactory.decodeStream(fis, null, o);
fis.close();
int scale = 1;
if (o.outHeight > IMAGE_MAX_SIZE || o.outWidth > IMAGE_MAX_SIZE) {
scale = Math.pow(2, (int) Math.round(Math.log(IMAGE_MAX_SIZE / (double) Math.max(o.outHeight, o.outWidth)) / Math.log(0.5)));
}
//Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
fis = new FileInputStream(f);
b = BitmapFactory.decodeStream(fis, null, o2);
fis.close();
} catch (FileNotFoundException e) … 我的应用程序有很多图像,有时由于内存不足而导致崩溃.我写了这个在开发者网站上找到的函数.
public void onLowMemory(){
}
Run Code Online (Sandbox Code Playgroud)
但问题是在低内存情况下永远不会调用此函数.我该怎么做才能调用这个函数.我需要在设备内存不足时提醒用户.
org.apache.jasper.JasperException: /index.jsp(1,1) The value for the useBean class attribute com.b5 is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1272)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1178)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Generator.generate(Generator.java:3426)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:216)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Run Code Online (Sandbox Code Playgroud)
任何人都可以解释这个问题的原因和解决方案吗?
我有一个观点.我想将位图图像作为其背景图像.我无法做到这一点.
//My code is below
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.grape);
part1 = new View(this);
Bitmap map2 = Bitmap.createBitmap(targetWidth, targetHeight,Bitmap.Config.ARGB_8888);
canvas.drawBitmap( bitmapOrg,new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()), new Rect(0, 0, targetWidth, targetHeight), null);
part1.setBackgroundResource(map2); //i couldn't place map2 as bgresource to my view part1
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?