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
1
vote
0answers
76 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
487 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
701 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
251 views

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

I have the following HashMap : ...
0
votes
2answers
189 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
69 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
145 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
234 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
104 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
492 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
464 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
177 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
823 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
137 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
207 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 ...
1
vote
0answers
82 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
175 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
400 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
125 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
413 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
vote
0answers
68 views

Discrete slide mechanism (with average rating display) for liking posts on a social network app

I'm thinking about implementing a "liking" mechanism for a social network app (using Parse) whereby users select a value from a discrete slider beneath each post. The slide would range from 0-5 and ...
9
votes
3answers
1k views

SlotMachine game as first Android app

After learning a bit of Android Java I've chosen to make a tiny game so that I can use the learned techniques in a real app. I had the idea of a slot machine simulator: You press a button and it ...
2
votes
0answers
753 views

Handling single items using MVVM and Android Architecture Library

What I have done so far Since I would like to rebuild a project using mvvm-pattern with the following requirements to use dagger 2 for di, RXJava for reactive, retrofit for webservices, greendao and ...
1
vote
2answers
289 views

Soldier class, with health points

Recently I completed the encapsulation lesson and I made a simple android app implementing encapsulation, I had difficulties understanding encapsulation. My Soldier class: ...
2
votes
1answer
132 views

A Route Finding Android app

I've recently taken an interest in Android applications and I have been working on an app regarding the travelling salesman problem. My app is a kind of a trip optimizer which is meant for travelers, ...
5
votes
0answers
123 views

Writing service/network layer for mobile apps

I have an app that gets and posts blog posts to and from a server. Right now I have a network client object which is passed into a service object. The service object is created and called from an ...
1
vote
1answer
1k views

Google Maps Directions API

I'm looking for all kinds of feedback: style issues, missed corner cases, performance etc. My code is regarding Google Maps Directions API that is a service that calculates directions between ...
2
votes
0answers
4k views

Android Canvas - Draw a line graph with a gradient whose color depends on the y value

I'm looking mostly for feedback on a solution of mine. I want to create a pretty line graph where the color of the line is dependent on the Y value, and a change in color at ...
2
votes
1answer
500 views

Tic Tac Toe in Android

I made my first Tic Tac Toe game on Android and I'm looking for a way to simplify, make the code more flexible and remove the hardcoded code. I managed to do this game by looking at different ...
5
votes
1answer
310 views

Parse and format date

I have the following code for taking a date in the form of a string yyyy-MM-dd HH:mm:ss (UTC timezone) and turning it into ...

1 2 3
4
5
16