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

learn more… | top users | synonyms

-2
votes
0answers
33 views

Evaluation of SOAP and REST based code for Expressitivity

Currently I am doing a project for my Master's thesis and have to evaluate web service standards for Web of Things applications(Real-time Patient Monitoring System). Below is code I have written in ...
0
votes
1answer
37 views

Square ImageView

This is good practice, to make square image? Side of the square container is equal to its width. ...
1
vote
1answer
67 views

Retrieving location coordinates from SQL database and plotting on a map android Gmaps

I am new to Android development. I am currently working on an Android app that fetches changing location coordinates from a SQL database, and plots on a Map view at regular intervals. But I think this ...
1
vote
1answer
40 views

Logging in to Android application using Firebase

I currently have an app that uses Firebase for logging users in and I would like to know if I can make this code any better. I currently have 4 files: auth/models/User.java auth/BaseActivity....
1
vote
2answers
71 views

Populating a Fragment/Activity dynamically on Android gets ugly

So here is the ugliest fragment of my application, I tried to reformat as much as I could but I think it's still pretty ugly. Basically, I'm trying to use an API call to receive JSON which tells me ...
0
votes
0answers
35 views

Calculate point on scaled, translated and rotated canvas

I've got the following two methods, written for xamarin: ...
1
vote
2answers
75 views

Properly structuring SQLite classes/operations in Android

I am new to Android development and I want to ensure I'm learning decent practices for doing things. Right now this is my database class, which currently allows me to make a new instance of the ...
0
votes
0answers
25 views

3 data related RecyclerViews, each in one page of ViewPager

I have ViewPager with 3 tabs. In each of them is one RecyclerView. Each of the RecyclerView ...
5
votes
1answer
152 views

Simple Background Thread Worker Class (follow-up)

This is a follow up of Simple, generic background thread worker class What changed? Moved from synchronized lazily evaluated static instances to true Singletons per the on-demand holder idiom https:...
3
votes
1answer
65 views

Using generics to find a View by Class

This works but feels clunky - any suggestions for improvement? ...
1
vote
0answers
39 views

Paho MQTT client in Android that has to be accessed in multiple activities

I am having an app that has multiple activities and uses MQTT. I am using the Paho client in Gradle dependencies as follows: ...
2
votes
0answers
28 views

Class for serializing generic gson objects

I realized I had just created two classes that were virtually identical for simply saving objects to their own json files, so I've attempted to make it more generic. My only noticeable problem is ...
1
vote
0answers
39 views

Get vertical acceleration from rotation vector and accelerometer values

My goal here is to calculate the acceleration towards the ground, which I call "vertical acceleration". This seems to be working OK for the most part, except when there is a lot of rotation going on ...
4
votes
1answer
74 views

Simple, generic background thread worker class

While I'm not aiming for a drop-in replacement for AsyncTask, I would like a utility class that accomplishes some of the same goals. Considering the criticisms of <...
2
votes
1answer
50 views

Custom countdown timer class to replace the Android CountdownTimer

This project was made to replace the stock Android CountdownTimer class. It is more responsive when completing the timer and adds additional functionality such as ...
5
votes
2answers
354 views

Android splash screen

I have implemented a splash screen, to hold/pause the screen for few seconds and then launch the next screen. I am very enthusiastic to know if there is a more basic way to write the code. ...
5
votes
1answer
64 views

CountDownTimer that responds to clicks

The app: Creates CountDownTimers and displays them in a simple layout. The user can choose how long the timer should be through SharedPreferences and a settings activity. Each timer has a preparation ...
1
vote
0answers
44 views

Check if registered then unregister or simply unregister

I am trying to figure out which of these two calls are more efficient: Check if listener is registered before calling unregister. ...
3
votes
1answer
145 views

AsyncTask method

Even I know that this isn't a good way of writing code, but I need to improve this. Here I am retrieving data from Server in Json format by Posting some variables in doInbackground. Getting all the ...
3
votes
1answer
67 views

Android login system

I am completely unaware of all the Android features and available libraries. I just designed a login system to practice it. I have referred to a few books and tutorials. Layout I am using relative ...
0
votes
1answer
42 views

Getting data with RxJava and retrofit

I am using RxJava with retrofit to get data from an API then filtering the data with a for loop in the onNext Method. Is there ...
1
vote
0answers
27 views

Handle GCM registration tasks

I have implemented Google cloud messaging in my mobile app following the Google docs. It seems I have a lot going on in my MainActivity class at this point. I'm ...
2
votes
0answers
32 views

Few DatePickers and TimePickers in Android activity

I'm developing an Android activity which asks user to enter start and end dates and times in order to know a certain period of time. After picking start date, user picks start time, and then he/she ...
6
votes
1answer
489 views

Login UI for an Android app

This code starts a new thread for login and reacts according to the JSON result returned by the server. I think this code has too many conditionals, exception handlers, and nested functions. ...
4
votes
1answer
52 views

Async Task with multiple requests in android

I am using this AsyncTask class to update two different tables on SQL Server. So far this code works fine, I'm interested in a better and more sufficient code ...
2
votes
0answers
38 views

Retrieving the most recent posts from the users someone is following

I have two different implementations for retrieving posts from the users someone is following and I want to know which one you would recommend using. First I'll show you the tables, and then the two ...
3
votes
0answers
51 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 ...
0
votes
0answers
32 views

Filtering based on actions and keywords

I have an Android function that when an intent is passed, it filters based on the actions and keywords. How can I improve this function? ...
3
votes
1answer
118 views

Sudoku Android Code

I have been programming for a long time, but nobody has given me any feedback if my code is good or not. Please review it, and give me feedback where I could be better. The source code is also on ...
1
vote
1answer
65 views

DBSCAN in C++ for general and Android use

I've implemented a templated DBSCAN for general use. At the moment, it's going to be used on Android through the JNI. I used Wikipedia's pseudocode and a little bit of the DBSCAN paper for reference. ...
5
votes
2answers
93 views

StopWatch app in android

Activity ...
4
votes
1answer
47 views

Pulling from data from SQLite DB on Android

Apart from merging the 2 get methods, what else can I do to optimise this? Both input and output cannot be changed. Is there a way to iterate a map while writing to it? ...
0
votes
0answers
31 views

Prompt to pay for in-app purchases

I have the following code that prompts the user to pay for an in-app purchase when they click a button. I was wondering whether it was efficient or not: ...
0
votes
1answer
57 views
2
votes
0answers
266 views

Android Studio Background Service to Update Location

I have this background service, which runs continuously even when the application closed (Paused or Stopped). The service is to retrieve the user location and post it to server. Here's my code. <...
4
votes
2answers
67 views

Simple Timed Cache by Wrapping HashMap

Just wanted to get a bit of feedback on this simple cache. My use case is to store this data on an Android client to avoid making a high volume of network calls for lookups. I feel like maybe I ...
3
votes
1answer
76 views

Android SQLite architecture for a task list

I'm writing a simple Android app with a database and am trying to make the right architecture for accessing a database. MainActivity.java ...
0
votes
0answers
172 views

Loading autocomplete text view adapter dynamically using async task in Android

I am working on an app in which I need to get destination list from server and set it in autocomplete text view. I am using text watcher and on its onTextChanged event I am fetching destinations data ...
5
votes
1answer
91 views

Drawing Routes on a Map

I have this class: ...
3
votes
1answer
34 views

Synchronization of new data with previous data

I am working with synchronization for the first time. I wrote some code that I have to implement in my current work. I wanted to know if I am doing it right or am I making a mistake. Whenever a new ...
1
vote
1answer
62 views

Progress indication with animation

I have a game in which the player has to do something within a defined time. E.g.: the player has 10 seconds to complete a level. My current code animates an imageview (it's only a horizontal line) ...
8
votes
4answers
2k views

Selecting an enum for a payment transaction

I'm writing a small Android application that deals with payments and, in my function that handles transactions, I need to translate a number of installments (1-12) and whether or not it has interest (...
3
votes
1answer
36 views
2
votes
0answers
63 views

Android app that listens for commands over a socket

I've just begun programming Java and I'm working on the following code that deals with socket-based communications. Basically it connects to a client on port 8888: Gist of code ...
1
vote
1answer
41 views

Retrieving access token from SharedPreference

Here is code that retrieves an access token from SharedPreference. ...
0
votes
0answers
21 views

Streaming music in Android

I want to stream songs, so for this purpose I have been coded this until now. But the problem is it takes much time. ...
-1
votes
1answer
837 views

Recycler view with cursor adapter

I am trying to get a recycler viewer with a cursor adapter. I seem to miss important points, so my view gets some of the data repeated instead of all the data at once. Can anyone who knows about this ...