我正在尝试将图片从我的Android手机上传到Flickr。从图库中挑选图像。当我运行程序时没有任何反应。
我错过了什么?
代码:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SELECT_IMAGE)
if (resultCode == Activity.RESULT_OK) {
Uri selectedImageUri = data.getData();
selectedImage = getPath(selectedImageUri);
bitmap = BitmapFactory.decodeFile(selectedImage);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(CompressFormat.JPEG, 100, bos);
bute data1[] = bos.toByteArray();
Uploder up = flickr.getUploder();
UploadMetaData uploadMetaData = new UploadMetaData();
uploadMetaData.setTitle(title);
up.upload(data1, uploadMetaData);}
public String getPath(Uri uri) {
String[] projection = { MediaStore.Images.Media.DATA };
Cursor c = managedQuery(uri, projection, null, null, null);
int column_index = c.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
c.moveToFirst();
return c.getString(column_index);
}