The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
3
votes
3answers
78 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
1answer
66 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
1answer
2k views

Kotlin text validation

I'm new to Kotlin, not so new to Java and Android development. But willing and trying to ...
2
votes
1answer
180 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
0answers
231 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
0answers
149 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
1answer
263 views

Simple Android Flashlight app

One of my first projects. I present to you - Android Flashlight app! ...
2
votes
1answer
1k 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
0answers
53 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 ...
0
votes
1answer
1k views

WeakReference in AsyncTask

I want to use the WeakReference approach to not leak memory with my AsyncTask. I found examples online and on Stackoverflow, but ...
0
votes
1answer
164 views

Android SQLite database with 3 tables

I want to show you the SQLiteOpenHelper and Contract class for a little quiz app I made for practicing purposes. I have 3 tables ...
1
vote
1answer
97 views

Restoring the instance state of an SQLite quiz app in Android

The following class is the activity of a little SQLite quiz app, which takes care of showing the actual quiz. Other than that the app only has a starting screen. I want to save the instance state and ...
2
votes
1answer
7k views

Android: Make a Quiz-App

Task description Make an quiz-app based upon a topic you feel familiar with! Following requirements Has at least four questions. Following controls are all used at least one time: Button, TextView,...
1
vote
0answers
67 views

Subscribing to multiple sources in RxJava

I have used RxJava to Observe multiple sources and then perform action depending upon values of Observables. I want to know if it can be further simplified. Goal: Complete implementation of RxJava. ...
2
votes
1answer
5k views

AES Encryption/Decryption with key

Is this the best way to encrypt/decrypt data? And Is it good to store Generated InitVector and CipherText in database as Base64 String which is converted from byte[]? ...
1
vote
1answer
317 views

Android Service Recording Camera

I've built a service that records a camera. The aim of this service is mostly to record video while the app is in the background. ...
2
votes
2answers
552 views

Android SharedPreferences Utility

I just created a utility class for Android shared preferences. I want to know it is working well on other users device and useful for learners. My code in gist ...
0
votes
3answers
216 views

I want to get weekdays for common time sets from the following hashmap

I have the following HashMap : ...
0
votes
2answers
145 views

Decoupling UI code from game logic

IIUC I should decouple UI logic from the model and controller in my project. I didn't succeed and had to resort to TextView etc in my game logic: ...
2
votes
1answer
3k views

Static class for constants with reference to java resources

I want to store the colors I use in the colors.xml file. In addition to using them in an xml-layout, I also want to use these colors in my Java code, when drawing ...
4
votes
1answer
4k 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 ...
1
vote
0answers
85 views

Sending data to an API with Retrofit 2.0

In my application, I want to post the version name and manufacturer name to a server using retrofit. Are there any bad parts in the code below? POJO: ...
2
votes
1answer
64 views

Android mini adventure

I make a mini adventure game demo for Android where the player can move between places and NPC characters can enter and exit the places and perform random actions. The "dirty" code is the UI for ...
1
vote
0answers
968 views

Using Asynctask with MVP architectural pattern

I am working on a simple android app to learn MVP. I am using synchronous OkHttp with AsyncTask for retrieving data from a REST ...
1
vote
1answer
138 views

Mini game for android

For Android in this mini game the monkey catches nice bananas and coconuts. It was somewhat more problematic to create the layout in XML compared to the small game engine and controls. Maybe we ...
2
votes
1answer
176 views

Tic Tac Toe on Android

Can someone review my Tic Tac Toe Code? I tried to make it as compact as I could. What could I improve? I save the state of the buttons by adding freezesText="true"...
1
vote
0answers
97 views

Linear search on array

I've recently used this block of code from a quiz app where I check an array for the correct answer that was received from the browser and sent to the mobile device/application. ...
2
votes
1answer
397 views

Reading file from flash with Xamarin.Forms on Android using ActionOpenDocument intent with StartActivityForResult

I have a Xamarin.Forms application which utilizes dependency services to access Android specific features, in this case file access on the storage. The file we are accessing is a serialized .xml file ...
2
votes
1answer
406 views

Picasso's Transformation class to Crop borders from Image

It's a implementation of Transformation from Picasso library looks for the first different pixel color in both sides, in the vertical and horizontal, and crops the bitmap from there. Here is the ...
1
vote
0answers
49 views

Android application using RecyclerViews to list games in a Fragment

I am implementing MVP architecture, code works fine, I wanted your suggestions if I there can be improvements done or in any areas where I am not following the pattern correctly. It is a simple ...
0
votes
1answer
88 views

Adventure game for Android

Features Abstract class World.java which works for basically any game Game engine class Simulation.java which steps forward time and introduces random events Walking persons, places and connections ...
3
votes
1answer
3k views

Simple audio player to play music using a URL built using MediaPlayer in Android

I wanted to create a very basic application for Android that plays an audio file based on a URL input. I would like it to be reviewed based on good programming practices. This is the first time that I ...
2
votes
0answers
49 views

Filter results on response

I call remote server to get my result. Result might contain artist,track and album depends on API method but there will be only one response (artist or track or album) at a time. It mean the other two ...
5
votes
1answer
91 views

Painting a lot of diagrams for a board game

I'm creating a chess application and I would like to show plenty of big chess diagrams in scrollview. At the moment I just create ImageView for every diagram, create bitmap into it, paint the diagram ...
1
vote
0answers
174 views

Setup tracking of user's location

It is hardy believable how complicated it is to get an app running which tracks the location of the user. ...
3
votes
0answers
862 views

Putting thread in sleep while waiting for BroadcastReceiver

I'm a little puzzled about a procedure inside my Android app. It's actually working but it looks like bad practice and probably it lowers performances. Short explanation: I'm running a separate ...
3
votes
2answers
564 views

Detecting if image taken by camera is too dark

I am trying to build functionality to check if an image taken by the camera is too dark. So I added the following 2 functions to a utility class: ...
1
vote
0answers
124 views

Android login with strategy pattern not using command pattern

I have login code that I'm working for my social network. I am wondering if this is good coding standards or if there is some modifying I should do. Can anyone explain what can be done? Here is the ...
2
votes
0answers
191 views

Search GitHub users when text field changes in Kotlin Android app

Problem: Search for users by their name using the GitHub API (sorted by the number of followers) and display the results in a RecyclerView. Implementation: Hitting the GitHub API every time when user ...
0
votes
1answer
153 views

Dagger 2 test application

I have a complicated Dagger 2 use case on Android, where I have a lot of dependencies, but some of them are really slow to construct. Like 2-3 seconds slow. My solution was to create an RX ...
0
votes
1answer
1k views

Remove repetitive code for multiple spinners using one listener

I managed to setup multiple spinners using one listener but there is a lot of repetition in the code. My full onItemSelected method: ...
5
votes
1answer
858 views

Creating String from a bitmask

In my Android app I store days of week in an int variable by using bit masking. I'm using the following SparseIntArray to get ...
0
votes
1answer
1k views

Loop to check isNullOrEmpty then setVisibility & setText

My code below is working fine but I know it can be done more efficiently using a loop. I'm checking the VAL (such as description, ingredient2, etc.) which are Strings from my SQL lite Db to see if ...
4
votes
0answers
3k views

Updating the UI without leaking the context after an Android AsyncTask finishes

In the past I always did AsyncTasks as private inner classes. The tutorials I found still recommend this (see here, here, here, and here). However, this has the potential to leak the context. Now ...
0
votes
1answer
86 views

Personal project for managing photos

I have wrote a small project for Android. It's an app which lets you to take a photo (or find one with Flickr) and save it in the cloud (Cloudinary). Link to the GitHub repository. Should MVP layers ...
0
votes
1answer
158 views

LED controller for a BLE device with the ability to change color and intensity in Android

It's been long since I have put any of my codes for review. Today I want to review my Android code written for a BM70_BLE device with which one can change the color and brightness of the LED light. ...
3
votes
1answer
346 views

Phaser game runs good on desktop but lags on mobile

I am creating my first game using Phaser and it is running fine in desktop. But it is lagging on Android phones. Can anyone tell me what could be the reasons? The game is very small -- smaller than ...
5
votes
1answer
1k views

Generic Adapter with search and sort functionality

I have tried to create a GenericAdapter that can help you search, sort automatically without writing a lot of code. But in order to use this you have to follow ...
2
votes
2answers
101 views

Trying to Store EditText Values in SharedPrefs using a Single addTextChangedListener

The code is completely functional but I'd rather not call two functions when I know it can be done more efficiently. My goal is to store EditText values in SharedPrefs using a single ...
0
votes
1answer
1k views

Espresso tests that check if Snackbar is displayed and if there is an internet connection

I have recently began writing tests for Android using the espresso library. Here I have three tests. The first test is to check if a snackbar appears when searching with blank text. The second is a ...