Questions tagged [android]

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

142 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
97 views

Android component animatable on its height

I'd like to have a code review for a component which is supposed to be animatable on its height. It's supposed to be a transitioning element. I find it quite laggy on my phone. ...
5
votes
0answers
158 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 ...
5
votes
0answers
1k views

Android audio recording using AudioRecord and ByteBuffer

I'm developing an audio recorder app for android using AudioRecord class to have a low level access to audio samples. ...
5
votes
0answers
121 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 ...
5
votes
0answers
13k views

Using the same RecyclerView.Adapter with a different ViewHolder

I would use the same RecyclerView.Adapter with two or more different fragments. Every fragment uses a different view items layout so I must use a different ...
4
votes
0answers
22 views

Code to support different measurement systems

I am developing an application in which the user can use different measurement systems. Currently, there is support for the metric and imperial measurement systems. To support these systems, I wrote ...
4
votes
1answer
188 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 ...
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 ...
4
votes
0answers
106 views

Dynamically creating login screen on Android devices

This has been an experience. I'm well above "hello world" java is not a language I use often when programming and I don't program too much. I find myself a lot on Google.... basically just about for ...
4
votes
1answer
109 views

Porting a web-based POS system to Android

I'm currently porting a web-based POS system to Android. The Android version uses NavigationDrawer to navigate between menus. What I need a code review on is my ...
3
votes
0answers
330 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 ...
3
votes
0answers
38 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 ...
3
votes
0answers
93 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
135 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,...
3
votes
1answer
3k 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 ...
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
0answers
2k views

Creating Android layout with GridLayout

I'm trying to create a Layout with two columns which are next to each other (I'm accomplishing this behavior with a LinearLayout). Inside each column, I have two TextViews and two Buttons, which I ...
3
votes
0answers
46 views

Loading image/texture sprites on GameScreen in LibGDX

I'm new to this framework, LibGdx. I need advice/suggestion for my game. Is it okay if I load my images in a single class? I'm a beginner and started learning LibGdx. I already coded my game screen ...
3
votes
0answers
691 views

Convert Unicode text to font glyphs for display on Android devices

Prior to Android 6.0, Mongolian text is not supported on Android devices. And as far as I know, OpenType smart font rendering is still not supported. Therefore, in all my Mongolian apps I use a ...
3
votes
0answers
4k views

A BaseActivity to render toolbar and navigation drawer

I'm new to Android programming and this is my first project so I'm not sure if this is the correct method of rendering the toolbar or the navigation of the drawer on the screen: So I have a ...
3
votes
0answers
736 views

Tablayout code for Android

I am using Tablayout for an Activity in my app but for some reason icons for each tab using ...
3
votes
0answers
57 views

Easily add Accessibility to your app as an afterthought. Yes, as an afterthought

Accessible apps allow more users to use your app; however, it is usually an afterthought for developers, and it makes your XML layout files messy whether Accessibility was a forethought or ...
3
votes
0answers
182 views

Animation for android ImageViews acting as game pieces

My question is about how to achieve a well-performing animation for a set of ImageViews, so that the foreground fades away and the background stays the same. ...
3
votes
0answers
98 views

Getting contacts from phone is taking too much time

I am working on an instant chat messaging application. I am getting contacts from phone and displayed them in list view of an activity, but it is taking 25-30 seconds using the following code: 1. On ...
3
votes
0answers
283 views

Hourglass path in SVG for Android

I've created my first Android drawable, a hourglass shaped image, and I'm curious what can be improved with it. It seems weird having to use 4 paths, but I couldn't get it to work any other way. <...
3
votes
0answers
1k views

Map Events From calendar provider to dates in gridview

I working on a calendar app on Android, using roomaorama, which is nice. I am fetching all the events from Events table in Calendar provider once which seems not good performance wise. The library ...
2
votes
0answers
59 views

Java's AtomicInteger equivalent in c#

I'm trying to replicate Android's GenerateViewId() to assign a unique Tag to dynamically created UIViews in Xamarin.iOS. ...
2
votes
0answers
63 views

ANDROID - Receive and manage markers in Google Maps

Recently, I've received negative feedback of interview's test. They say that they need somebody with higher technical level, the quality of the task was not good enough. I upload it here, to request ...
2
votes
0answers
72 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
0answers
42 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
0answers
160 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 ...
2
votes
0answers
41 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 ...
2
votes
0answers
134 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 ...
2
votes
0answers
37 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 ...
2
votes
0answers
67 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 ...
2
votes
0answers
32 views

Sharing File (Content) without saving it before

I have a listview of PrivateFile objects which contain the fileId (int), fileName (String) ...
2
votes
0answers
56 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. ...
2
votes
0answers
264 views

Timer application in MVP

I create simple Android timer application and I try to use MVP design pattern. I read some tutorials and after that I started writing code. My code is working correctly and as intended. There is ...
2
votes
0answers
76 views

Yoga Android app

I have created a yoga app on Android Studio. Can someone review the code to see if I have used the best practices of programming? MainActivity: ...
2
votes
0answers
621 views

Endless scroll in kotlin (android)

This is the code of my function to endless scrolling. It's a good practice to bind new disposable in onscroll listener? What do you think about my code? ...
2
votes
0answers
263 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
163 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 ...
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 ...
2
votes
0answers
197 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 ...
2
votes
0answers
752 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 ...
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
0answers
268 views

Trying to avoid null types using lazy and lateinit Kotlin

I am using Kotlin from quite some time now, but I could not able to achieve not-null types for all the properties in Kotlin. After what I learned by watching Kotlin in Google IO and a bit of research,...
2
votes
0answers
416 views

Extend OnClickListener and animate view in android

I'm working on animation and I want to organize my code in best way I'm new in android and not know too much about this. Here is my code that I'm using to animate ...
2
votes
0answers
58 views

Android app to let users complete tasks for cash

I am doing an android side project, and I was wondering if I could have my code reviewed to get feedback on improving its efficiency and overall elegance. Particular classes to focus on would be ...
2
votes
0answers
369 views

Setting preference summary

I'm taking and Android course and I would like to refactor the code for one of the exercises. The complete solution done by tutors is here. When I was doing this exercise by myself I was annoyed by ...