startactivityforresult

how to use startActivityForResult in Nativescript

别说谁变了你拦得住时间么 提交于 2019-12-11 07:21:56
问题 I use a extended activity in my old project, and I want to use startActivityForResult() in the public onCreate() function. However I don't know how to solve the error System.err: Caused by: java.lang.Exception: Failed resolving method startActivityForResult on class android.support.v4.app.FragmentActivity the code was ok. activity.startActivityForResult( intent, this.MY_PERMISSION_REQUEST ); the above code was in the public onCreate() function. but when I upgraded all the npm packges,

Upload files from phone intent

心已入冬 提交于 2019-12-11 06:07:46
问题 I've an android application where in an activity the user chooses a picture from the phone's memory to upload it to the server using the Action Pick intent Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); However; now the requirements has changed and the client wants to upload any file with any extension, what intent should I use in order to open the phone's memory (like the file manager)

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(

Android: requestCode and resultCode

若如初见. 提交于 2019-12-05 15:44:15
问题 I'm wondering if I am understanding the concepts of requestCode and resultCode properly? Basically, I have an arbitrary integer (the requestCode) associated with an activity. For example, in the Notepad tutorial, we have private static final int ACTIVITY_CREATE=0; private static final int ACTIVITY_EDIT=1; We then use startActivityforResult(intent, requestCode) to start an activity, e.g. the "create note" activity. We do something in that activity and return a resultCode. In the parent

Android: requestCode and resultCode

一世执手 提交于 2019-12-04 01:52:19
I'm wondering if I am understanding the concepts of requestCode and resultCode properly? Basically, I have an arbitrary integer (the requestCode) associated with an activity. For example, in the Notepad tutorial , we have private static final int ACTIVITY_CREATE=0; private static final int ACTIVITY_EDIT=1; We then use startActivityforResult(intent, requestCode) to start an activity, e.g. the "create note" activity. We do something in that activity and return a resultCode. In the parent activity we detect the resultCode with onActivityResult(requestCode, resultCode, intent). We can then use the

How to manage activity with startActivityForResult

给你一囗甜甜゛ 提交于 2019-11-29 17:02:11
I got a situation like this: Activity A --> B --> C --> D, when D finished, I have to refresh ActivityA to display what I input in ActivityB , ActivityC and ActivityD.Here is my code: ActivityA @OnClick(R.id.btn_one) public void toActivityB(){ Intent intent = new Intent(); intent.setClass(this, ActivityB.class); startActivityForResult(intent, 1); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == 1 && resultCode == RESULT_OK){ String b = data.getStringExtra("b"); String c = data

Check If Activity Has Been Called for Result

淺唱寂寞╮ 提交于 2019-11-28 06:40:17
Is it possible to know if some activity has been called for result, using startActivityForResult() or if was only started using startActivity() ? I need to control this, if its called for result the behaviour will be different. lopisan When your activity was started just by startActivity() a getCallingActivity() method in target activity will return null . When it was called by startActivityForResult() it will return name of calling activity. See Docs for getCallingActivity() : Return the name of the activity that invoked this activity. This is who the data in setResult() will be sent to. You

Using startActivityForResult, how to get requestCode in child activity?

你说的曾经没有我的故事 提交于 2019-11-27 17:46:47
I have four activities, say A, B, C and D. My situation is A will start the activity B by startActivityForResult. startActivityForResult(new Intent(this,B.class),ONE); In other situation i will B with other situation. like startActivityForResult(new Intent(this,B.class),TWO); In B, I need to call C or D depending on requestCode. I.e if ONE need to start C else D. So I need to know how to check the requestCode in the child Activity (B here). In other words, I want to get the request code that Activity B was started with. You can pass request code by put extra. intent.putExtra("requestCode",

Check If Activity Has Been Called for Result

血红的双手。 提交于 2019-11-27 01:26:12
问题 Is it possible to know if some activity has been called for result, using startActivityForResult() or if was only started using startActivity() ? I need to control this, if its called for result the behaviour will be different. 回答1: When your activity was started just by startActivity() a getCallingActivity() method in target activity will return null . When it was called by startActivityForResult() it will return name of calling activity. See Docs for getCallingActivity(): Return the name of

Using startActivityForResult, how to get requestCode in child activity?

送分小仙女□ 提交于 2019-11-26 19:07:00
问题 I have four activities, say A, B, C and D. My situation is A will start the activity B by startActivityForResult. startActivityForResult(new Intent(this,B.class),ONE); In other situation i will B with other situation. like startActivityForResult(new Intent(this,B.class),TWO); In B, I need to call C or D depending on requestCode. I.e if ONE need to start C else D. So I need to know how to check the requestCode in the child Activity (B here). In other words, I want to get the request code that