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
1answer
302 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
279 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
165 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
324 views

Simple Android Flashlight app

One of my first projects. I present to you - Android Flashlight app! ...
3
votes
1answer
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
0answers
54 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
2k 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
212 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
110 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
9k 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
77 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
499 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
744 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
252 views

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

I have the following HashMap : ...
0
votes
2answers
194 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: ...
3
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 ...
5
votes
1answer
5k 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
86 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
71 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
1k 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
146 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
240 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
105 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
502 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
473 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
90 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
4k 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
93 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
178 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
1k 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
896 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
139 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
217 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
161 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
2k 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
1k 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 ...
2
votes
0answers
85 views

Android Smartband2 Reader in Xamarin

This code was written a long time ago but has probably gotten a bit deprecated now and I wonder how it can be improved. It's for an xamarin cross-platform project for IOS and Android but this part is ...
0
votes
1answer
2k 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
4k 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
87 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
178 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
410 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
2k 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
126 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
2k 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 ...
3
votes
2answers
420 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 ...
1
vote
0answers
56 views

Android continually run api request

What is the best practice to run continually api request, like every 1-10 seconds. Currently I am doing this which is not a good practice I think, it probably causes some overhead: ...

1 2 3
4
5
16