onactivityresult

OnActivityResult not called after startIntentSenderForResult

左心房为你撑大大i 提交于 2019-12-05 09:44:57
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.app.Activity; import android.app.Fragment; import android.content.Intent; import android.content

Passing onActivityResult in Cordova

风格不统一 提交于 2019-12-04 23:35:09
问题 Does Cordova have any automatic way to pass onActivityResult to its CordovaPlugin classes? Here's my current file, doing it manually: package com.myapp; import android.os.Bundle; import org.apache.cordova.*; import android.content.Intent; import com.flyingsoftgames.googleplaytoken.GooglePlayToken; public class MyApp extends CordovaActivity { @Override protected void onActivityResult (int requestCode, int resultCode, Intent data) { GooglePlayToken.runOnActivityResult (requestCode, resultCode,

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

血红的双手。 提交于 2019-12-04 18:35:58
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.onActivityResult(reqCode, resCode, data); if(reqCode == ENTER_DATA_REQUEST_CODE && resCode == RESULT_OK){

Android Fragment 常见问题及解决方案

∥☆過路亽.° 提交于 2019-12-04 18:18:16
Fragment(主要探讨的是support库中的Fragment) Fragment的主要意义就是提供与Activity绑定的生命周期回调 Fragment不一定要向Activity的视图层级中添加View. 当某个模块需要获得Activity的生命周期回调的时候,就可以考虑通过Fragment来实现. 例如: DialogFragment, 调用show方法来显示一个Dialog(这个一个子Window,并不在Activity的视图层级中),当旋屏时,DialogFragment利用onDestroyView回调来dismiss Dialog,然后Activity重建之后,DialogFragment利用onStart回调再显示Dialog 当然,我们也可以创建一个完全没有UI的Fragment,比如BackgroundWorkerFragment,在onResume的时候执行一个Task,在onPause的时候暂停一个Task Fragment 生命周期 Fragment的生命周期非常复杂,分为以下几种情况: 如果是通过XML中的 <fragment/> 标签实例化的,那么第一个收到的回调将是 onInflate 如果 setRetainInstance(true) ,那么当Activity重建时,Fragment的 onDestroy

Video selection from gallery: Limit only videos up to 30 seconds should be selected

China☆狼群 提交于 2019-12-04 16:16:48
How can I control videos up to 30 seconds should be selected else show Toast/Popup. I can get video's path in onActivityResult and can run video but can't get duration. Any suggestion, below is my code: case Utils.REQUEST_CODE_GALLERY_VIDEO: if (resultCode == Activity.RESULT_OK) { Uri selectedVieo = data.getData(); String[] filePathColumn = { MediaStore.Video.Media.DATA }; Cursor cursor = getContentResolver().query(selectedVieo, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String filePath = cursor.getString(columnIndex);

how to start google map for result

十年热恋 提交于 2019-12-04 12:40:45
I want my user to enter an address. But I want the address to be confirmed with Google Map. So when the user clicks on a button to enter the address, I want to launch an Intent for Google Map where user can enter the address. But then I want the map to return the data to me. How do I do that? If I start my activity as Uri searchUri = Uri.parse("geo:0,0?z=10&q="); Intent mapIntent = new Intent(Intent.ACTION_VIEW,searchUri); mapIntent.setPackage("com.google.android.apps.maps"); startActivityForResult(mapIntent,RESULT_CODE_LOCATION); number one, will it do what I seek? Second: how do I implement

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

别说谁变了你拦得住时间么 提交于 2019-12-04 09:32:35
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("return-data", true); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity

Wrong requestCode returned onActivityResult from another Activity

百般思念 提交于 2019-12-03 22:18:43
I have an Activity that calls another Activity , that calls some other Activities . I send to the last Activity to get a result, and then i send back the result to the fist Activity . The flow is somthing like A -> B -> C -> D -> C -> B -> A With the flow from A to D is made of startActivityForResult and the flow from D to A is made of onActivityResult . From D to B the requestCode is always the same (the one I decided), but from B to A it suddenly change from my value to a random value (in this particular case 196614). This is the code I use to call the activity B from activity A :

onActivityResult() not called

不羁的心 提交于 2019-12-03 22:11:31
onActivityResult() is not getting called. Below is my code: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // Check which request we're responding to Log.e("CALLED", "OnActivity Result"); if (requestCode == TEAM_SELECTED_REQUEST_CODE) { // Make sure the request was successful if (resultCode == RESULT_OK) { try { mySelectedTeam = getIntent().getStringExtra("teamName"); txtSelectTeamCreateMatch.setText(mySelectedTeam); } catch (Exception e) { e.printStackTrace(); } } } } Here's I'm starting the SelectTeamActivity : Intent intent=new Intent(CreateMatch

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

安稳与你 提交于 2019-12-03 18:58:41
问题 I want to know is it possible on onActivityResult() to use inside Fragment and if yes then how it works please explain with example. 回答1: 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. } 回答2: Use this code in the activity. public void onActivityResult(int requestCode, int