App Widget Half 2 – CONFIGURATION ACTIVITY – Android Studio Tutorial
Partly 2 of the app widget tutorial, we add a configuration exercise to our app, which begins when our widget is dragged onto the homescreen and the place we are able to do an preliminary setup. We get our appWidgetId from the intent with the AppWidgetManager.EXTRA_APPWIDGET_ID key and might then make adjustments to this widget with assist of the RemoteViews class. We are going to give the consumer the choice to set his personal button textual content and as within the final video we set a PendingIntent to our button which can open our MainActivity when clicked. We may also save the button textual content to SharedPreferences after which end our exercise with RESULT_OK and go the appWidgetId again. In case we do not get handed a sound id, our appWidgetId shall be set to AppWidgetManager.INVALID_APPWIDGET_ID.
In our AppWidgetProvider class we retrieve the button textual content from shared preferences in our onUpdate technique and reset it along with the pending intent to our button.
In our AndroidManifest.xml file we’ve got to set the android.appwidget.motion.APPWIDGET_CONFIGURE intent filter for our config exercise and within the data xml file we’ve got so as to add the android:configure attribute.
Watch the entire playlist:
https://www.youtube.com/playlist?checklist=PLrnPJCHvNZuDCoET8jL2VK4YVRNhVEy0K
Instance code:
https://codinginflow.com/tutorials/android/app-widget/part-2-configuration-activity
____________________
❗ Subscribe to the channel:
https://www.youtube.com/c/codinginflow?sub_confirmation=1
🎓 Discover extra tutorials and programs on my web site:
https://codinginflow.com
💻 Rent me to your subsequent venture:
https://codinginflow.com/contact
📨 Subscribe to the Coding in Move e-newsletter:
https://codinginflow.com/e-newsletter
💚 Donate to Coding in Move with a message:
https://paypal.me/codinginflow
❓ Ask your programming questions in our chat:
https://discord.gg/TSnMvmc
📣 Comply with Coding in Move on different websites:
Fb: https://www.fb.com/codinginflow
Instagram: https://www.instagram.com/codinginflow
Twitter: https://twitter.com/codinginflow
Github: https://github.com/codinginflow
⌨️ My gear and instruments:
Microphone: https://geni.us/PlNj0
Mouse: https://geni.us/4QHGbA
Keyboard: https://geni.us/uBUTsA
Desk: https://geni.us/oWlUHTu
Monitor: https://geni.us/Cu0C
Webcam: https://geni.us/cfMB0T
Display screen recorder: https://www.techsmith.com/video-editor.html
(above hyperlinks are affiliate hyperlinks, which signifies that I earn a small fee if you happen to purchase by way of them with NO further prices to you.)
source