2011-01-31 12 views
1

カメラアプリから撮影した画像を送信するアプリを作っていますが、戻ってくる画像はサムネイルのようですが、画像全体をどのように動かすことができますか?Androidでカメラアプリを使用する場合、サムネイルだけでなく画像全体をどのように返すことができますか?

次のコードは画像を取得しますが、小さすぎます。

public class OnTheJobActivity extends Activity{ 

private static final int CAMERA_PIC_REQUEST = 1337; 
private Button takePictureButton; 
private Button sendPictureButton; 
private Bitmap thumbnail; 

/** Called when the activity is first created. */ 
@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    this.setRequestedOrientation(
      ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 
    setContentView(R.layout.onthejob); 
    takePictureButton = (Button) findViewById(R.id.takePictureButton); 
    takePictureButton.setOnClickListener(takePictureButtonListener); 
    sendPictureButton = (Button) findViewById(R.id.sendPictureButton); 
    sendPictureButton.setOnClickListener(sendPictureButtonListener); 


} 

protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
    if (requestCode == CAMERA_PIC_REQUEST) { 
    thumbnail = (Bitmap) data.getExtras().get("data"); 
    ImageView image = (ImageView) findViewById(R.id.photoResultView); 
    image.setImageBitmap(thumbnail); 
    sendPictureButton.setVisibility(Button.VISIBLE); 
    } 
} 


private OnClickListener takePictureButtonListener = new OnClickListener() { 

    @Override 
    public void onClick(View arg0){ 
     Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
     startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); 

    } 
    }; 

    private OnClickListener sendPictureButtonListener = new OnClickListener() { 

    @Override 
    public void onClick(View arg0){ 

     Intent i = new Intent(Intent.ACTION_SEND); 
     i.putExtra(Intent.EXTRA_EMAIL, "[email protected]"); 
     i.putExtra(Intent.EXTRA_SUBJECT,"On The Job"); 
     i.putExtra(Intent.EXTRA_STREAM, thumbnail); 
     i.setType("image/bmp"); 
     startActivity(Intent.createChooser(i,"Emailfile")); 

    } 
    }; 


} 
+0

愚かな質問へのアクセスに使用できるURIを返しますが、どのような解像度の画像を取るように設定されたカメラですか? – Basic

+0

それは私が戻ってきたものよりはるかに高いresを取ったので、質問 – NickTFried

答えて

0

具体的here

を示す実装を使用してみてください:

Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() { 

    public void onPictureTaken(byte[] imageData, Camera c) { 

    } 

}; 
+0

こんにちは、私は自分の活動ではなく意図を使用していますか? – hzxu

2

また、あなたは使用している意図を変更することができます。

//in your buttonListener 
ContentValues values = new ContentValues(); 
imageUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); 
//create new Intent 
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 
i.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); 

try{ 
    startActivityForResult(i, ACTIVITY_GET_IMAGE); 
} 
catch(Exception ex){ 
    Log.v("BRE", ex.toString()); 
} 
//in your activity 
protected void onActivityResult(int requestCode, int resultCode, Intent data) { 

    if(requestCode == ACTIVITY_GET_IMAGE){ 
     if(resultCode == RESULT_OK){ 
      try{String uri = data.getData().toString()} 
      catch(NullPointerException e){//do something} 
     } 
    } 
} 

これは、あなたがして、フル解像度の画像

関連する問題