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
3
votes
1answer
53 views

The sorting in the app with fragments

This phonebook application has a menu, which sorts by name or category. I do it like this in MainActivity: ...
2
votes
2answers
661 views

Compress an array of strings in Android

I'm compressing an array of strings in an Android app. Is there something you would suggest? ...
4
votes
1answer
2k views

Android recycler view adapter filter

I am trying to optimize the filter method for RecyclerView Adapter in Android. The list is used as an ArrayList. I have seen ...
2
votes
0answers
41 views

PopupMenu implementation that hacks inflating a @MenuRes

Summary Usage will ask for a Context and a @MenuRes and then use the ...
2
votes
0answers
1k views

Small camera app in react-native for Android

I'd like you to help me review a small camera app. Most of the code comes from here; I just changed it a little bit. I started dabbling with react-native for the first time. It seems kinda neat but I ...
1
vote
2answers
3k views

Returning a URL string of an API endpoint

I have a class with multiple methods which return a URL string of an API endpoint. Each method takes different parameters based on what the endpoint have to include. Examples (among others): GET: <...
1
vote
1answer
85 views

Creating an AlertDialog with a list

I am wanting to implement an AlertDialog with a list into my app and I created a sample to see if I can get the result that I am looking for. It seems I do have the ...
2
votes
1answer
3k views

Animating multiple views in Android efficiently

I am currently making an application where the user will launch the app and the first this we see is the app logo fade in at the center of the screen. After about a second, the logo will translate up ...
4
votes
1answer
268 views

TextView vs Button for Android AlertDialog

I want to open an AlertDialog on the click of either a Button or TextView but I am not sure ...
3
votes
2answers
158 views

Calculating Pi with Android

I'm kind of new to Java but I am writing an Android app. Right now I'm working on an async task to calculate Pi but when I run it the memory usage increases alarmingly (+5MB per second). This one ...
6
votes
1answer
335 views

Drawing a Koch snowflake in Android

Here's my attempt to draw Koch snowflake. My initial state is a line instead of an equilateral triangle so that I am able to fit maximum detail in a mobile phone window. My thought process was: ...
2
votes
3answers
562 views

Storing quiz questions in SQLite

I am creating my first android app. It is going to be a quiz. There are 40 different question categories and each category has its own database table. I am writing all questions into a sqlite database ...
4
votes
1answer
196 views

JSON loader with event bus, cache, and session

I have an Android application which needs to retrieve JSON files from a server and then display the information in my app. To accomplish this I have the following architecture: The main activity adds ...
0
votes
1answer
46 views

“Photo Sales App” exercise as homework, and processing multiple checkbox “isChecked” values

I've done this assignment here for my android programming course I'm taking. The exercise requirements were to create a single-activity interface for selecting a 'photo package' to purchase, and to ...
1
vote
1answer
524 views

DatabaseHelper with multiple tables

I am programming my first android app. It is going to be a quiz. It will have 40 different categories of questions and for each category I am going to have a SQLite Table, which holds the questions ...
3
votes
2answers
4k views

Android - Share ToolBar across whole application

I have 3 ToolBars that I use across my whole application The first one is just a ToolBar with a close button. The second one is a ToolBar with a close and delete icon. The third one is a ToolBar ...
2
votes
0answers
68 views

Refactoring App launch sequence using reactive programming

In the SplashActivity of my Android Application, the following sequence of events occur: Check if Google Play Services is installed If Google Play Services are ...
1
vote
1answer
85 views

Android - handle navigation to multi activities from list view

Here is my case I made list of items when I click at any item it should navigate to certain activity. Here is my I am done First I set number of constants to distinguish between each activity ...
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 ...
2
votes
2answers
2k views

ِAndroid 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 apps. At first I get used to check permission by this way: ...
1
vote
0answers
343 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 ...
1
vote
1answer
498 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 ...
0
votes
1answer
3k views

MainActivity RecyclerView lags

My app, particularly the MainActivity suffers from some lag when I scroll through the RecyclerView. I tried to fix ...
4
votes
1answer
4k 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
108 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
278 views

Android RecyclerView holding rows of razzles

I have a RecyclerView that works and everything, and this is how I coded it: ...
3
votes
0answers
1k 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 ...
1
vote
0answers
2k 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 ...
2
votes
0answers
7k 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
2answers
2k 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
141 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' ...
5
votes
1answer
11k 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 talk ...
1
vote
0answers
132 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
112 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
359 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
4k 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 ...
4
votes
1answer
3k 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
656 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
129 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
1k 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
113 views

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

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 ...
1
vote
1answer
93 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
3k 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
59 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 ...
3
votes
1answer
213 views

SQLite database for books

First, my Book object: ...
4
votes
1answer
33 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
115 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
186 views

Checking authentication status by looking for a cookie

I'm an Android newbie. I have this function in my code: ...
2
votes
0answers
2k 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? ...