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

learn more… | top users | synonyms

0
votes
0answers
18 views

ِAndroid - create class to handle MarshMallowPermission

Here is my class that handle all MarshMallow Permissions I prefer separate it class as I will call its methods in all my app . at first I get used to check permission by this way ...
1
vote
0answers
16 views

Combination of Java's Future and Android's AsyncTask

My goal is create a class which implements Future interface of Java (get, cancel, isDone...), yet provides callback like ...
0
votes
1answer
48 views

HttpRequest class using AsyncTask for Android application

I am using the following class to retrieve a http response, which contains data for my Android App. Everything works fine, but there is a performance issue. I get the following warning when requesting ...
1
vote
0answers
14 views

Cursor adapter adapts text views to wrong location on list view [closed]

I'm adapting data to a list view using a database adapter. Here is the code in my main activity setting the database adapter to the list view. ...
0
votes
1answer
34 views

MainActivity RecyclerView lags

My app, particularly the MainActivity suffers from some lag when I scroll through the RecyclerView. I tried to fix ...
1
vote
0answers
60 views

Testing a ViewModel in Android - MVVM with DataBinding

I am using MVVM pattern with databinding. I have written tests. But I want them reviewed. The test is related to JUnit test on the ViewModel. FeedViewModelTest....
1
vote
1answer
46 views

Android log in file for testing purpose

I have created a method which shows log in logcat and also writes into the file. Every time this method is called it appends String in file. There are so many read/write operations on disk/non-...
1
vote
1answer
73 views

Android RecyclerView holding rows of razzles

I have a RecyclerView that works and everything, and this is how I coded it: ...
2
votes
0answers
89 views

Android generic SQL database handler

Starting with the fact that creating the classic database handler in Android is really annoying and it usually takes a lot of time since you have to create one handler for each object, I thought at ...
0
votes
0answers
33 views

Android Login Screen implemented in Model-View-Presenter Pattern

So this is my first time implementing the MVP pattern in Android. As I understand the presenter should not contain any Android specific code. I am using ...
1
vote
0answers
36 views

Send a volley request in the background every 10 seconds to a server

I created a class called HomeService that extends the android.app.Service. I then declared and implemented a class called BackgroundService which extends Thread. In the run method of the class I call ...
5
votes
3answers
156 views

Android Activity with a RecyclerView inflated by a big ArrayList

This Activity has got a RecyclerView that is inflated with an ArrayList that is ca. 400 Elements. This is what an Element of ...
2
votes
0answers
27 views

Implementing FusedLocationProvider for more than one Activity in Android

I am trying to implement Google Maps in Android. I am also trying to learn different design patterns. I want to use location in more than one Activity hence I have used a class named 'GoogleLocation' ...
4
votes
0answers
42 views

Communicating upwards from nested fragments in Android

I recently asked this question on Stack Overflow, but now that I have a working example, I would like to have it checked. I set up the layout like this: I am going off the idea that parents can ...
1
vote
0answers
32 views

Android Internal Resource Reader

I'm not really sure if this is right, so it would be great to have it reviewed. I'm creating an Android library and made a final class with completely static methods for getting internal resources (...
2
votes
1answer
55 views

Using a new thread to post to observers

I have implemented my own Observer pattern. I want to post my events in a new thread. This thread would simply call all the the observers/listeners with the posted event. ...
6
votes
3answers
334 views

Finding and moving the next obstacle in a player's path

This code finds the next obstacle in the player's path, then moves it. I am trying to make it more efficient, because this code runs for each frame, and it lags a bit. It does work though. There are ...
6
votes
1answer
83 views

Simple calculator in Android Studio

I have been learning Java for a few months now and have created a basic calculator application in Android Studio for a school project. Since this is my first attempt at programming, I am sure that my ...
3
votes
0answers
46 views

Base activity for handling network state changes in Android

I had the need in one of my activies to handle displaying a message to the user when the network disconnected, and then reload the data for a RecyclerView adapter ...
3
votes
0answers
48 views

Tablayout code for Android

I am using Tablayout for an Activity in my app but for some reason icons for each tab using ...
0
votes
1answer
42 views

5 input based search form for Android

I've been trying to look for a better way in which a user has up to 5 inputs in which they can search for results in a database. I have 2 EditTexts in which the ...
4
votes
1answer
57 views

SearchActivity to search through an ArrayList<Obj>

I've coded this class that lets me search through an ArrayList displayed into a RecyclerView. This is the class: ...
-2
votes
2answers
81 views

How do I reduce the use of if else in this display function?

I have a method which uses the same code over and over again. I would like to optimize my code in such a way that there is no repetition in my code. I am sure there is a better way to do things ...
0
votes
0answers
45 views

Download of files in Async task for Android

I am using AsyncTask in Android to download files from the server. Is there a way by which I can improve the process? Can the download happen any faster? Is there a ...
1
vote
1answer
48 views

Video Feed via TCP Socket

I managed to send video feed over tcp socket using code and decode of string64. My problem is that the video feed is kinda laggy, and it's probably because of this time between coding and decoding. ...
6
votes
3answers
638 views

Validating an IP address and returning the reason it's invalid

I have a method that validates a user-written IP address in an Android application. If it's invalid, I need to know why and notify the user using a Toast. I ...
3
votes
2answers
44 views

CSV to Object converter with JavaDoc comments

This is a simple class but I'm looking to check I have the basics down to scratch. Is my documentation thorough enough? (I'm very new to writing JavaDoc) Have I created too many variables, and does ...
0
votes
0answers
56 views

Sending an image from a server to a client over a TCP socket

I only have one video stream of 30 FPS to send over a TCP socket and it's sending a lot of data through my router. Everything just lags I can't even display the image. Is there a way to improve my ...
0
votes
0answers
25 views

Libgdx play class becoming overwhelmingly complex/messy

I came here today to see if I could get some pointers to cleaning up some code for my game. I started developing this game, and now the class seems to have gotten way to big. It's the play screen ...
3
votes
1answer
68 views

SQLite database for books

First, my Book object: ...
4
votes
1answer
29 views

Places and their PlaceCategories

I'm going to start small here because I actually have several questions but I'll go one at a time. In the app I am making to better learn Java/Android/SQL/OOP, I have a page where a user can define ...
1
vote
0answers
35 views

Hde keyboard when pressing outside EditText

I am using the following method to hide the keyboard when the user touches outside edit text. I am passing most top view into my method ...
2
votes
0answers
66 views

Checking authentication status by looking for a cookie

I'm an Android newbie. I have this function in my code: ...
1
vote
0answers
95 views

Handling Firebase's asynchronous calls Android

I have written a helper class to manage callbacks from Firebase's asynchronous calls. Can this be implemented in a better way? ...
1
vote
1answer
84 views

Android MVP Adapter

While implementing Android Activity component using MVP pattern a discussion arose - who should be responsible of creating list adapter - view or presenter? If ...
0
votes
0answers
87 views

Releasing references with server connection library

I work on a custom library (Co.line) to do HTTP requests in REST. I tried to think of reducing the memory usage by cancelling the thread background and destroying all references. It uses a ...
3
votes
1answer
56 views

Catching notifications using Accessibility Service Android app

I am currently working on an app in which one of the tasks is to catch the notifications of different applications (phone call, Facebook, Twitter, Whatsapp etc...). Now I will have some values pre-...
0
votes
0answers
36 views

Check fragment for exclude show same fragment again

I use this code to check a fragment before showing it. What can you say about it? ...
2
votes
0answers
49 views

Randomizer App as Decision Maker

I am a newbie and self taught in programming. This is my first attempt to make app. Appreciate any input or comment to make my code writting skill better. https://github.com/snufflesrea/Decision-...
1
vote
1answer
79 views

Counter with increment and decrement buttons

For my first Kotlin project, I'm implementing the Redux pattern with simple Increment and Decrement buttons and a text view to display the current value. My main questions have to do with Kotlin and ...
5
votes
3answers
463 views

Does this method contain multiple implementations?

My teammate and I have a small discussion about the responsibility of a method. He thinks next method has two responsibilities and I think that only one. ...
0
votes
1answer
82 views

Android music-streaming app

This is my first time building an Android app or even using Java in the first place. All of this code does work, but I'm hoping to optimize it or find out if things could be done more easily than how ...
0
votes
0answers
87 views

Loading, saving and merging google-play saved games

I've written a class that handles all communications with the Google Play services. This class is meant to perform two main tasks, loading and saving a SQLite database to and from Google Play Games, ...
3
votes
0answers
43 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 ...
4
votes
1answer
162 views

Using a LinkedList type of adjacency list to create the word game: WordLadder

The user puts in a starting word and an ending word. My code creates a ladder between these words of words that are different by one letter. Start: gain End: fire Output: ...
2
votes
1answer
69 views

Android network API request

I often use a similar scheme work with an API project. Can it be made easier, or is there a standard approach? This class creates an API request: ...
3
votes
1answer
84 views

An app that uses the quadratic formula to solve ax^2+bx+c=0 so long that the answers aren't imaginary

I'm a beginner to Java and Android programming, and I wrote this app in order to get some practice. It works, but it's most likely not as good or efficient as it could be, since I'm new. I'm hoping to ...
5
votes
1answer
96 views

Card payment strategies

In my project, I have 3 payment mode. Via Manually Entered , Card Swipe, and cash. I have 2 fragments named RecordCardManuallyFragment and ...
1
vote
0answers
126 views

Full screen WebView Android app

I've created a working Android app for my project website. I'm newbie too android dev so please review the code of this app. Any simplification or suggestion to optimize it much appreciated. Thank ...