خرید بک لینک

privatevoid takeScreenshot(){
Date now =newDate();
android
.text.format.DateFormat.format("yyyy-MM-dd_hh:mm:ss", now);

try{
// image naming and path to include sd card appending name you choose for file
String mPath =Environment.getExtealStorageDirectory().toString()+"/"+ now +".jpg";

// create bitmap screen capture
View v1 = getWindow().getDecorView().getRootView();
v1
.setDrawingCacheEnabled(true);
Bitmap bitmap =Bitmap.createBitmap(v1.getDrawingCache());
v1
.setDrawingCacheEnabled(false);

File imageFile =newFile(mPath);

FileOutputStream outputStream =newFileOutputStream(imageFile);
int quality =100;
bitmap
.compress(Bitmap.CompressFormat.JPEG, quality, outputStream);
outputStream
.flush();
outputStream
.close();

openScreenshot(imageFile);
}catch(Throwable e){
// Several error may come out with file handling or OOM
e
.printStackTrace();
}
}

برچسب: نویسنده: محمد رضا جوادیان تاريخ: چهارشنبه 8 ارديبهشت 1395 ساعت: 4:53

صفحه بندی