Questions tagged [android]
Android is Google's software stack for mobile devices. For non-developer questions, see http://android.stackexchange.com
815
questions
1
vote
1
answer
730
views
Adapter class to display songs in an Android ListView
I am learning Android with Udacity nanodegree (having no support) and this is my assignment of music app. It is just an interface and no music I have to add. So far so the app is running without any ...
3
votes
1
answer
146
views
Card based game in Android
I am developing a card game in Android. This is my first time I am working in Android,. The game contains following features:
It will be a 6 player game.
There are two decks on the table, one with ...
1
vote
0
answers
869
views
Getting Video file path from uri
I am using below code to get a video file path from uri.
Need review for the following:
1.Code optimization
2.Crash(Code is working fine in the devices I tested but i need to make sure that it ...
3
votes
1
answer
811
views
Helper class for Fragments management
A Helper class for Fragment Management.
The FragmentsManager class has methods to add and replace fragments.
The replace method checks if the given fragment is present in backstack or not and if the ...
3
votes
0
answers
888
views
Wrap location API in coroutines
In my app I need to query location and scan wifi periodically. To conserve power I need to change the rate dynamically, depending on the distance to the target. Also I want to wait for both ...
1
vote
0
answers
67
views
Android app to take a photos and show them in a gallery
Gallery will be displayed in RecyclerView. User can select some images and delete it with one button.
It all works, but i think I have bad code, because I don't use some instruments (like fragment). ...
3
votes
2
answers
192
views
Displaying 21 spinners to select body parts
I just wanted to ask how can I make my code a bit shorter. As of now, I have way too much code in the class. The program should display about twenty one spinners. I know it's a lot, but in this layout,...
1
vote
2
answers
2k
views
Android MVVM application architecture
Inspired this guide: https://developer.android.com/jetpack/docs/guide
I try to build some app with similar architecture.
App interact with remote API via http protocol (json responses from server). ...
2
votes
0
answers
431
views
Timer application in MVP
I create simple Android timer application and I try to use MVP design pattern. I read some tutorials and after that I started writing code. My code is working correctly and as intended. There is ...
1
vote
1
answer
206
views
Using Enum in java to store a fixed set of mutable objects
I already posted this on Stack Overflow, but someone suggested to post it to Code Review instead.
I am creating an Android app that draws to the canvas. For this, ...
1
vote
1
answer
157
views
Sign Up layout in android
I have created a sign up layout as image below.
Does this part of code looked bad since the dp I used for the floating button are quite large.
...
0
votes
1
answer
53
views
Simple Registration Form. I would like to get rid of code duplications
I don't like my current code, because of duplications. What's the best way to leverage Kotlin to make it more concise. I have simple registration form
...
1
vote
1
answer
53
views
Handler for several kinds of requests to modify a database in an Android app
I'm working on an Android app, and at one point I need to retrieve a request code in a callback method and perform some database operations depending on the request code. It started out ok when there ...
1
vote
1
answer
69
views
Optimizing loop - Reducing native calls
I am developing Android-Disassembler.
I need to optimize the loop below.
It is currectly calling native method for each instructions(about 4 bytes). So this loop will be looped about millions of ...
1
vote
0
answers
2k
views
LiveData, MVVM and Repository Pattern
Is this a good approach or I've just found a nasty workaround?
I'm using MediatorLiveData class because seems useful to update the source of a ...
2
votes
0
answers
104
views
Yoga Android app
I have created a yoga app on Android Studio. Can someone review the code to see if I have used the best practices of programming?
MainActivity:
...
1
vote
1
answer
357
views
Kotlin reflection to generate one class from class similar with similar properties
This code is intended to generate a class (domain) from a class with class with similar/identical properties (api). Motivation is to speed development time when using clean architecture.
...
3
votes
1
answer
530
views
Developing a method of programming a multi-level menu
I am attempting to create my own speech to text assistant. This involves the user speaking and the assistant responding to the user's input. I do this by looking for keywords that indicate the user ...
1
vote
0
answers
617
views
Utility Class for location functionality on Android using Google Play Services FusedLocationProviderClient API
I'm new to Android development and this is my first request for a code review. Constructive criticism is very welcome!
I've written a class to wrap interaction with Google's ...
5
votes
0
answers
2k
views
Android audio recording using AudioRecord and ByteBuffer
I'm developing an audio recorder app for android using AudioRecord class to have a low level access to audio samples.
...
1
vote
0
answers
70
views
Consuming APi using Rx in an MVP project
I would like to have some input here if possible, this code should make a request to an API and the call should return the desired object. The client to make the requests was made with Retrofit and ...
1
vote
0
answers
90
views
Correct Callback for each item
I have added a correct question callback for different types of questions like: radio, checkbox and descriptive..
QuestionListActivity.class (it shows the list of questions to attempt)
...
0
votes
1
answer
22k
views
Password and confirm password validation in Android Studio
I just wrote this password and password confirmation validation code function that checks to see if a password is empty or not, and is it match (password = confirmPassword). I'm not sure this is the ...
2
votes
0
answers
762
views
Endless scroll in kotlin (android)
This is the code of my function to endless scrolling. It's a good practice to bind new disposable in onscroll listener? What do you think about my code?
...
2
votes
1
answer
64
views
Collision detection on Android
This is the same game code from my previous question. I split the code into smaller "logical units". The runnable code "Moon Buggy" is available in beta from the google playstore.
It was previously ...
1
vote
0
answers
37
views
Conditionally perform asynchronous actions with RxJava
This seems to work fine however I'm sure there must be a neater way. The outcome should be:
If isHidden == true then call canHideAccount. canHideAccount returns a Single.
If isHidden != true then ...
2
votes
2
answers
76
views
More object-oriented code for Android mini space game
This is improved code from my previous question. This mini game which we call "Moon Buggy" is available in beta from the google playstore.
The action is that you control a vechicle on the moon and ...
1
vote
1
answer
62
views
Improved Android mini game
This is improved code from my previous question. This mini game which we call "Moon Buggy" is available in beta from the google playstore.
The action is that you control a vechicle on the moon and ...
4
votes
1
answer
260
views
Initializing an Android activity by reading a CSV file with image IDs, names, and descriptions
I am using Java to create an Android app. I have the main activity read a CSV file, create objects, and then save them into a singleton class so the rest of the activities in the app can access them ...
9
votes
2
answers
4k
views
Android Tetris App Design
Recently I have finished my first bigger Android project. I made a little Tetris App.
Here is a picture of my app in emulator:
My Tetris has following functions:
fast drop down
play tetris music
...
1
vote
0
answers
979
views
Android - perform an action in background every few minutes
I've written the code to perform some action every 5 minutes, regardless if the application is currently on the foreground or not. I'd like to get a feedback about correctness - have I chosen the ...
0
votes
1
answer
197
views
Async Task using RxJava2 in Android
I have tried to create the async task using the RxJAVA2. The code is working fine. WHat enhancement can I do in this code?
...
3
votes
1
answer
2k
views
Implementation of an OkHttp singleton for Android
I'm new to Android programming. I am going to make lots of HTTP requests: 500, 1k, 2k, 10k.
I have tried to create a singleton class for OkHttp. I wrote this:
...
5
votes
1
answer
233
views
Android game inspired by Space Invaders and Moon Patrol
I'm creating a mini game for Android inspired by space invaders and Moon Patrol. I have completed the important part except for collision detection. Before I do collision detection I want to clean the ...
2
votes
1
answer
412
views
About handling data from an API call through RX and Retrofit
I started using Retrofit and RxJava recently and I love it. I am working on an Android project and I am following MVP Repository pattern as specified in Android Architecture Components. I'm still ...
4
votes
1
answer
6k
views
Accessing Adapter data from ViewHolder
In my Android app, I need to disable a button in Layout if the api return status as 0. I get this status in the Adapter and based on it, I have disabled the button in ViewHolder which is inflating the ...
6
votes
2
answers
4k
views
Multithreaded TCP Client
I implemented a multithreaded TCP client in java for use in an android application. The purpose is to implement the TCPClient interface to allow another thread to post strings to the server and read ...
3
votes
1
answer
78
views
SQLiteOpenHelper for multi string tables
I wrote this simple SQLiteOpenHelper in order to use in one database various tables containing String records (each record having a String identifier, and ...
2
votes
1
answer
6k
views
Android get container width instead of display width
I want to display a text of variable length in a cardView. To make the text fit, I split the text after every 500 Chars and add the substring to another ...
0
votes
1
answer
48
views
Unit Testing Android Studio
I am carrying out unit testing for my project but i am not sure i am doing it correctly. The example below calculates the difference between 2 time duration's.
...
1
vote
0
answers
93
views
Pushing a value to a Processor on a separate thread
I am attempting to use Room along with a full-text search (FTS) table. The issue is that Room doesn't recognize or support FTS tables. Though there is a work around for this; you just create the FTS ...
3
votes
3
answers
94
views
Sort Array into different arrays based on the number of objects appearing in that array
Assume filteredEvents from below to be a List<Filter>. Basically a list of objects, each of these holding a list of days ...
5
votes
1
answer
77
views
Mini space game for Android
I have created a mini Android game. The aim is to catch aliens in space. You score points for each aliens, there is a pause function and you can change the level of difficulty and change spaceships.
...
0
votes
1
answer
3k
views
Kotlin text validation
I'm new to Kotlin, not so new to Java and Android development. But willing and trying to ...
2
votes
1
answer
411
views
SQLite Quiz with Questions Table and Categories Table
Edit: I changed my approach.
I am trying to add categories to my existing SQLite quiz. This is my approach, what do you think about it? Do you think the foreign key restriction is necessary? I am a ...
2
votes
0
answers
346
views
Show mobile SoundCloud player in WebView
Demo for a SoundCloud player in WebView for specific song or artist stream as a workaround because SoundCloud is not accepting API key request anymore.
SoundCloudWebView:
...
2
votes
0
answers
185
views
Simple arcade game where you just move the character around
What My Code Does
I made this simple arcade game where you use the mouse/pointer to move the character around, by now it's all it does, it uses phaser.io
My Concerns
I'm new to Phaser (and a crappy ...
0
votes
1
answer
384
views
Simple Android Flashlight app
One of my first projects. I present to you - Android Flashlight app!
...
3
votes
1
answer
2k
views
Getting location using LiveData and FusedLocationProviderClient
My goal is to get the location when the app starts, and if the user navigates away and comes back, to receive one location update and that's it. I am worried about removing the observer in the ...
1
vote
0
answers
65
views
Basic Java Android app for computer data logging in an SQLite database
This is a pretty basic app I made to collect data necessary for a separate project. However it's also my first go at doing any Android programming, so I know there's definitely issues with it (the ...