title: How to get path of selected Image from gallery
body: <p>I am creating an app to upload image to server.
  I am getting following exception while selecting the image.</p>
  
  <p>Method threw 'android.database.sqlite.SQLiteException' exception..</p>
  
  <pre><code>near "FROM": syntax error (code 1): , while compiling: SELECT  FROM images WHERE (_id=?)
  </code></pre>
  
  <p>Code to open Gallery :</p>
  
  <pre><code>  Intent intent = new Intent(Intent.ACTION_PICK);
              intent.setType("image/*");
              startActivityForResult(intent, IMAGE_PICKER);
  </code></pre>
  
  <p>On Activity Result </p>
  
  <pre><code>  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]);
          String picturePath = cursor.getString(columnIndex);
          cursor.close();
          ImageView imageView = (ImageView) findViewById(R.id.imgView);
          imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath));
  </code></pre>