2016-11-02 20 views
0

キャプチャ/保存した画像を電子メールに添付ファイルとして添付する方法は?カメラから画像を取り込むためカメラとギャラリーから画像を添付してメールに添付する

コード、ギャラリーから画像検索のための

capture image from camera code

コード、

image from gallery

+1

代わりにあなたのコードを画像ファイルに添付して、コードを直接テキストとして投稿してください。 –

+0

私はそれをやろうとしましたが、スタックフローが自分のコードのインデックスについて不平を言っています –

答えて

0

使用単に、画像を添付する暗黙の意思を使用することができます

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); 
    shareIntent.setType("image/jpeg"); 

    //set your subject 
    shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Email Subject"); 
    //set your message  
    shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Email Messasge"); 

    String imagePath = "specify_the_image_path_here" 

    File imageFileToShare = new File(imagePath); 
    Uri uri = Uri.fromFile(imageFileToShare); 

    shareIntent.putExtra(Intent.EXTRA_STREAM, uri); 
    startActivity(Intent.createChooser(shareIntent, "Share Image")); 
+0

public void onSelectImageGallery(インテントデータ){ Uri selectedImage = data.getData(); String [] filePathColumn = {MediaStore.Images.Media.DATA}; カーソルcursor = getContentResolver()。query(selectedImage、filePathColumn、null、null、null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn [0]); 文字列picturePath =カーソル.getString(columnIndex); cursor.close(); ivImage.setImageBitmap(mPresenter.getScaledBitmap(picturePath、50、50)); } –

関連する問題