android-intent

Pass array in Intent using parcelable

只愿长相守 提交于 2021-02-08 10:15:22
问题 I would like to send an array of objects between activities. I want to use the parcelable interface and send the data in an intent. However I keep getting errors. I have been stuck for 2 days. Here are some details about my problem. Class A private ProjetUI[] mProjects; private final View.OnClickListener mOnClickListener = new View.OnClickListener() { @Override public void onClick(View view) { Context context = view.getContext(); Intent intent = new Intent(context, ProjetListActivity.class);

Broadcastreceiver for a downloaded image

喜你入骨 提交于 2021-02-08 10:14:51
问题 Basically I want to set a Broadcastreceiver that gets triggered when the user downloads an image into gallery/phone from chrome, facebook, twitter..etc when the photo is finished downloading , and the actions is triggered, I want access to the downloaded image for extra work such as editing and stuff..! I'm thinking this can be accomplished by Broadcastreceiver , that listens for the image and then do the actions that needed..! I've tried to search for action to be added in the Manifest

Which way is better for pass a large list of data from one activity to another activity - android?

谁说胖子不能爱 提交于 2021-02-08 08:48:39
问题 I need to pass a large list of data from one activity to another activity ,which way is better? First way(for example): ArrayList<myModel> myList = new ArrayList<myModel>(); intent.putExtra("mylist", myList); Second way(for example) : ActivityTwo act = new ActivityTwo(); act.getDataMethod(listValues); Intent i = new Intent(this, ActivityTwo.class); startActivity(i); And in another activity (ActivityTwo) I get data from getDataMethod . 回答1: Best way to pass large data list from one Activity to

Trying to start an activity from broadcast receiver

浪尽此生 提交于 2021-02-08 03:43:20
问题 I'm trying to create a lockscreen. When I try to start the com.fira.locker.LockScreenActivity from the broadcastReceiver, I just get an error. The error says: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Intent.setFlags(int)' on a null object reference This is my code: package com.fira.locker; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Environment; import

My Webview App keeps crashing for messenger chat

别来无恙 提交于 2021-02-08 02:39:34
问题 Everything works as it should except messenger. Code if (url.startsWith("www.messenger.com")) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); return true; } For messenger even for this general intent code it doesnt show the option to open with messenger if (url.startsWith("intent")){ Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_VIEW); if (sendIntent.resolveActivity(getPackageManager()) != null) { startActivity(sendIntent); }

My Webview App keeps crashing for messenger chat

断了今生、忘了曾经 提交于 2021-02-08 02:37:51
问题 Everything works as it should except messenger. Code if (url.startsWith("www.messenger.com")) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); return true; } For messenger even for this general intent code it doesnt show the option to open with messenger if (url.startsWith("intent")){ Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_VIEW); if (sendIntent.resolveActivity(getPackageManager()) != null) { startActivity(sendIntent); }

What purpose do different Intent constructors serve?

青春壹個敷衍的年華 提交于 2021-02-07 22:41:50
问题 Intent(String action, Uri uri) Create an intent with a given action and for a given data url. Intent(Context packageContext, Class<?> cls) Create an intent for a specific component. Intent(String action, Uri uri, Context packageContext, Class<?> cls) Create an intent for a specific component with a specified action and data. While it may be obvious to some, could you guys help out those of us that have a hard time "getting it"? For example, in what situation would I want 1 over the other? 回答1

What purpose do different Intent constructors serve?

南楼画角 提交于 2021-02-07 22:41:37
问题 Intent(String action, Uri uri) Create an intent with a given action and for a given data url. Intent(Context packageContext, Class<?> cls) Create an intent for a specific component. Intent(String action, Uri uri, Context packageContext, Class<?> cls) Create an intent for a specific component with a specified action and data. While it may be obvious to some, could you guys help out those of us that have a hard time "getting it"? For example, in what situation would I want 1 over the other? 回答1

Android 11 (R) return empty list when querying intent for ACTION_IMAGE_CAPTURE

柔情痞子 提交于 2021-02-07 11:55:40
问题 Device: Emulator pixel 3a - Android 11 Code: final List<Intent> cameraIntents = new ArrayList<Intent>(); final Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); final List<ResolveInfo> listCam = context.getPackageManager().queryIntentActivities(captureIntent, 0); When using: targetSdkVersion 30 compileSdkVersion 30 listCam size is 0 and when changing to: compileSdkVersion 29 listCam size is 1 - as it should be. Using the following code: val captureIntent = Intent(MediaStore

FCM Notification onclick does not open desired activity

試著忘記壹切 提交于 2021-02-07 10:39:13
问题 i have tried almost every solution posted here and combination of every flag but it is not working. Following are use cases in which i am having problems. 1) When i am in application FCM notification opens my desired activity. Data is passed to onNewIntent in main activity. It works fine when application is foreground. 2) When in background mode(presssing home button) after clicking on notification it launches new instance of my application even though i have specified android:launchMode=