【发布时间】:2012-05-19 03:30:23
【问题描述】:
从 xml.as 获取 id 后我有一个 ImageView 在 ImageView 上,我们设置了打开画廊和相机选项的 clicklistener,您可以设置来自相机的图像以及画廊 #2
profileimage = (ImageView) findViewById(R.id.profileimage);
profileimage.setBackgroundResource(R.drawable.no_img);
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (resultCode == RESULT_CANCELED) {
// TODO
return;
}
Log.e("request code", "1:" + requestCode);
switch (requestCode) {
case CAMERA_SELECT:
Log.e("in camera select", "1");
// Get the camera data
cameracalling(intent);
break;
case Gallery_Select:
ongallerycalling(intent,resultCode);
}
}
private void cameracalling(Intent intent){
Bitmap photo = (Bitmap) intent.getExtras().get("data");
profileimage.setImageBitmap(photo);
}
profileimage.buildDrawingCache();
Bitmap bmap = profileimage.getDrawingCache();
ByteArrayOutputStream bao = new ByteArrayOutputStream();
bmap.compress(Bitmap.CompressFormat.JPEG, 90, bao);
byte [] ba = bao.toByteArray();
bitmapString=Base64.encodeBytes(ba);
Drawable draw = LoadImageFromWebOperations("" + objUserInformationSitesList.getProfileImage());
profileimage.setBackgroundDrawable(draw);
我们正在将位图字符串正确发送到服务器上的图像上传,但是当我们下次打开这个屏幕时,我们上传图像的 web 服务调用将提供所有数据(实际上是这个用户配置文件屏幕)。当我们设置服务器图像时默认图像也设置在背景上
objUserInformationSitesList这个对象包含了解析web服务后的所有信息。在个人资料图片后面,默认图片也是我在 #1 上设置的图片
如果我无法正确解释,请告诉我。
【问题讨论】:
标签: android