【发布时间】:2011-05-17 07:11:37
【问题描述】:
我有一个疑问...我不确定这是否是我的疏忽。
我正在使用 mBitmap.compress(Bitmap.CompressFormat.PNG,100, out); 将位图保存到 png 。
在代码中,此代码下方的行不会随之响应。
让我说清楚,
我在方法中的所有交替行中都给出了Log.i(xy,xy); 来跟踪问题,但是直到mBitmap.compress(Bitmap.CompressFormat.PNG,100, out); 之前的行的所有日志都打印出来,并且我已经将整个代码包含在try-catch 中,但没有发现异常。我检查了参数和对象是否为空,但不是。我在这里很困惑..请帮助...
提前致谢
Logcat
05-17 10:07:24.819: WARN/ActivityManager(73): Launch timeout has expired, giving up wake lock!
05-17 10:07:24.849: WARN/ActivityManager(73): Activity idle timeout for ActivityRecord{40968180 com.test.android.sk/.FPaint}
编辑
public String cReatePNG(){
Log.i("cp1", "in the create png");
try{
Log.i("cp2", "in the create png");
flag=true;
DataBaseHelper myDbHelper = new DataBaseHelper(this);
String pattern= "dd-MM-yyyy-HHmmss" ;
SimpleDateFormat format = new SimpleDateFormat(pattern);
String formattedDate = format.format(new Date());
Log.i("cp3", "in the create png");
tmpfile= CreateTempDir.createTempDir();
File file = new File(Environment.getExternalStorageDirectory()
+ File.separator+"/SK_Temp/img-"+formattedDate+".png");
try{
Log.i("cp4", "in the create png"+file);
FileOutputStream out = new FileOutputStream(file);
Log.i("cp5", "in the create png");
Log.i("view",out.toString());
view.mBitmap.compress(Bitmap.CompressFormat.PNG,100,out); // <----issue with this line
}catch(Exception e){ e.printStackTrace();}
Log.i("CP#file_creation", "PNG file created");
filename=file.toString();
}catch(Exception e){e.printStackTrace();}
【问题讨论】:
-
那么,您的问题是什么?图像未正确压缩/保存,或者您没有看到跟踪日志?具有更清晰解释的代码的重要部分会有所帮助。
-
我在 logcat 中没有得到任何响应。我的调试器有一些问题,它无法正常工作。
-
恐怕在你解决这个问题之前你无法继续前进。