android-intent

How to Pass custom object via intent in kotlin

浪子不回头ぞ 提交于 2021-02-15 09:09:34
问题 fun launchNextScreen(context: Context, people: People): Intent { val intent = Intent(context, NextScreenActivity::class.java) intent.putExtra(EXTRA_PEOPLE, (Parcelable) people) //intent.putExtra(EXTRA_PEOPLE, people as Parcelable) //intent.putExtra(EXTRA_PEOPLE, people) // tried above all three ways return intent } I tried the above code to pass an instance of the People class via intent using kotlin, but I am getting an error. What am I doing wrong? 回答1: First, make sure the People class

How to Pass custom object via intent in kotlin

守給你的承諾、 提交于 2021-02-15 09:07:31
问题 fun launchNextScreen(context: Context, people: People): Intent { val intent = Intent(context, NextScreenActivity::class.java) intent.putExtra(EXTRA_PEOPLE, (Parcelable) people) //intent.putExtra(EXTRA_PEOPLE, people as Parcelable) //intent.putExtra(EXTRA_PEOPLE, people) // tried above all three ways return intent } I tried the above code to pass an instance of the People class via intent using kotlin, but I am getting an error. What am I doing wrong? 回答1: First, make sure the People class

Why would an Android Open File intent hang while opening an image?

与世无争的帅哥 提交于 2021-02-11 17:45:21
问题 My Problem: When openFile() intent attempts StartActivityForResult , the application hangs with a blank screen and circular cursor. The file(s) are stored to app. What I have done: Before and after this issue I researched how to open files by use of Intents. I found a number of similar but different approaches and either used the literal example or a combination of various examples to see if I could find and resolve the issue (see some below). I'm not receiving any type of error message that

Why would an Android Open File intent hang while opening an image?

情到浓时终转凉″ 提交于 2021-02-11 17:45:01
问题 My Problem: When openFile() intent attempts StartActivityForResult , the application hangs with a blank screen and circular cursor. The file(s) are stored to app. What I have done: Before and after this issue I researched how to open files by use of Intents. I found a number of similar but different approaches and either used the literal example or a combination of various examples to see if I could find and resolve the issue (see some below). I'm not receiving any type of error message that

Intent to read both .xls and xlsx files in Android?

被刻印的时光 ゝ 提交于 2021-02-11 15:15:49
问题 My intent picks .xls while fileintent.setType("application/vnd.ms-excel"); Picks .xlsx while fileintent.setType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); How to make both .xls and .xlsx selectable and readable? Appreciate help! 回答1: For .xls and .xlsx extensions, Mimetypes are clubbed. Intent intent; String[] mimetypes = { "application/vnd.ms-excel", // .xls "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" // .xlsx }; intent = new Intent(Intent

The method putStringExtra(String, String) is undefined for the type Intent

∥☆過路亽.° 提交于 2021-02-11 12:53:27
问题 I am trying to fix an issue I do not understand. I get an error "The method putStringExtra(String, String) is undefined for the type Intent" in line 4 inside my onItemClick method. What could be the reason for this? public void onItemClick(AdapterView<?> adapter, View arg1, int position, long arg3) { String item=adapter.getItemAtPosition(position).toString(); Toast.makeText(Activity.this, "You Click on:"+item, Toast.LENGTH_SHORT).show(); Intent intent = new Intent(this, MyOtherActivity.class)

Launching another activity from a Trusted Web Activity (TWA)

ⅰ亾dé卋堺 提交于 2021-02-11 12:42:48
问题 I have problems trying to launch another activity from the TWA via the intent URI. "intent://#Intent;scheme=subscriptionschemetwa;package=com.package.www.twa;end" The package name is unique in reality, of course. I've played around with them, added host, action, extras etc. to URI, but nothing had an effect. As I'm new to native development, I'd appreciate some help. The app itself is not publicly available on Google Play yet (only internally), it's signed and packaged with Bubblewrap, and

onCreate called despite using FLAG_ACTIVITY_REORDER_TO_FRONT

时光毁灭记忆、已成空白 提交于 2021-02-10 22:17:21
问题 I have 2 activities (A and B) and they have 2 buttons to switch between. A oncreate B oncreate A oncreate A onresume what I wanted to do is after sending intent from B to A oncreate should not be called but at this point it does. To overcome that I found FLAG_ACTIVITY_REORDER_TO_FRONT (from here) and thought it could called only onresume but it didn't. 回答1: FLAG_ACTIVITY_REORDER_TO_FRONT does exactly what you think it should do. However, if you start ActivityA and then ActivityA starts

onCreate called despite using FLAG_ACTIVITY_REORDER_TO_FRONT

心不动则不痛 提交于 2021-02-10 22:13:19
问题 I have 2 activities (A and B) and they have 2 buttons to switch between. A oncreate B oncreate A oncreate A onresume what I wanted to do is after sending intent from B to A oncreate should not be called but at this point it does. To overcome that I found FLAG_ACTIVITY_REORDER_TO_FRONT (from here) and thought it could called only onresume but it didn't. 回答1: FLAG_ACTIVITY_REORDER_TO_FRONT does exactly what you think it should do. However, if you start ActivityA and then ActivityA starts

onCreate called despite using FLAG_ACTIVITY_REORDER_TO_FRONT

混江龙づ霸主 提交于 2021-02-10 22:10:40
问题 I have 2 activities (A and B) and they have 2 buttons to switch between. A oncreate B oncreate A oncreate A onresume what I wanted to do is after sending intent from B to A oncreate should not be called but at this point it does. To overcome that I found FLAG_ACTIVITY_REORDER_TO_FRONT (from here) and thought it could called only onresume but it didn't. 回答1: FLAG_ACTIVITY_REORDER_TO_FRONT does exactly what you think it should do. However, if you start ActivityA and then ActivityA starts