onactivityresult

get onActivityResult on Fragment from Activity that called inside RecyclerView.Adapter

南笙酒味 提交于 2019-12-08 12:07:07
问题 okay here is my problem I have a Fragment that contains RecyclerView, and of course an adapter (called ApprovalCutiCardAdapter ) that hold the content. Inside that ApprovalCutiCardAdapter I set OnClickListener on the card, when Card is clicked it will launch an Activity called DetailApprovalCuti . Here is my code to launch the activity ((Activity) MyApplication.getmContext()).startActivityForResult(detailApprovalCutiIntent, 1); In DetailApprovalCuti I'm executing finishActivity(1) to get an

Pass bundle to if-statement

雨燕双飞 提交于 2019-12-08 08:45:25
问题 Activity Claims----> has 2 button and a textView (get the total amount) Activity Project1 and Petrol-----> one editText and a save button Activity Claims button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialogRadio(a1); } }); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialogRadio(a2); } }); public void AlertDialogRadio(final int k) { final CharSequence[] ClaimsModel = {"Project1",

Custom RecyclerAdapter and startActivityForResult

僤鯓⒐⒋嵵緔 提交于 2019-12-07 22:01:38
问题 I have a Fragment that contains a RecyclerView which uses a custom RecyclerAdapter . I have an onClickListener inside my custom RecyclerAdapter - when a position is clicked I want it to start startActivityForResult . So far this works in as such as when it is clicked it starts the Activity as desired. However when I press the back button to go to the Fragment containing the RecyclerView onActivityResult is never called. I have passed in a context to the custom RecyclerAdapter . Is this

OnActivityResult not called after startIntentSenderForResult

孤街浪徒 提交于 2019-12-07 06:49:40
问题 I'm using a launch page to "Sign in with Google". When the user has multiple accounts...after they select which account they wish to sign in with, I'm trying to launch the apps main activity, but for some reason the onActivityResult is never called in my fragment. Im the Activity, I call onActivityResult and let it call super so that the fragment can handle it, but it never fires. Any suggestions? Here is the fragment that is in question: package com.garciaericn.goodeats.login; import android

Android4.0 Message 中添加附件

可紊 提交于 2019-12-06 18:13:52
一,基本情况 不说废话,先直接上图,大致情况就是,在一则New Message中添加一些附件(图片,视频,声音等)和信息一起发送,如下图; 二,基本思路 其实,这就类似于我们的拍照上传,是采用一样的处理方法, 这里选择临时拍一张照片作为一起发送的附件,即上图中的Capture Picture。主要步骤: 1)点击Capture Picture时,会启动系统Camera应用程序来拍照;主要使用startActivityForResult (Intent intent, int requestCode)方法来启动Camera程序; 2)拍摄照片;这里就是用Camera进行拍照,这里不做介绍; 3)保存照片,并将照片数据返回给Message应用;主要用到一个setResult(int resultCode, Intent intent)方法,返回到原调用程序,关闭Camera; 4)在Message应用中处理返回的数据;重写onActivityResult(int requestCode, int resultCode, Intent data)方法来处理返回的数据; 三,具体流程 首先,我们已经启动Message-->New Message-->Attachment,在Message主活动ComposeMessageActivity中有一个addAttachment(

onActivityResult() and: failure delivering result resultinfo who=null request=1 result=-1 data=intent (has extras)

天涯浪子 提交于 2019-12-06 13:57:21
问题 I've got this method in one class filling an Intent with data and then pass it back to the activity that started the method. Here I am using the intent to add the item to my database in onActivityResult() But as the title indicates I'm getting an "failure delivering result resultinfo" error. Can anyone see why I get this error? Heres the essential part of my code: from class 1, receiving the Intent : @Override protected void onActivityResult(int reqCode, int resCode, Intent data){ super

Custom RecyclerAdapter and startActivityForResult

走远了吗. 提交于 2019-12-06 11:18:17
I have a Fragment that contains a RecyclerView which uses a custom RecyclerAdapter . I have an onClickListener inside my custom RecyclerAdapter - when a position is clicked I want it to start startActivityForResult . So far this works in as such as when it is clicked it starts the Activity as desired. However when I press the back button to go to the Fragment containing the RecyclerView onActivityResult is never called. I have passed in a context to the custom RecyclerAdapter . Is this something that is possible? Or does the Activity/Fragment initiating startActivityForResult be the one that

Always Null returned after cropping a photo from a Uri in Android Lollipop?

☆樱花仙子☆ 提交于 2019-12-06 06:11:14
问题 I tried to crop an image from a Uri after taking a photo or picking a picture. And my codes are like these: public static void cropImage(Uri uri, Activity activity, int action_code) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.setDataAndType(uri, "image/*"); intent.putExtra("crop", "true"); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("outputX", 600); intent.putExtra("outputY", 600); intent.putExtra("scale", true); intent.putExtra(

Android Image Crop Uri Exception

匆匆过客 提交于 2019-12-05 21:43:50
first up, I am using Xamarin, but the problem is the same on a native Java project. I was updating the SDK to 5.1 and encountered a strange error on code that worked fine before. imageStream = "file://" + imageStream; Mvx.Trace("path: " + imageStream); img = imageStream; try { Intent cropIntent = new Intent("com.android.camera.action.CROP"); // indicate image type and Uri var fileUri = Android.Net.Uri.Parse(imageStream); cropIntent.SetDataAndType(fileUri, "image/*"); // set crop properties cropIntent.PutExtra("crop", "true"); // indicate aspect of desired crop cropIntent.PutExtra("aspectX", 5)

Why is onActivityResult triggered before activity even starts?

霸气de小男生 提交于 2019-12-05 16:58:24
I have an app that needs to scan a barcode to get a code before it can continue. I use this code to start the scanning activity: finish = (Button) findViewById(R.id.finishButton); finish.setOnClickListener(new OnClickListener() { public void onClick(View viewParam) { /*Prompt the user to scan the barcode */ new AlertDialog.Builder(Visit.this) .setMessage("Please Scan the clients barcode to complete the visit") .setPositiveButton("Scan Barcode", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //Start the scan application Intent intent =