كود التمرير
linear1.setOnTouchListener(new View.OnTouchListener() {@Override public boolean onTouch(View p1, MotionEvent p2){ switch(p2.getAction()) { case MotionEvent.ACTION_DOWN: f = p2.getX();break; case MotionEvent.ACTION_UP: t = p2.getX();if (((f - t) < -250)) {_slideLeft();} if (((t - f) < -250)) {_slideRight();}break;}return true;}});كود مشاركة الصورة
Bitmap bitmap= BitmapFactory.decodeResource(getResources(),R.drawable.my_image);
String path = getExternalCacheDir()+"/shareimage.jpg";
java.io.OutputStream out = null;
java.io.File file=new java.io.File(path);
try { out = new java.io.FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush(); out.close(); } catch (Exception e) { e.printStackTrace();
} path=file.getPath();
Uri bmpUri = Uri.parse("file://"+path);
Intent shareIntent = new Intent();
shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
shareIntent.setType("image/jpg");
startActivity(Intent.createChooser(shareIntent,"Share with"));
تعليقات: 0
إرسال تعليق