Questions tagged [android]
Android is Google's software stack for mobile devices. For non-developer questions, see http://android.stackexchange.com
815
questions
2
votes
0
answers
147
views
SharedPreferences singleton wrapper
I was wondering wether my implementation of the PreferenceService below is thread safe or could cause memory leaks.
Android Studio gives me the warning "Do not place Android context classes in ...
1
vote
0
answers
51
views
Multiple Stopwatch App
I was fed up with the default alarm clock when doing laundry. The washing machine is in the basement and takes different time depending on the choosen program. The stopwatch has to be configured for ...
2
votes
1
answer
130
views
Populate an ArrayList of different instances of a class
First of all, here is an overview of my application. I want to create a multiple-choice app, on android, using data stored on a remote MySQL database. The DB has 100 questions that will appear in ...
4
votes
1
answer
80
views
Android Java Splash Screen code
Here's my android splash screen. I am trying to figure out a better way to write it. It just moves the logo up to the center of the screen. It's my third time creating a splash screen for an android ...
3
votes
1
answer
55
views
Code feedback on running app
I have made an Android app called RunTracker - https://github.com/michaelnares/runtracker/tree/master/app. The intended functionality is that the app saves runs to the local filesystem, shows your ...
2
votes
1
answer
502
views
Creating an empty Sudoku grid
I am generating a 9x9 grid on which I will play sudoku later by setting click listeners to each square on the grid.
I first have a .xml file that represents a single square in the grid. This consists ...
1
vote
1
answer
69
views
Simple function to Http GET some data
This is within a base class of a library, where several other classes inherit this one.
This seems like the simplest way of just getting some data, for now without timeout/errorhandling. This is ...
1
vote
0
answers
51
views
Functions to obfuscate and deobfuscate String. Am I missing out any edge cases?
I have 2 functions, which are going to hide/ unhide the multiple languages plain text.
Security is not a major concern.
The objectives are
Just want to find a way to hide multiple ...
3
votes
0
answers
61
views
Getting a list of waypoints assuming that there is a map [closed]
I'm a beginner learning ROS. I'm developing an android application that will control my robot and that includes getting the list of waypoints to display it to my spinner. How do you get the list of ...
1
vote
1
answer
135
views
Night out with friends. Calculating the costs per person with Kotlin and Android
The following app basically sums up the costs for an evening and calculates the costs per person. The user can input the description of the costs [String] (for example, round one = Spare Ribs Place, ...
2
votes
1
answer
700
views
Kotlin shared preferences
So I've written a class for storing user/device specific settings, but I've written the Kotlin pretty much like I would in Java:
...
2
votes
1
answer
586
views
Creating many Android cardViews with different background colors [closed]
I have cardView in my android app with three child component. I set the background color for each components. Based on card INDEX I reset the background colors individually.
If it's just one cardView ...
2
votes
0
answers
47
views
Upload to FTP method for Android that mimics the command line mv
I've created a Java class for Android that connects to a FTP server (using the FTPClient library from commons-net-3.6) and ...
2
votes
1
answer
95
views
ViewModels for image transformations
In my project I have a chain of Fragments where each one gets a bitmap, manipulates it, then sends it to another fragment for more processing.
My fragment chain looks like this:
CaptureFragment -> ...
2
votes
0
answers
586
views
Updating UI in Retrofit onResponse
I have an Android project that queries the BART train API. I was curious if updating the UI inside the Retrofit onResponse method is correct or if there is a better way. Below is my code. Also, here ...
1
vote
1
answer
171
views
Kotlin Android request client
As part of an android app, I've written a simple wrapper that makes requests to an api and fetches stuff.
...
2
votes
0
answers
89
views
Google Play billing + Firebase functions: Creating a one-time product, server-side
My Android app must request my Cloud Functions server to create in-app products at runtime ; then, the server responds with the created one-time product. I've written the server Cloud Function that ...
1
vote
1
answer
59
views
Data class where i need to set values for different fields at different times
I am creating a request for an api using below class-
...
1
vote
1
answer
1k
views
TCP server in Android to continuously listen to an RFID reader
I have created a TCP server thread which I want to keep running and listening to the IOT device (an RFID reader).
I have only one client.
Please review my code and provide your feedback. Are there ...
1
vote
1
answer
343
views
Android RecyclerView Popop Activity - 5 second popup time
So I've been working on a RecyclerView recently that's in a popup, and it takes a few seconds to popup with around 100 items. I want to make this faster, so any improvements on my code is appreciated :...
1
vote
1
answer
1k
views
Grid of radio buttons in Android
I want to display multiple radio buttons in a layout with multiline style as an item inside a RecyclerView. Look at the code I provided below and suggest how I can ...
2
votes
0
answers
783
views
BASH script to obfuscate android/meterpreter payloads
I have written a little script that does a pretty good job of obfuscating android/meterpreter payloads. It will generate payloads or used supplied msf payloads while also injecting a custom icon. The ...
0
votes
1
answer
88
views
Optimize this code of adapter's overriden method getItemCount() [closed]
How can I optimize this code of adapter's overriden method getItemCount() into simpler form?
...
2
votes
1
answer
86
views
RecyclerView with different ViewHolder using generic
I have different ViewHolder for different Feed implementations. But I can't use the best practice of having each ...
2
votes
1
answer
2k
views
Android LiveData Shared between activities by Application Session
I'm developing an app that use socket to receive messages from a chat.
I'm using an MVP approach and I store the data in a Singleton class named DataBridge like ...
5
votes
1
answer
229
views
Google Maps API - reading locations from file and displaying markers on map
I'm working with Google Maps and want to read in location objects into the map. I'm loading them in from a .csv file and create Shelter objects for each location that I save in an ArrayList. To ...
4
votes
1
answer
136
views
Android clock in/out app
I am writing a clock in / out and payroll app for Android. I am no professional, but I was hoping I could get some feedback on whether my code is spaghetti or not. This is just one of many classes &...
3
votes
0
answers
1k
views
Android+Firebase testing using Mockito
I have an interactor/usecase class in my application. My application follows MVVM architecture with interactor/usecases responsible for logic (e.g. get data from api-service, store in local-database ...
2
votes
0
answers
43
views
Custom Security for API access from server to mobile application
i am not the best at security but need a custom way to securely store personal identifiable information like name, address etc - Can i please have some feedback on this custom code, from my ...
5
votes
0
answers
180
views
Converting between cooking measurements
I've made an Android app that converts between cooking measurements, taking into account the type of product you use (that way it can convert between mass and volume by using the density). What are ...
4
votes
2
answers
207
views
Android NDK Low performance
I am trying to write a NDK program for quicksorting an array. However, in my benchmarks C is doing consistently worse than Java, as indicated by my results:
Java 1190625
C 1809218
Java 895104
C ...
1
vote
0
answers
253
views
Implementing std::filesystem::remove_all() for Android
I needed to use some c++ code on both standard Linux and the Android variant, and the code will use filesystem library but it isn't yet in the ndk.
So I'm making a one to use on Android
It will be ...
2
votes
0
answers
84
views
Firebase login/registration process for a dating app
I am developing another bigger project, I want to try a simple DatingApp and currently I try to develop a Login and Registration Form. There is no special register / login button, the code will later ...
-1
votes
1
answer
71
views
How to divide a large method into 2 smaller methods [closed]
I have created a method that is responsible for the creation and the saving of memes. This is a huge mistake because now I need to use 1 of those functionalities (creating) for a different purpose. I ...
3
votes
0
answers
45
views
Load all data from cursor
I have a Db table:
'aid' INTEGER,
'tid' INTEGER,
Which represents connection between activity and task, so multiple tasks could be connected to one activity ...
2
votes
1
answer
744
views
Android Java Unit Testing model class
I'm trying to get familiar with unit testing. I never implement TDD previously, but I believe it's the best way to write software.
So, here I'm trying to test my ...
2
votes
0
answers
59
views
Sharing File (Content) without saving it before
I have a listview of PrivateFile objects which contain the fileId (int), fileName (String) ...
3
votes
0
answers
113
views
Java Android Sudoku solver
I made a simple and non recursive Android Java Sudoku solver implementing Algorithm X with links inspired from dancing links. The code is on Github (start with the Solver class and the ...
2
votes
0
answers
69
views
Listing YouTube videos using API with RxJava
I am new to RxJava and have the following code which I use to search YouTube videos via the API and ultimately display them in a list.
...
1
vote
0
answers
80
views
Socket sending/receiving data
I am a beginner in Android and this is my first big project in it. I am trying to communicate with an STM Discovery board using an ESP01 module.
Below is the client connection class
...
2
votes
2
answers
142
views
Optimize Multiple Insert SQLite Coming From MySQL
I'm currently developing an app that requires sending and receiving of data from android studio going to MySQL and then data coming from MySQL will be saved from the SQLite. I need advice on how to ...
3
votes
1
answer
329
views
Sending and receiving of JSON data to and from Android Studio
I'm currently developing an app that requires sending and receiving of data from android studio going to MySQL and then data coming from MySQL will be saved from the SQLite. I need advice on how to ...
0
votes
1
answer
2k
views
Destroy Singleton pattern in kotlin
I am practicing Singleton pattern in kotlin.
It is a quiz app which has question tile with four options and one correctIndex.
McqOldActivity.classs
...
1
vote
0
answers
24
views
Appium automated tests for manipulating checklists
I am new to automation. I have automated few test cases for a mobile app using appium and wanted to know the areas where my code can be improved further.
...
0
votes
1
answer
365
views
Simple Android Volley login request
I've made a simple login API request which gets a token as a response. I had to use Toast a few times. Is is possible to make it with only two ...
2
votes
1
answer
40
views
Method that Saves user text messaging draft [closed]
I am working on saving the text messaging draft of a user. The flow currently works but I am looking to make this block of code easier to read and smaller. Could anyone help me achieve this?
...
0
votes
1
answer
95
views
Android TCP server that maps data to an object and sends it to a service
This is a code for an android thread. This is a tcp server and gets data from socket, maps it to an object and sends that object back to the main service. If there is anything I'm doing wrong or if ...
1
vote
0
answers
250
views
Animated Button on Android using AfterEffects and Lottie
I have a question about my implementation of a "special" Next-Button.
First I want to show you my AfterEffects file:
So This Animation has 3 parts
Green: Entry correct
Red: Entry incorrect
Blue: ...
1
vote
0
answers
3k
views
Retrieving date and time from Datepicker and Timepicker and then converting it to milliseconds
I currently have an Android Activity that allows the users to select the startDate, endDate, ...
3
votes
2
answers
6k
views
Call multiple asynchronous HTTP requests and wait for the result
I have a Repository class which looks like this:
...