onactivityresult

Android Camera OnActivityResult resets photo path to null

别来无恙 提交于 2019-11-27 08:33:41
问题 I'm having a problem while testing my app on a friends Galaxy S4 (GT i9505, Android 5.1). When giving a file URI to camera intent, OnActivityResult gives result Activity.RESULT_OK and and the path is null . It is working on most of other devices I tested (LG G3, nexus 5...). This is my code: GetOutputMediaFile public File getOutputMediaFile(int type){ File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), MediaChooserConstants.folderName);

Fragments startActivityForResult always return resultCode 0 and intent null on callback onActivityResult

£可爱£侵袭症+ 提交于 2019-11-27 08:02:03
问题 I searched all over and there are similar posts about it, but can't find a solution! My situation is I have an Activity A that holds a fragment , and from that fragment I want to start a new Activity B that should return some values to the fragment . On the fragment startActivityForResult(mapIntent, ConstantsUtils.TOMAP_REQUEST_CODE); On the Activity B, to return the data Intent returnIntent = new Intent(); returnIntent.putExtra(SerializationConstants.isSearchSaved, mAbItemsShown.ordinal());

android reduce file size for camera captured image to be less than 500 kb

核能气质少年 提交于 2019-11-27 02:35:12
问题 My requirement is to upload camera captured image to the server, but it should be less than 500 KB. In case, if it is greater than 500 KB, it needs to be reduced to the size less than 500 KB (but somewhat closer to it) For this, I am using the following code - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { try { super.onActivityResult(requestCode, resultCode, data); if (resultCode == getActivity().RESULT_OK) { if (requestCode == REQUEST_CODE_CAMERA) {

Wrong requestCode in onActivityResult

半腔热情 提交于 2019-11-26 23:24:29
I'm starting a new Activity from my Fragment with startActivityForResult(intent, 1); and want to handle the result in the Fragment's parent Activity: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "onActivityResult, requestCode: " + requestCode + ", resultCode: " + resultCode); if (requestCode == 1) { // bla bla bla } } The problem is that I never got the requestCode I've just posted to startActivityForResult() . I got something like 0x40001 , 0x20001 etc. with a random higher bit set. The docs don't say anything about this. Any ideas?

How to use onActivityResult method from other than Activity class

痞子三分冷 提交于 2019-11-26 20:52:26
问题 I am creating an app where i need to find current location of user . So here I would like to do a task like when user returns from that System intent, my task should be done after that.(Displaying users current location) So i am planning to use OnActivityResult() . protected void onActivityResult(int requestCode, int resultCode, Intent data) { } But the problem is that I don't know how can I use that method in a class which is not extending Activity. Please some one give me idea how can i

onActivityResult not call in the Fragment

放肆的年华 提交于 2019-11-26 17:01:44
问题 The structure of the app is like this: tabHost (in Activity) -> contains -> TabFragment(extend base container fragment) 1. The code in Activity : tabHost.addTab( tabHost.newTabSpec("home").setIndicator("", getResources().getDrawable(R.drawable.btn_home)), HomeFragment.class, null); 2. The code in HomeFragment (Notice that HomeFragment is not the actual function but a container like this, and it extend BaseContainerFragment): public class HomeFragment extends BaseContainerFragment { public

Wrong requestCode in onActivityResult

只谈情不闲聊 提交于 2019-11-26 08:43:17
问题 I\'m starting a new Activity from my Fragment with startActivityForResult(intent, 1); and want to handle the result in the Fragment\'s parent Activity: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, \"onActivityResult, requestCode: \" + requestCode + \", resultCode: \" + resultCode); if (requestCode == 1) { // bla bla bla } } The problem is that I never got the requestCode I\'ve just posted to startActivityForResult() . I got something