在onActivityResult方法中使用startActivityForResult调用Intent以及如何处理结果

时间:2013-08-22 07:58:29

标签: android

public void onActivityResult(int paramInt1,int paramInt2,Intent paramIntent)         {           super.onActivityResult(paramInt1,paramInt2,paramIntent);           if((paramInt2 == -1)&&(paramInt1 == RESULT_LOAD_IMAGE))           {             Uri localUri = paramIntent.getData();             if(localUri!= null)             {                 Uri selectedImage = paramIntent.getData();                 String [] filePathColumn = {MediaStore.Images.Media.DATA};

            Cursor cursor = getContentResolver().query(selectedImage,
                    filePathColumn, null, null, null);
            cursor.moveToFirst();

            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            filePath = cursor.getString(columnIndex);
            // Log.e("file path", "" + filePath);
            cursor.close();

            setphoto = BitmapFactory.decodeFile(filePath);
          Intent localIntent = new Intent(this, MakePhoto.class);
          localIntent.setData(localUri);
          Util.fristPhoto = setphoto;
          localIntent.putExtra("MaxResolution", this.maxResolution);
          startActivityForResult(localIntent, 2);

} }

0 个答案:

没有答案