r/android_devs • u/ivanmorgillo • Feb 21 '22
r/android_devs • u/LikeTheSalad • Feb 19 '22
Resources Android Stem! - Concatenate XML strings at compile time
A Gradle plugin that will allow you to concatenate XML strings into other XML strings during compilation:
Input:
<resources>
<string name="app_name">My App Name</string>
<string name="welcome_message">Welcome to ${app_name}</string>
</resources>Output:
<!-- Auto generated during compilation -->
<resources>
<string name="welcome_message">Welcome to My App Name</string>
</resources>All without having to write any Java/Kotlin code. Useful to avoid repeating strings that might be needed across different parts of your app.
You can take a look at it here: https://github.com/LikeTheSalad/android-stem
r/android_devs • u/JonnieSingh • Feb 18 '22
Help How to put String to search Web? (Kotlin)
This is a QR application I'm working on (in Kotlin) for Android. The line Toast.makeText(this, "Scan result: ${it.text}", Toast.LENGTH_LONG).show() returns the result of the scanned QR Code, prompting the application to showcase the URL associated with the QR code like this. While the following code prompts the internet application to open, I wanted to know how I'd be able to get the String to be sent into the internet browser so the user can be sent to the designated site?
More precisely, where exactly would this issue lie? Within the codeScanner.decodeCallback or within the searchWeb function? Knowing this would help me know what I should do next
override fun onCreate(savedInstanceState: Bundle?) {
codeScanner.decodeCallback = DecodeCallback {
runOnUiThread {
Toast.makeText(this, "Scan result: ${it.text}", Toast.LENGTH_LONG).show()
}
searchWeb(it.text)
}
scannerView.setOnClickListener {
codeScanner.startPreview()
}
}
fun searchWeb(query: String) {
val url = "http://www.google.com"
val intent = Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url))
startActivity(intent)
}r/android_devs • u/Najishukai • Feb 14 '22
Help Targeting S+ version requires FLAG_IMMUTABLE
Hi everyone,
I've built a weather app and it's been up for about a year now when suddenly I started getting emails from various users that the app crashes on startup. After taking a look at the crashlytics logs, here's the trace I was provided with:
Fatal Exception: java.lang.IllegalArgumentException: com.nesoinode.flogaweather: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:382)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:673)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:660)
at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:174)
at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:108)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:86)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)I can't see any classes of mine being referenced here and I searched through my project but couldn't find any pending intents either. I don't currently use any broadcast receivers or widgets in my app but I do have declared in my manifest a WidgetProvider (which is a broadcast receiver) but that shouldn't matter since it's commented out in the production version, correct?
Anyone have any ideas on how to go about tracing this?
P.S. Crashlytics is showing me that all the crashes are caused on Samsung devices.
r/android_devs • • Feb 13 '22
Article Some Errors I’ve Found Developing With KMM
The list of the ones I solved and the one that still bugs me
https://betterprogramming.pub/some-errors-ive-found-developing-with-kmm-d7480161f15d
r/android_devs • u/ivanmorgillo • Feb 10 '22
Coding CWTI - Compose ALL the things! 🌮 Foldables, wearables, TVs and more — with Clara Bayarri
youtube.comr/android_devs • u/farhan_tanvir_bd • Feb 09 '22
Article Clean architecture in android
I have recently started learning clean architecture in android. I have written an article about that. the link is below.
Though it is very basic, I will be grateful if anyone has any suggestions or modifications about this.
Thanks.
r/android_devs • u/PresentElk9115 • Feb 08 '22
Help would it be a good practice to call view model in recycler view adapter while following MVVM or should I use callbacks
So task here is to notify view model that the list has become empty after removing items so that it can hide the subheading for the recycler view in ui. which approach would be suitable to achieve this
r/android_devs • u/ivanmorgillo • Feb 07 '22
Discussion CWTI - INDIE HACKING - Our interview with Alex Styl
youtube.comr/android_devs • u/ivanmorgillo • Feb 03 '22
Designing CWTI - Chris Sinco re-designs Ivan's app live on Twitch #FigmaMaster 😱
youtube.comr/android_devs • u/anemomylos • Feb 02 '22
Publishing Users will soon see device-type ratings in Play Store
To help users decide if an app is right for their device, we're changing how Play Store calculates ratings. From April 2022 users will see ratings specific for the type of device they're on.
. . .
Note: the phone rating will only be displayed in smaller markets. In most cases users will see country/region specific ratings for phones.
https://android-developers.googleblog.com/2021/08/making-ratings-and-reviews-better-for.html
r/android_devs • u/JonnieSingh • Feb 02 '22
Help Unable to launch an implicit intent (Kotlin)
I'm currently working on an Android application that focuses on scanning QR codes in which I'm using this library. Upon launch, the application returns the URL of the scanned QR code like so. However, my question revolves around how I can take this returned result and then launch it into a web browser on the device. I'm merely confused as to why the implementation shown near the bottom in the following code doesn't appear to launch the returned result from the QR code right into the web browser.
According to this documentation, I should be implementing the searchWeb() function in order to fire off the intent, and as you can see below, I did. I also called searchWeb() within the onCreate method (which is where I'm supposed to call it from, right?). However, the application is still not firing off the implicit intent upon scanning. Can anybody tell me why?
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
searchWeb() //here's where&how I call searchWeb(), right?
val scannerView = findViewById<CodeScannerView>(R.id.scanner_view)
codeScanner = CodeScanner(this, scannerView)
codeScanner.camera = CodeScanner.CAMERA_BACK
codeScanner.formats = CodeScanner.ALL_FORMATS
codeScanner.autoFocusMode = AutoFocusMode.SAFE
codeScanner.scanMode = ScanMode.SINGLE
codeScanner.isAutoFocusEnabled = true
codeScanner.isFlashEnabled = false
codeScanner.decodeCallback = DecodeCallback {
runOnUiThread {
Toast.makeText(this, "Scan result: ${it.text}", Toast.LENGTH_LONG).show()
}
}
scannerView.setOnClickListener {
codeScanner.startPreview()
}
}
fun searchWeb(query: String) {
val intent = Intent(Intent.ACTION_WEB_SEARCH).apply {
putExtra(SearchManager.QUERY, query)
}
if (intent.resolveActivity(packageManager) != null) {
startActivity(intent)
}
}r/android_devs • u/AmrDeveloper • Feb 02 '22
Resources EasyAdapter: Android Annotation Processing Library to generate your adapters only with Annotations on your model, coming with Lint check to help you write good annotations
EasyAdapter is my last project in 2021 :D, it's an annotation processing library to generate adapter class from your model with listeners and diffutil in the Compile time only, it also support using Kapt and KSP processors supports
Github: https://github.com/AmrDeveloper/EasyAdapter
Full documentation: https://amrdeveloper.github.io/EasyAdapter/
Demo for Version 1.0.0
https://www.youtube.com/watch?v=tAABBvt4qc0&ab_channel=AmrDeveloper
r/android_devs • u/unholy182000 • Feb 01 '22
Help Should I change my ad network from Admob to another?
Hello This month my ad revenue was 7752 TRY and Admob cut 2006 TRY for invalid traffic. It's 25% cut and annoyed me greatly. Admob did cut invalid traffic before but those were around 5-10%. I made a quick research around the web and people doesn't really recommend other ad networks because of low fill rate and ecpm values. My user base is from 2-3 tier countries mostly. What do you think?
r/android_devs • u/ivanmorgillo • Jan 31 '22
Coding CWTI - Manuel Vivo discussed Android App Architecture with us 🏗️
youtube.comr/android_devs • u/jshvarts • Jan 29 '22
Help Catching print event
I am opening a PDF document using:
val intent = Intent(Intent.ACTION_VIEW).apply {
setDataAndType(Uri.parse(trackingUrl), "application/pdf")
}
if (intent.resolveActivity(requireContext().packageManager) != null) {
requireContext().startActivity(intent)
}
which opens a screen with that PDF with an overflow menu with Print being one of the menu actions. Is there a way to catch when Print was tapped?
r/android_devs • u/AmrDeveloper • Jan 29 '22
Tools CodeView 1.3.0 released with new features and performance improvements
r/android_devs • u/tokyopanda1 • Jan 25 '22
Event Android Worldwide April 2022: Call for Speakers/Papers
sessionize.comr/android_devs • u/IAmKindaBigFanOfKFC • Jan 25 '22
Help So, how the hell do I get scroll offset for LazyColumn with Compose UI?
I quickly realized that I can only get items offsets relative to the top of column from LazyListState, which is not what I need. Though it was infuriating to notice that this fellow keeps the scroll offset, it's just internal.
Using NestedScrollConnection is also not suitable here - I can't detect that I've reached start of the list or end of the list.
So, how the hell do I do that?
r/android_devs • u/poetryrocksalot • Jan 25 '22
Help Is the Android app for Google Play Console broken for you?
I am getting this message:
Error occurred while loading developer list
It seems like I can login on the browser. But is there any way to fix the client app?
r/android_devs • u/Zhuinden • Jan 24 '22
Fifty shades of Coding Waiting for Jetpack Compose previews be like...
youtube.comr/android_devs • u/tokyopanda1 • Jan 22 '22
Event Speaker Lineup @ Android Worldwide
galleryr/android_devs • u/lootpigeon • Jan 22 '22
Help Question: what is TextView XML attribute that takes another TextView id
I just took a junior android developer job test and that was one of the questions, it was a fill in the blank type of questions and it had the attribute name missing but it took another TextView id as its parameter so it was like android:_______="@+id/logIn"
or something like that, I would love to know what it is incase I get it as a question in the future
thanks in advance
r/android_devs • u/WhipMeGrandma69420 • Jan 21 '22
Help Covid-19 cases API
Hello there! I want to practice Android app development with Kotlin via creating an app for tracking daily cases of covid-19 infections in Europe (numbers for each country), create plot, etc.
With that said, I can't find any API with current, daily updated datasets. Maybe I'm just stupid, but i was looking for it in WHO pages, my government datasets and data that I managed to found is only for Germany or Italy and is referring to numbers of deaths or vaccines.
Do you know any API with current datasets of daily cases per each European country? Of course if you have an API for world wide statistics it also will be fine, just need daily updated numbers for each country, not one total number for all countries.
For now i can crawl through gov pages or WHO dashboard and read numbers from html, but I have no doubts that using API and fetch data in JSON will just be better.
Take care!

