I dont know what happen , at first it is running now
i have this error this is my code:
I dont know what happen , at first it is running now i have this error this is my code:
I dont know what happen , at first it is running now i have this error this is my code:
public void allFile() {
mTempDir = Environment.getExternalStorageDirectory()
+ "/MyCameraBooth/Photo/";
File mTempFile = new File(mTempDir);
if (!mTempFile.exists()) {
mTempFile.mkdirs();
}
mBackground = Bitmap.createBitmap(1800, 1200, Bitmap.Config.RGB_565);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
File f = new File(AppConstant.filepathone);
Bitmap mImageone = decodeFile(f);
File g = new File(AppConstant.filepathtwo);
Bitmap mImagetwo = decodeFile(g);
File h = new File(AppConstant.filepaththree);
Bitmap mImagethree = decodeFile(h);
File i = new File(AppConstant.filepathfour);
Bitmap mImagefour = decodeFile(i);
Map<String, Bitmap> mBgMap = new HashMap<String, Bitmap>();
mBgMap.put("Frame1", BitmapFactory.decodeResource(getResources(),
R.drawable.frameone));
mBgMap.put("Frame2", BitmapFactory.decodeResource(getResources(),
R.drawable.frametwo));
mBgMap.put("Frame3", BitmapFactory.decodeResource(getResources(),
R.drawable.framethree));
mBg = mBgMap.get(sharedpreferences.getString("getFrame", "getFrame"));
Bitmap mBack = Bitmap.createScaledBitmap(mBg, 1800, 1200, true);
Bitmap mImaget = Bitmap.createScaledBitmap(mImagetwo, 515, 360, true);
Bitmap mImageth = Bitmap
.createScaledBitmap(mImagethree, 515, 360, true);
Bitmap mImagef = Bitmap.createScaledBitmap(mImagefour, 515, 360, true);
Bitmap mImageo = Bitmap.createScaledBitmap(mImageone, 1080, 635, true);
mCanvas = new Canvas(mBackground);
mCanvas.drawARGB(255, 150, 150, 10);
mCanvas.drawBitmap(mBack, 0, 0, null);
mCanvas.drawBitmap(mImaget, 75, 75, null);
mCanvas.drawBitmap(mImageo, 75, 490, null);
mCanvas.drawBitmap(mImageth, 645, 75, null);
mCanvas.drawBitmap(mImagef, 1215, 75, null);
try {
String friendlydate = DateFormat.getTimeInstance(DateFormat.MEDIUM)
.format(new Date());
friendlydate = friendlydate.replace(':', '_');
String filename = friendlydate + ".jpg";
mBitmapDrawable = new BitmapDrawable(mBackground);
Bitmap mNewSaving = mBitmapDrawable.getBitmap();
String FtoSave = mTempDir + filename;
File mFile = new File(FtoSave);
mFileOutputStream = new FileOutputStream(mFile);
mNewSaving.compress(Bitmap.CompressFormat.PNG, 100,
mFileOutputStream);
imVCature_pic.setImageBitmap(decodeSampledBitmapFromFile(
mFile.getAbsolutePath(), 1800, 1200));
// imVCature_pic.setImageBitmap(decodeFile(mFile));
mFileOutputStream.flush();
mFileOutputStream.close();
mFileOutputStream = null;
} catch (FileNotFoundException e) {
Log.e(AppConstant.TAG, "FileNotFoundExceptionError " + e.toString());
} catch (IOException e) {
Log.e(AppConstant.TAG, "IOExceptionError " + e.toString());
}
Log.i(AppConstant.TAG, "Image Created");
}
private static Bitmap decodeFile(File f) {
try {
// Decode image size
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeStream(new FileInputStream(f), null, o);
// The new size we want to scale to
final int REQUIRED_SIZE = 150;
// Find the correct scale value. It should be the power of 2.
int scale = 1;
while (o.outWidth / scale / 2 >= REQUIRED_SIZE
&& o.outHeight / scale / 2 >= REQUIRED_SIZE)
scale *= 2;
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
o.inJustDecodeBounds = false;
return BitmapFactory.decodeStream(new FileInputStream(f), null, o2);
} catch (FileNotFoundException e) {
}
return null;
}