Questions tagged [android]

Android is Google's software stack for mobile devices. For non-developer questions, see http://android.stackexchange.com

Filter by
Sorted by
Tagged with
2
votes
0answers
35 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 ...
2
votes
1answer
63 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
0answers
19 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
1answer
66 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
1answer
69 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 ...
1
vote
1answer
85 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, ...
1
vote
1answer
49 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. ...
4
votes
1answer
52 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 ...
2
votes
2answers
372 views

Storing realm objects using Kotlin extensions

I am a Java Android Developer and I'm approaching Kotlin. I have defined the following class: open class Player : RealmObject() { ... } And I defined the ...
3
votes
1answer
42 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 ...
1
vote
1answer
44 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
0answers
19 views

Android: Fill a spinner data from the server dynamically

I'm new to android. How do you fill a spinner from the server's data dynamically. This is my Spinner layout: ...
0
votes
0answers
19 views

Load data from server to populate in spinner

I'm learning ROS and I'm trying to populate data from my server to spinner. my JSON is: ...
3
votes
0answers
50 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
0answers
31 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 ...
2
votes
1answer
58 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
1answer
54 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 ...
4
votes
1answer
3k views

Android RecyclerView Adapter: Passing normal clicks and menu clicks over the same activity

I am unsure about my approach here. As you can see, I want to send normal clicks and 2 different menu item clicks back to the underlying activity over an interface. Now I wonder if it is bad practice ...
2
votes
0answers
40 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 ...
4
votes
1answer
289 views

TextView vs Button for Android AlertDialog

I want to open an AlertDialog on the click of either a Button or TextView but I am not sure ...
3
votes
1answer
1k views

Android generic SQL database handler

Starting with the fact that creating the classic database handler in Android is really annoying and it usually takes a lot of time since you have to create one handler for each object, I thought at ...
3
votes
1answer
275 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 ...
2
votes
2answers
224 views

Function to turn to requested bearing

I've been writing a function: float turnToRequestedHeading(float initialHeading, float requiredHeading, float turnRate) I keep thinking there must be a clever ...
3
votes
1answer
2k 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 ...
1
vote
1answer
56 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 ...
0
votes
1answer
159 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 ...
3
votes
0answers
92 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 ...
3
votes
2answers
121 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,...
2
votes
0answers
33 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 ...
4
votes
1answer
160 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 ...
2
votes
1answer
1k views

Message queue with multiple producer, single consumer and no duplicates

I had to make a message queue in an android app which my thread takes messages from and processes them. There can be multiple producers and duplicate messages should be avoided. Rate of insertion is ...
2
votes
1answer
63 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 ...
2
votes
0answers
26 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
2answers
296 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). ...
1
vote
1answer
42 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 ...
8
votes
2answers
807 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
1answer
34 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
1answer
75 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
1answer
43 views
4
votes
1answer
4k views

Testing a ViewModel in Android - MVVM with DataBinding

I am using MVVM pattern with databinding. I have written tests. But I want them reviewed. The test is related to JUnit test on the ViewModel. FeedViewModelTest....
2
votes
0answers
41 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 ...
3
votes
1answer
5k views

Efficient Album Cover loading for ListView

I have a list view which display in each view a Album's name, the associated Artist and the album art. Here is the code of my ListFragment which display this list:...
0
votes
0answers
31 views

Adapter for Spinner

I need to my spinner supported endless scrolling. As rule the user will have only 1 - 5 items but in very rare cases some users can have 100+ items that will be loaded from server by pages (15 per ...
0
votes
1answer
75 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? ...
1
vote
0answers
80 views

Monitoring Services And Characteristics on React-Native [closed]

I have two questions for you about my code :) I'm creating an android to connect to ble device. I'm using ble-plx library. ...
2
votes
1answer
49 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
2answers
674 views

Call multiple asynchronous HTTP requests and wait for the result

I have a Repository class which looks like this: ...
2
votes
0answers
106 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 ...
5
votes
1answer
59 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 ...
10
votes
1answer
556 views

ActivityLifecycleHelper implementation

Description The ActivityLifecycleHelper uses wrap(Context)to create the class and save a global ...