Android 如何将多个图像上载到不同的ImageView?

Android 如何将多个图像上载到不同的ImageView?,android,xml,image-uploading,Android,Xml,Image Uploading,我需要上传2个不同的图像在不同的图像视图。如何上传 这是我的xml示例文件 <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" > <ImageView android:id="@+id/uivProfileImage"

我需要上传2个不同的图像在不同的图像视图。如何上传

这是我的xml示例文件

<RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1" >

      <ImageView
        android:id="@+id/uivProfileImage"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginLeft="10dp"
        android:layout_marginStart="10dp"
        android:adjustViewBounds="true"
        android:contentDescription="@null"
        android:maxHeight="100dp"
        android:maxWidth="100dp"
        android:scaleType="fitXY" />

    <ImageView
        android:id="@+id/uivProfileCoverImage"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_toRightOf="@+id/uivProfileImage"
        android:adjustViewBounds="true"
        android:contentDescription="@null"
        android:maxHeight="100dp"
        android:scaleType="fitXY" />

</RelativeLayout>

例如,使用
请求代码
来区分单击了哪个ImageView

Intent intent = new Intent(
                    Intent.ACTION_PICK,
                    android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

startActivityForResult(intent, PICK_FIRST_IMAGE);
其中,
PICK_FIRST_IMAGE
的int值等于100

Intent intent = new Intent(
                        Intent.ACTION_PICK,
                        android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

startActivityForResult(intent, PICK_SECOND_IMAGE);
其中,
PICK_SECOND_IMAGE
的int值等于101

然后在onActivityResult中执行如下操作:

public void onActivityResult(int requestCode, int resultCode,
            Intent data) {
            if (resultCode == Activity.RESULT_OK) {

                ...

                if(requestCode == PICK_FIRST_IMAGE)
                    firstImageView.setImageBitmap(yourSelectedImage);
                else
                    secondImageView.setImageBitmap(yourSelectedImage);
            }

指定您的问题..您只能在此imageview中放置静态图像..从何处从服务器或在应用程序中上载?我在SharedPreference中存储了本地路径,并在imageview中显示了从SAHREDPreference。点击图片后,它会要求我上传图片或从图库上传,点击更新按钮后,它会上传到服务器。那个么,你们在这方面遇到了什么问题@在我必须在另一个ImageView中设置另一个图像后,VasudevM.vya使用OnActivityResult()在ImageView中设置第一个图像。如何设置该图像?