android-intent

Sending an update broadcast to an app widget

僤鯓⒐⒋嵵緔 提交于 2020-05-26 04:19:25
问题 I have an app widget with a configure activity, and I want to trigger an update to the widget when an OK button in the activity is clicked. I wrote this code: Intent initialUpdateIntent=new Intent(AppWidgetManager. ACTION_APPWIDGET_UPDATE); initialUpdateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetID); sendBroadcast(initialUpdateIntent); But for some reason the onUpdate function is not called! Does anyone know what the problem might be? Thanks. 回答1: Try the following: public

Sending an update broadcast to an app widget

折月煮酒 提交于 2020-05-26 04:19:06
问题 I have an app widget with a configure activity, and I want to trigger an update to the widget when an OK button in the activity is clicked. I wrote this code: Intent initialUpdateIntent=new Intent(AppWidgetManager. ACTION_APPWIDGET_UPDATE); initialUpdateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetID); sendBroadcast(initialUpdateIntent); But for some reason the onUpdate function is not called! Does anyone know what the problem might be? Thanks. 回答1: Try the following: public

Get text content of the android screen

若如初见. 提交于 2020-05-25 12:03:52
问题 Is there any way to get the text content that is being displayed on the android mobile screen. It may be by any android app. for example in the image linked above, i wish to get all the text (starting from the "Larry Page" till the end "Fred Smith" and also the position of all the words on the screen) that is in the image and its respective position on the screen. 回答1: This can be achieved using the Accessibility feature of Android (as the Universal copy app does). What you need to do is

How to open WhatsApp using an Intent in your Android App

老子叫甜甜 提交于 2020-05-25 03:36:49
问题 I want an Intent to take control you directly to WhatsApp. So the moment the user clicks on the button, the Intent is supposed to take you to WhatsApp. This is the code I wrote after following a few guide lines but it doesn't work buttonWhatsapp.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Performs action on click Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");

How to add an item to the text selection popup menu?

狂风中的少年 提交于 2020-05-23 10:17:51
问题 When the user marks some text (inside of an EditText , WebView ...) a floating text selection popup appears, where apps can add custom items. Can someone please give me an example, how to add an item to this popup menu which makes an intent and transfers the selected String to my activity. 回答1: This blog tutorial will show you how: https://medium.com/google-developers/custom-text-selection-actions-with-action-process-text-191f792d2999 Basically, in your Manifest file, add PROCESS_TEXT intent

How to make notification intent resume rather than making a new intent?

旧巷老猫 提交于 2020-05-19 08:32:09
问题 What i have here is a simple webview activity that when loaded it auto displays an ongoing notification. The idea is that people can navigate away from this activity and quickly access it again from any screen they want by pulling down the drop down menu and selecting it. Then when they want they can just close the notification by hitting the menu button and hitting exit and then the notification clears. This all works fine. However, when the notification is pressed it starts a new instance

How to make notification intent resume rather than making a new intent?

此生再无相见时 提交于 2020-05-19 08:30:26
问题 What i have here is a simple webview activity that when loaded it auto displays an ongoing notification. The idea is that people can navigate away from this activity and quickly access it again from any screen they want by pulling down the drop down menu and selecting it. Then when they want they can just close the notification by hitting the menu button and hitting exit and then the notification clears. This all works fine. However, when the notification is pressed it starts a new instance

Pass a mutableList from activity A to activity B in Kotlin.

南楼画角 提交于 2020-05-14 23:59:36
问题 I'm trying to pass data from activity A to activity B through intent in Kotlin. The problem is I have a videos: MutableList<Video> and the intent.putParcelableArrayListExtra("VIDEOS", videos) only accepts ArrayList<out Parcelable> as arguments. Questions *. How do I send a mutableList data from activity A to activity B ? *. Or Do I have to convert it to ArrayList<Video> ? PS: Video implements Parcelable 回答1: Converting it to an ArrayList (or storing it as one in the first place?) is the easy

Pass a mutableList from activity A to activity B in Kotlin.

一笑奈何 提交于 2020-05-14 23:52:14
问题 I'm trying to pass data from activity A to activity B through intent in Kotlin. The problem is I have a videos: MutableList<Video> and the intent.putParcelableArrayListExtra("VIDEOS", videos) only accepts ArrayList<out Parcelable> as arguments. Questions *. How do I send a mutableList data from activity A to activity B ? *. Or Do I have to convert it to ArrayList<Video> ? PS: Video implements Parcelable 回答1: Converting it to an ArrayList (or storing it as one in the first place?) is the easy

Pass a mutableList from activity A to activity B in Kotlin.

好久不见. 提交于 2020-05-14 23:52:11
问题 I'm trying to pass data from activity A to activity B through intent in Kotlin. The problem is I have a videos: MutableList<Video> and the intent.putParcelableArrayListExtra("VIDEOS", videos) only accepts ArrayList<out Parcelable> as arguments. Questions *. How do I send a mutableList data from activity A to activity B ? *. Or Do I have to convert it to ArrayList<Video> ? PS: Video implements Parcelable 回答1: Converting it to an ArrayList (or storing it as one in the first place?) is the easy