android - startActivityForResult is not working in Fragment -


I am currently working with piece. I want to take an image from the gallery; To display this piece square. But here startActivityForResult () not working in piece

My piece square

  button loadimage = (Button) view.findViewById (R.id.loadButton); loadimage.setOnClickListener (New OnClickListener () {@Override public void onClick (View v) {// TODO Auto-generated method stub Intent i = new Intent (Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); StartActivityForResult (i, RESULT_LOAD_IMAGE);}}); Override public zero at @activityResult (integer requestcode, integer result code, intent data) {super.onActivityResult (requestCode, resultcode, data); If (requestCode == RESULT_LOAD_IMAGE & amp; amp; amp; amp; resultcode == RESULT_OK & amp; amp; zero = data!) {Ury selectedImage = data.getData (); String [] filePathColumn = {MediaStore.images.Media.DATA}; Cursor cursor = getActivity (). GetContentResolver () Query (selected image, filePathColumn, blank, empty, empty); Cursor.moveToFirst (); Int columnIndex = cursor.getColumnIndex (filePathColumn [0]); String picturecap = cursor.gate string (column index); Cursor.close (); Imgview.setImageBitmap (BitmapFactory.decodeFile (picturePath)); }}    

In the activity class:

  @ Override public null on activative result (int request code, inc. Result, result data) {super.onActivityResult (requestCode, resultcode, data); }   

In the piece:

  @Override public void onActivityResult (integer requestCode, integer resultCode, intent data) {// handle activity results here}   

begin activity results from the piece:

  intent intent = new intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE); StartActivityForResult (intent, 1);    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -