I believe many people have asked this question long time ago. Now, startActivityForResult is depreciated and I am looking for its replacement.
Previous code would be
public void onClick(View v) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(
Intent.createChooser(
intent,
"Select Image from here..."),
PICK_CODE);