我有一个图像,我想使用 Volley 库将这个图像上传到我的网络服务,问题是我正在寻找如何去做但仍然没有找到。
我找到了这个,但对我不起作用:http : //develop-for-android.blogspot.com.br/2014/01/using-volley-in-your-application.html
我怎样才能做到这一点 ?
我正在尝试这个。
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) {
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
fotoPerfil = cursor.getString(columnIndex);
cursor.close();
ImageView imageView = (ImageView) findViewById(R.id.imgView);
imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath));
}
}
UploadoImageToServer upload = new UploadoImageToServer();
ApplicationController app = new …Run Code Online (Sandbox Code Playgroud)