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
260 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
1answer
158 views

Get and use user's current location efficiently for Route Calculation

I am trying to get the users current location and then the render the route using here-maps sdk with the location of the car provided from the Intent, I have a feeling I can improve it a lot as I have ...
0
votes
1answer
503 views

Quiz project with XML and Java

I'm learning to code Android apps and have recently finished a quiz app. I would like some feedback about best practices and possible ways to improve performance, as I'm also new to Java. ...
1
vote
0answers
32 views

WiFi controlled car code for android - improvements?

This is my android code for wifi controlled car (that use to be a RC car) I have couple of ideas on improving it, but I am not sure if I can explain it properly, but I will try. Should I add a ...
1
vote
2answers
141 views

Code for writing and reading from the database

I created code for inserting and retrieving data from a specific table. I tried to optimize it and make it as beautiful and easy to read as I can, but maybe (almost certainly) I'm missing something. ...
2
votes
1answer
239 views

Using serializable to preserve/save objects

I'm building one of my first android apps. I met this problem that everytime you change screen orientation, Android destroys the app and builds it up again (I know this is more complex, but this isn't ...
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 ...
0
votes
1answer
208 views

AsyncTask for subscribing to current location

I made the below CurrentLocationTask as a way of reducing code duplication, as my application currently has 2 different Activity...
2
votes
0answers
344 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 ...
1
vote
2answers
90 views

Passing “This”, but not really [closed]

So i am developing an Android application as a side project/hobby and I have come across the situation that I have to pass an Activity into a method for use a context (Don't question it) The problem ...
1
vote
0answers
116 views

BDD on Android with Kotlin

I am considering an approach fo BDD tests on Android. The sample app — a simple messenger — has been made in Kotlin, so will be the tests. I ended up with something like this : ...
1
vote
1answer
69 views

Code for filtering in ArrayAdapter

I have created a code for filtering a list of strings and redisplaying this list. I check if string is starting with a certain letter. It seems to work, but I wonder if I did all right? Havent I ...
3
votes
0answers
44 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 ...
-1
votes
1answer
342 views

Receipt printing tabulation [closed]

Currently I am working on a Receipt Printing Tabulation code in Java/Android. ...
4
votes
2answers
2k views

Java/Kotlin JSON parsing improvement

I consume an API which gives me this type of JSON: ...
1
vote
2answers
172 views

Make use of Object Oriented Design in an Android App with multiple activities

First off, I'm no Java programmer(but I do know the concepts of OO programming), I have this project I need to work on but I currently don't have a lot of time to spend in learning Java and then ...
0
votes
1answer
176 views

Finding prime numbers performance

I am writing an app that finds prime numbers within a specified range. Currently i am updating almost every part of the app and i have also changed the way i find prime numbers. The problem is that ...
0
votes
1answer
61 views

Translating method calls to REST calls

I understand and apply the DRY principle but I have a hard time getting this DRYer than it is right now. ...
5
votes
0answers
80 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. ...
2
votes
0answers
57 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 ...
1
vote
0answers
3k views

Filtering listview results when spinner values get selected

I have 3 spinners in my project named standard, division and age. They contain values from json data. When I select a value from each individual spinner it shows all data of students in a listview who ...
3
votes
1answer
2k views

Android App Simple calendar/scheduler

Wanted to make a schedule for myself that was (hopefully) light-weight. Right now it just has the bare essential function of saving text for a certain day. Looking for advice on literally anything ...
1
vote
0answers
22 views

Android app that makes certain actions in response to the state of toggles

I've written an Android app using Android Studio that, when the main switch is enabled, toggling other switches or pressing a radio button calls a certain script. I'm familiar with Java itself, but I'...
3
votes
0answers
577 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 ...
1
vote
0answers
154 views

Sync SQLite databases using threads and a Service

I have an Android app that collects data in n number of SQLite databases. The user decides the value of n in runtime. A Service is in charge of sending that data to our server. We used to do this with ...
1
vote
0answers
81 views

Collecting a user's Stripe information

I am new to both asynchronous programming and Android development. I am allowing the user to sign in with either their email/password or their Google account. Upon successfully signing in, the user's ...
5
votes
3answers
1k views

Interface design to have multiple implementations of network call libraries (Retrofit or Volley)

I am learning design patterns from Head First Design Patterns and a principle I came across is to "code to interface". Now I want to apply this principle in my Android app, which includes lots of API ...
9
votes
2answers
228 views

Updating positions of enemies every frame

I am making a game for Android using Java and libGdx. I have an ArrayList of enemies that are updated each frame. The update method for the enemy looks like this: <...
2
votes
0answers
331 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 ...
1
vote
0answers
2k views

Highlight selected item in GridView

This code displays images in a GridView. It allows the user to select an item at which point a custom checkbox is checked and the area around the image is highlighted a different color. (The image ...
0
votes
1answer
98 views

Random Number Generator from user touch input

I have this in place for an RSA Key generation class. I force the user to swipe on the screen randomly and use that as a entropy pool. ...
2
votes
1answer
725 views

Loading interstitial adMob in different threads

I want to load Interstitial AdMob after 5 second, after the Activity started, in another Thread. Is this code right, or I'm duplicating ...
1
vote
2answers
997 views

Setting icons when a tab is selected

I have this 2 arrays : ...
3
votes
1answer
56 views

Adapter class displaying characters' info

I have finished creating an adapter class which displays characters' info. When I looked back and reviewed my own code, I think the code fragment below somehow could be broken into smaller methods. <...
0
votes
2answers
2k views

FutureTask in Android, wait for a thread to execute the next one

This code is executed on a background service every 60 seconds on an Android app. Each class instantiated on FutureTask (WifiInfoFetch and WifiApResults) contains an insert to an SQLite database. We ...
4
votes
0answers
104 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
158 views

Creating new async tasks

In the past, I have used AsyncTasks to perform network requests for my Android app. I recently switched to RxJava to be able to cancel the requests when the user exits an activity. I have created a ...
2
votes
1answer
520 views

Animation with orientation change of Android device

I've started my first "job" like 2 weeks ago, and to be honest I've received a quite hard task to do, since I'm beginner with Android, and quite fresh at programming. The thing I needed was to find ...
4
votes
1answer
716 views

ButterKnife.bind with super class

I am using ButterKnife in my project, and as we know we have to write ButterKnife.bind(this); in all the activities, so I have ...
-1
votes
1answer
960 views

Created a small utility class for progress dialog

...
0
votes
1answer
2k views

Singleton Design Pattern Implementation: Bill Pugh

I have been trying to implement the Bill Pugh Singleton Design Pattern using a private static class to return the singleton retrofit instance. So far I have been able to come up with the following ...
4
votes
1answer
579 views

Android “ServiceListener” class for listening web services

I'm new in Android, Java and the whole object-oriented programming, I'm trying to develop an app which needs to listen on many web services (PHP scripts written by me returning a standardized JSON ...
3
votes
1answer
2k views

Android Authentication Activity with Fragments

I have an Activity called AuthActivity and I would like all of my authentication Fragments to be in this ...
1
vote
1answer
75 views

Android UI for converting numbers from base system x to base system y

As a complete beginner, I didn't care about how the code looked as long as it works. However, now I am starting to think about how to make code be more maintainable and easier to read. I feel I have ...
1
vote
1answer
113 views

Class with multiple parameters as the object of a WeakReference

I just read this post on how to avoid memory leaks with AsyncTask. The post proposed using a WeakReference and supplying a TextView as the object of the WeakReference. In my code, I need to supply ...
2
votes
1answer
67 views

Completely static builder implementation

CustomClass.class Description The CustomClass is created with init(), which returns a ...
2
votes
2answers
134 views

ListView Activity logic

I'm a beginner in Android and I've been experiencing "Skipped xx frames" everytime I load up my activity which is a list of languages. I tried optimizing the listview following tutorials (applied ...
10
votes
2answers
392 views

Find index of double number delimiter

I have a String with a double number. Unfortunately, the number is created on backends with different locals, so it could be ...
3
votes
2answers
500 views

Reading complete contact information in Android

My goal is to read complete contact information on an Android application. This is very slow and my understanding is that since the contacts are stored locally in a phone database, it shouldn't take ...
3
votes
3answers
868 views

Android recyclerview filter

I want to optimize the below code, I have asked a similar question here. I know this approach is better than my last code but I feel there are ways to optimize this too.This code is used in almost ...