10
            
            votes
        
            
                
                Accepted
            
        
        Recyclerview Adapter for weather app - Makes API calls for each item
                    First issue
You're calling the weather API on every OnBindViewHolder(), which means it will get called for each visible row, and on new rows entering, or re-...
                
            
       
        
            
                6
            
            votes
        
            
                
                Accepted
            
        
        Detecting if image taken by camera is too dark
                    Intelligibility
I can't quite work out what's going on with the main loop.
...
                
            
       
        
            
                6
            
            votes
        
            
                
                Accepted
            
        
            
            
        Code for sorting items in recyclerView
                    You're right that the duplicate code in the sorters looks bad.
To solve this, each sorter should only define the compare function, and all the rest should be done by the enum class. Or not even this. ...
                
            
       
        
            
                5
            
            votes
        
        
            
            
        Detecting if image taken by camera is too dark
                    Sampling: Don't process ALL pixels
The speed mainly depend on the number of operations, in our case, pixels. And a lot of pixels. This means that the larger the image is, the slower your code will ...
                
            
       
        
            
                5
            
            votes
        
            
                
                Accepted
            
        
            
        Getting location using LiveData and FusedLocationProviderClient
                    Let me explain how to work with LiveData - ViewModel and Activity.
Right now your ...
                
            
       
        
            
                5
            
            votes
        
            
                
                Accepted
            
        
            
        Kotlin text validation
                    First of all, make attention - your code twice convert and check value. Suppose it's not efficient. Another tiny problem - 1280 and 1500 values is not change prefs.mtuSize…
My code:
...
                
            
       
        
            
                5
            
            votes
        
        
            
            
        Scanning and indexing files video
                    Naming
The method name load_Directory_Files is a bit odd. To follow general Java naming conventions, it would be something like ...
                
            
       
        
            
                5
            
            votes
        
            
                
                Accepted
            
        
            
        My Android app is really slow when getting simple data from PHP
                    When approaching optimization problems (and it kinda is one as you want to make a call faster) its generally best to first make sure that you understand exactly what is happening so when in doubt - ...
                
            
       
        
            
                5
            
            votes
        
        
            
            
        Calculator App with Kotlin and Android Studio
                    Crash
Dividing by 0 crashes the app ungracefully. Detect this and show an error message.
Warnings
Check your "Problems" tab in Android studio. It tells you to use ...
                
            
       
        
            
                5
            
            votes
        
        
            
        Android - A way to show/hide loader without writting false/true in every viewmodelScope.launch
                    If I interpret it correctly, you can basically wrap everything in a single method, and pass it a lambda:
...
                
            
       
        
            
                5
            
            votes
        
            
                
                Accepted
            
        
            
        Compose Grid With Lists
                    Looks quite good already, I haven't found any serious issues.
The are some minor improvements that I would suggest, though.
Small bugs
I'm not sure how your data source looks like, but you import <...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
        Mini game for android
                        String str = parent.getItemAtPosition(pos).toString();
What does str mean? You proceed to use it to determine the level (i....
                
            
       
        
            
                4
            
            votes
        
        
        Mini space game for Android
                    You really need to split your code. You have methods that are hundreds of lines long, they should be more like under 10 lines.
Then, you can also benefit by trying going more OO. The sequence of <...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
            
        About handling data from an API call through RX and Retrofit
                    Let me start by saying I am by no means an expert in Rx. I have no authoritative references to back up my suggested improvements. They come from the little experience I have, as well as some ...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
        Android game inspired by Space Invaders and Moon Patrol
                    Thanks for sharing your code.
organize your code
use automatic code reordering
In your code all the different types of code are mixed. This make it hard to read your code.
There is a common order ...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
            
        Implementation of an OkHttp singleton for Android
                    You don't need to create new instance of OkHttpClient. Remove it.
You can use Initialization-on-demand holder pattern to create singleton in Java. No need to use <...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
            
            
        Android Tetris App Design
                    Good job separating concerns
Your tetris game-board model, piece and UI code is nicely separated in classes, so each one has its own responibility. Well done!
Don't use magic values, use Enum
...
                
            
       
        
            
                4
            
            votes
        
        
            
        Kotlin reflection to generate one class from class similar with similar properties
                    inline functions
inline function are great when:
You want to surround a lambda with a little code
You want to use reified types.
They are not great when you have a large function, as every call to ...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
            
            
        Google Maps API - reading locations from file and displaying markers on map
                    Your Marker and ShelterObject instances have the same data inside. (except the additional hardcoded (!) string "Antal platser:", whatever that means) Now you have two islands of data. You collect them ...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
            
            
        Optimize this code of adapter's overriden method getItemCount()
                    Code Beautification is suggestive. This is how I would write your code. There is also a possible performance optimization by only calling super.getItemCount() once.
...
                
            
       
        
            
                4
            
            votes
        
        
        TCP server in Android to continuously listen to an RFID reader
                    You should be implementing Runnable, not extending Thread. You are not creating a new generally-useful extension of thread that can be used as an API class by multiple clients. You just want a normal ...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
        
            
                4
            
            votes
        
        
        Android Java Splash Screen code
                    This code looks reasonably clean and seems to accomplish what it's intended to do.
Some minor nitpicks can still be improved here and there:
You're not consistent in visibility modifier ordering ...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
        Adapter for RecyclerView with supported onClick handling and select color text on last clicked item
                    I like nitwitting about kotlin, therefor only feedback about the language.
single expression functions
If your function exists out of one expression, you can write it easier.
Instead of having to ...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
        Android Tic-Tac-Toe
                    Reset
Calling back into your MainActivity each time you reset the game creates a stack of the activities, so if the user plays several games and tries to quit by pressing the back button, they'll have ...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
            
        Code for working with a tasks in To-Do Android application
                    The word "manager" is a class name trap. It's vague and if you don't have a clear idea of exactly what the class is responsible for, you're in danger of violating the single responsibility ...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
            
            
        Getting a single result from multiple LiveData objects
                    Your way of merging is similar to Rx's combineTransform or Kotlin Flow's combine. The difference is you are forcing the lambda ...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
            
        Jetpack Compose: Length-Units Converter
                    Regarding making this more idiomatic Kotlin code you can take advantage of direct value assignment like so:
...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
            
        Logic to check if app was launched for the first time using DataStore
                    This already looks quite good.
Apart from some minor formatting issues I think the following things can be improved:
In the MainActivity the property dataStore can ...
                
            
       
        Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
android × 779java × 658
performance × 73
kotlin × 71
beginner × 56
sqlite × 37
multithreading × 30
xml × 28
asynchronous × 24
object-oriented × 22
image × 18
design-patterns × 17
error-handling × 17
game × 16
animation × 14
c# × 12
mvvm × 12
layout × 12
rx-java × 12
json × 11
classes × 11
authentication × 11
singleton × 11
datetime × 10
event-handling × 10
 
         
         
         
         
         
         
         
         
         
         
         
         
        