相关疑难解决方法(0)

为什么在startActivityForResult之后调用oncreate方法?

在我的应用程序中,我想从中选择图像Gallery并设置图像ListView.在我的ListView I have 16 rows. So when ever item click inListView open the gallery and set the image toListView中,. But my problem is some times afterstartActivityForResult(),oncreate()`方法被调用.这是onclick代码

Intent intent = new Intent(
                            Intent.ACTION_PICK,
                            android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                    intent.setType("image/*");
                    startActivityForResult(
                            Intent.createChooser(intent, "Select File"),
                            SELECT_PICTURE);
Run Code Online (Sandbox Code Playgroud)

这是一个非常活跃的结果

public void onActivityResult(int requestcode, int resultcode, Intent data) {
    Log.e("result", "result");
    displayMetrics = this.getResources().getDisplayMetrics();
    Ew = displayMetrics.widthPixels;
    Eh = displayMetrics.heightPixels;

    switch (requestcode) {
    case SELECT_PICTURE:
        if (resultcode == RESULT_OK) { …
Run Code Online (Sandbox Code Playgroud)

android image-gallery

9
推荐指数
1
解决办法
6641
查看次数

标签 统计

android ×1

image-gallery ×1