Я пишу эти коды: при нажатии на кнопку совместного доступа, да, моя фотография на экране сохраняется на SD-карте, но когда ı нажимают share на facebook или bluetooth, он говорит, что не находит. Если я выбираю фотографию вручную, я могу поделиться, но я хочу поделиться моя фотография экрана, когда ı нажмите кнопку совместного доступа? Как я могу это сделать?как я могу поделиться своим приложением экрана, когда нажимаю кнопку?
mylayout.setDrawingCacheEnabled(true);
// this is the important code :)
// Without it the view will have a
// dimension of 0,0 and the bitmap will
// be null
mylayout.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
//v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
mylayout.layout(0, 0, mylayout.getWidth(), mylayout.getHeight());
mylayout.buildDrawingCache(true);
Bitmap bm = Bitmap.createBitmap(mylayout.getDrawingCache());
mylayout.setDrawingCacheEnabled(false); //
if (bm != null) {
try {
String path2 = Environment.getExternalStorageDirectory().toString();
OutputStream fOut = null;
File file = new File(path2, "screentest.jpg");
pathim=file.getPath();
fOut = new FileOutputStream(file);
bm.compress(Bitmap.CompressFormat.JPEG, 85, fOut);
fOut.flush();
fOut.close();
Log.e("ImagePath", "Image Path : "
+ MediaStore.Images.Media.insertImage(
getContentResolver(), file.getAbsolutePath(),
file.getName(), file.getName()));
} catch (Exception e) {
e.printStackTrace();
}
}
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse(pathim);
sharingIntent.setType("image/jpg");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "share with"));
проверить это сейчас благодаря –
спасибо это делается –
может вы говорите, как я отмечаю это изображение на facebook одновременно –