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
8 views

How to pass data from onActivityResult() to recyclerview? [on hold]

0 down vote favorite In this program i am using the recycler view . It has AlbumListHolder which contains imageview(mAlbumProfileImage) .I want to implement longClickListener on the imageview of ...
2
votes
1answer
35 views

Using generics to find a View by Class

This works but feels clunky - any suggestions for improvement? ...
-4
votes
0answers
19 views

What is rx timeout:2500 in xamarin android? [on hold]

Keep getting output of rx timeout:2500 while trying to add a path to google maps in xamarin android. what exactly is rx timeout and how do i avoid it? I can't find it on the internet :(
1
vote
0answers
9 views

How to implement 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 ...
-4
votes
0answers
39 views

Understanding about clean code [closed]

I am struggling to write a clean code. I read lot of articles about clean code. I have written a small project to demonstrate my understanding. Can Someone review my code. advice to improve the ...
2
votes
0answers
17 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 ...
0
votes
0answers
27 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 ...
3
votes
1answer
49 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 ...
1
vote
1answer
30 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 ...
3
votes
2answers
307 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. ...
-1
votes
0answers
33 views

Apps for a server and a client

I have two Android apps, a server and a client. It seems to work, and by work I mean the handshake is successful. I am able to send data back and forth, but I feel like it's a fluke and something is ...
1
vote
1answer
34 views

Checking whether a nonnegative number is present in a database [closed]

There is this function that checks if data is present in a database table. I am currently using try-catch instead of multiple ...
5
votes
1answer
60 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
38 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
138 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 ...
2
votes
1answer
57 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
0answers
17 views

Getting data with Rxjava and retrofit

I am using rxjava with retrofit to get data from an api then filtering the data with for loop in the onNext Method. Is there anyway not to use the for loop and just use rxjava to filter or improve ...
1
vote
0answers
24 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 ...
1
vote
0answers
25 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
480 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
46 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
35 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
50 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? ...
2
votes
1answer
100 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
63 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
83 views

StopWatch app in android

Activity ...
4
votes
1answer
44 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
127 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
61 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 ...
2
votes
1answer
65 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
129 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
65 views

Drawing Routes on a Map

I have this class: ...
3
votes
1answer
32 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
61 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
33 views
2
votes
0answers
58 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
40 views

Retrieving access token from SharedPreference

Here is code that retrieves an access token from SharedPreference. ...
0
votes
0answers
20 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
468 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 ...
0
votes
0answers
26 views

Displaying three values with a title for each

I've created this layout to display three values with a title for each of them. The XML layout for the same is below. How can optimize this? The important thing here is the values are dynamic, but ...
6
votes
2answers
208 views

Android unit converter

I am developing a unit converter application for Android. The application is working correctly, but my problem is with the optimization. Is there a way to somehow optimize the code? I have different ...
1
vote
1answer
50 views

Limiting the amount of Calls to a Server

I have a server side operation which takes a percentage value from 0 - 100. The user controls this percentage using a SeekBar on the android client. Time-wise the ...
3
votes
2answers
88 views

Unit converter application

I am working on an Android unit converter application, but I came to the point where I have to assign the formulas to the calculation method. At the moment I am ...
2
votes
1answer
104 views

Check WiFi Connectivity and internet connectivity in Background thread - with a return value

I have written this class to check internet connectivity on Android, while there are many instances when WiFi is connected is taken as an implication that internet is connected as well. I wanted to ...
2
votes
0answers
77 views

First Android game: changing colors of neighboring squares

I have created a small game to learn more about Android. So the game is you start with a single gray square, and you try to take over neighboring squares. You can only attack 1 color per move, but ...
3
votes
1answer
100 views

Encrypt and Decrypt

I just want to know if my code can be weak. Can anyone also spot a mistake in my code? Encrypt ...