2010-07-01 123 views
1

嗨,我有一個圖像是從andorid通過調用圖像_capture 如何將其上傳到Windows服務器?如何上傳從android手機調用攝像頭拍攝的圖像?

 Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); 
      startActivityForResult(intent, 0); 


     public void onActivityResult(int requestCode, int resultCode, Intent data) { 

super.onActivityResult(requestCode, resultCode, data); 


if (resultCode == RESULT_CANCELED) { 
Toast toast = Toast.makeText(this,"camera cancelled", 10000); 
toast.show(); 
return; 
} 

// lets check if we are really dealing with a picture 

if (requestCode == 0 && resultCode == RESULT_OK) 
{ 

    Bundle extras = data.getExtras(); 
     Bitmap b = (Bitmap) extras.get("data"); 
     //setContentView(R.layout.main); 

     ImageView mImg; 
     mImg = (ImageView) findViewById(R.id.head); 
     mImg.setImageBitmap(b); 
    // save image to gallery 
    String timestamp = Long.toString(System.currentTimeMillis()); 
    MediaStore.Images.Media.insertImage(getContentResolver(), b, timestamp, timestamp); 

} 
+0

問題是什麼?你要上傳到哪裏? – Fedor 2010-07-01 10:13:28

+0

嗨,我有一個圖像,這是從調用圖像_capture從andorid如何將其上傳到Windows服務器? – 2010-07-01 10:18:53

回答

1

我建議你從圖庫活動中調用圖像捕捉活動。原因是你將有完整大小的圖像,將存儲在默認位置,所以當你完成畫廊活動,你將有路徑到完整大小的圖像。意圖不旨在將巨大的文件傳遞給另一個活動。我也看到相機拍攝的圖像(通過android.media.action.IMAGE_CAPTURE)尺寸很小。所以請參閱我的blog,它可以幫助您完成圖像捕獲和上傳任務。

相關問題