onactivityresult

Upload two Image Separately in onActivityResult

北城余情 提交于 2019-12-01 12:31:19
问题 I am unable to upload two separate image in Two Imageview using onActivityResult. Here when I Select ImageView one and Cope Image then image is set in Imageview. But when I select Imageview Two and it opens Gallery and When I crop image and press Ok then Imageview one gets replaced it's previous image instead that Imageview two should have the selected image and Imageview one should have same image previously selected My Activity is import java.util.Random; public class UploadBook extends

onActivityResult executing twice

那年仲夏 提交于 2019-12-01 07:31:44
From HomeActivity Im trying to get a result from CreateProfileActivity . Here what i do to start the activity Intent createProfile = new Intent(this, CreatePreacherActivity.class); startActivityForResult(createProfile, 1); Here the implementation of onActivityResult method in HomeActivity : @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { Log.d("DEV","HomeActivity is reciving data"); if (resultCode == RESULT_OK) { // this code here execute at the second call // but why there are two calls when i just call setResult once??? User

onActivityResult returning Intent data.getData(); always Null Only in Marshmallow and Lollipop

你离开我真会死。 提交于 2019-12-01 02:17:30
Read My Whole Code. It is working perfectly on every Phone except Marshmallow and Lollipop . In Marshmallow and Lollipop phones Only problem is coming in data.getData() returning null only in case of Picture Captured . It is working fine if i capture Video .I have 4 cases - Choosing Picture from Gallery and show its thumbnail in Imageview - Working Fine. Capturing Picture from Camera and show its thumbnail in Imageview - NOT WORKING in Marshmallow and Lollipop . Choosing Video from Gallery and show its thumbnail in Imageview - Working Fine. 3.Capturing Video from Camera and show its thumbnail

Fragment cannot be cast to android.app.activity

会有一股神秘感。 提交于 2019-12-01 01:58:05
I know this question has been asked before but they haven't been in the same situation I'm in. My problem I need to have my PostPhotosActivity class retainInstance. The way I'm doing that is turning it into a fragment. Unfortunately I'm always getting this error. 12-13 14:38:55.669: E/AndroidRuntime(30234): FATAL EXCEPTION: main 12-13 14:38:55.669: E/AndroidRuntime(30234): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{trade.ly.tradely/trade.ly.tradely.PostPhotosActivity}: java.lang.ClassCastException: trade.ly.tradely.PostPhotosActivity cannot be cast to android.app

Fragment cannot be cast to android.app.activity

北城余情 提交于 2019-11-30 21:10:52
问题 I know this question has been asked before but they haven't been in the same situation I'm in. My problem I need to have my PostPhotosActivity class retainInstance. The way I'm doing that is turning it into a fragment. Unfortunately I'm always getting this error. 12-13 14:38:55.669: E/AndroidRuntime(30234): FATAL EXCEPTION: main 12-13 14:38:55.669: E/AndroidRuntime(30234): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{trade.ly.tradely/trade.ly.tradely

Handle data from several activities in one onActivityResult()?

徘徊边缘 提交于 2019-11-30 20:51:29
I wonder if it's possible to handle data from e.g. activity 2 and activity 3 in activity 1 that have one onActivityResult() , or do I need to have one method for each activity that return data? Activity 1 is the main activity for the application. Activity 1: // Handle return value from activity protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { String imageId = data.getExtras().getString("imageId"); // Do something if data return from activity 2 ?? // Do something if data return from activity 3 ?? } } Activity 2 Intent intent

Android: why is CardView not updating with new user input?

痴心易碎 提交于 2019-11-30 10:01:35
问题 I have a RecyclerView that creates CardView s from user input (via two EditTexts). I am able to create the new Cards properly. The first CardView shows the two user input fields correctly. When I create the second CardView it shows up correctly on the layout but the two data input fields are not correct. Instead of showing the second set of two user inputs, the second CardView shows the exact same two user inputs from the first CardView . Somehow after creating the first CardView I need to

Where should onActivityResult be handled, dialog fragment, fragment, or activity?

匆匆过客 提交于 2019-11-30 09:52:36
问题 In my android app, I have a fragment where the user can add a picture, either from gallery or from camera. I've created an alert dialog and placed it in a DialogFragment. When the user chooses an option, I call startActivityForResult. My question is, where should ideally this result be handled? (i.e. where should i place onActivityResult?) In the DialogFragment class, the host fragment, or the host activity? Does it matter? 回答1: onActivityResult() will be invoked first on the Activity. After

How can I call OnActivityResult inside Fragment and how it work?

这一生的挚爱 提交于 2019-11-30 03:46:05
I want to know is it possible on onActivityResult() to use inside Fragment and if yes then how it works please explain with example. You would call: startActivityForResult(i, 1); and then: @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { //super.onActivityResult(requestCode, resultCode, data); comment this unless you want to pass your result to the activity. } Use this code in the activity. public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); Fragment fragment = (Fragment)

onActivityResult() not being called in activity

不打扰是莪最后的温柔 提交于 2019-11-29 17:26:39
I have looked at several examples and I cant find what I am doing wrong. my onActivityResult() method is not being called on my activity; TransactionFormActivity is starting up a new activity called VehicleSearchActivity which has a customListAdapter.when I click on an item in that adapter I want to pass a value back to the TransactionFormActivity . here is the code from my two activities: Code in Custom List Adapter onClick() convertView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(context, TransactionFormActivity.class); i.putExtra(