Android is Google's software stack for mobile devices. For non-developer questions, see http://android.stackexchange.com
0
votes
0answers
4 views
Use same RecyclerView.Adapter with different ViewHolder
I would use the same RecyclerView.Adapter with two or more different fragments. Every fragment use different view items layout so I must use different RecyclerView.ViewHolder for bind the data.
For ...
1
vote
0answers
7 views
Retrieving data from cursor associated with a list item inside an anonymous listener method declaration
I've run into a problem twice just recently. Though I'm getting around it I can't help but feel that it's a rather unconventional method and that there's a better one.
This app is an exercise in ...
2
votes
1answer
31 views
Iterate faster through the Android file system and find specific files using java multithreading
I'm trying to extract specific files and visualise them in a list/grid. For that purpose I'm starting a Service to do the background job, and when it finishes it fires an Intent which will be captured ...
3
votes
1answer
100 views
Reuse a base class [Activity] handler in all sub classes for background work
We are using the Thread of a common base class but using its handler in all its sub classes. The code is working fine but is it the right way to go about?
Our base class looks like this:
...
5
votes
1answer
72 views
Better Toast function
I made this method for a better Toast function. But I have doubts about it.
Because this Toast forced me to make 2 methods and ...
1
vote
1answer
40 views
Key Value Store for Android on top of Sqlite3
I wrote this simple key-value interface on top of Sqlite3 to use in my Android app. I am using this to persist Java objects as strings converted using Gson.
The public API has 3 methods.
...
4
votes
0answers
32 views
Grid with images in RecyclerView
I've created a Grid with a RecyclerView similar to the GoogleIO 2014's generic media player one.
GoogleIO generic music player
Mine
The thing is that the ...
4
votes
0answers
53 views
+100
Displaying NFC card data in Binary, Hex, String, etc
I am working on an Android application for reading NFC cards. I came to a point when I needed to design an abstract class to streamline the process of creating ...
3
votes
0answers
33 views
MVP with singleton presenter and presenter protocol
I'm new to Android and MVP in-general, and I've been doing iOS programming for the last 1.5 years, so I find delegate patterns easy to digest. I've implemented MVP in such a way that the view ...
4
votes
1answer
34 views
Android Network Job Queue
I've just finished working on a multi-threaded network queue and was wondering where I could improve. I'm a little rusty when it comes to waits and such.
The idea is to queue up network actions ...
1
vote
1answer
28 views
Handle network response and parse it
First I have method called in LoginActivity to call my login API. This is my Listener that reads user input and then passes it to a method to call the API:
...
4
votes
0answers
37 views
Android XML parser to parse themes
I used XML to control the theme of an InputMethod for Android. A theme in XML contains the color and the shape of keys.
XML file
...
5
votes
1answer
56 views
Task Reminder - Repeatedly notify every 6 hours
So I'm very much a beginner to Java and Android programming. I've worked a lot more with Python so I might have some quirks from there bleeding into my code here. I'd like a particular focus on ...
0
votes
0answers
23 views
Simple Activity that renders video, resizing overhead
This is simple Activity which renders video file from URI given in intent, it has no controls and finish work as soon as it pauses or ...
2
votes
1answer
45 views
Java basic AsyncCache implementation
I wanted to use an async-cache to store URLs of images that I have to display in a list. The image URL is fetched (REST call) using a unique UUID associated with each item of the list. I store this ...
7
votes
2answers
468 views
Three-in-a-row board game
I don't truly understand how OOP works and It's stopping me from creating good programs! Below I have a program that will check to see if there are 3 tiles from a gridview in a row.
Here's a ...
3
votes
0answers
34 views
Refactoring a top-level singleton class as an inner class?
I have an Android app with three different Activity classes. Each of the Activities uses and changes config and user-customization data stored in a wrapped ...
-1
votes
0answers
39 views
Input handling for Android calculator
I am learning Android and this is my first effort at writing an Android application. Please review it and point out some mistake or improvements.
Some part of it:
...
6
votes
2answers
100 views
2
votes
3answers
58 views
Static method to create intents
I had the idea to have a static method on an activity which creates intents that it can use. For example if I have an activity with a webview that can load html from a resource or a URL I would have 2 ...
3
votes
0answers
56 views
Event Aggregator Pattern Decoupling
I have an Android application that is using an EventBus architecture with publishing and subscribing events. Usually this is ...
2
votes
1answer
62 views
Handling screen rotation with volley request
To handle screen rotation when performing a volley request, I've written this code:
...
7
votes
3answers
100 views
Fastest way to change the HSV value of all pixels in a bitmap
I want to change all the pixels in an image to have the same value, in terms of the HSV colour space.
At the moment I'm running the following code:
...
1
vote
1answer
51 views
Is a Timer the best way to achieve recursive in Android?
I'm changing the Viewpager items programmatically using mViewPager.setCurrentItem(position); with a regular interval of time recursively. Please tell me if this is ...
2
votes
1answer
24 views
Java port of Titlecase
I have a port of titlecase, originally in Perl and ported to other languages such as JavaScript and Python.
...
1
vote
1answer
66 views
Inserting data into an SQLite database
I've execute this code in Android for inserting 100+ rows in SQLite database.
My current approach takes more time to initialize the database.
...
1
vote
1answer
59 views
1
vote
0answers
76 views
Track user's location and broadcast over Pusher
I am trying to track the user's location and transmit it periodically via Pusher (real time data service, pusher.com).
I am using Google Play Services for location handling. I need the location ...
1
vote
1answer
66 views
Safely using android 'Context' inside threads
Oftentimes I find myself using context inside threads, multiple times. The problem is that I do not want to hold a long-lived strong reference of it in my threads to avoid leaking it. I keep a ...
0
votes
0answers
26 views
Android Zoomable Listview
I spent a day looking for a Zoomable ListView and every answer was broken in some way. Finally I found a great template and made a couple changes to handle scroll boundaries.
You can extend any view ...
2
votes
1answer
61 views
OpenGL ES 2.0 Sprite rendering
Is this a good method to render sprites (textured quads) or is there a faster or better way?
Example use:
...
1
vote
2answers
42 views
Alert dialog manger class
I want to make a general alert dialog to use across the whole app. I created a class called AlertDialogManager and just one method to show ...
4
votes
1answer
50 views
4
votes
0answers
52 views
Android Google Play Services code for GPS
I'm using Google Play Services for Location in my Android app. This is my first app so I'm not expecting that I have utilized everything perfectly.
My app is to get GPS/Date and send to a server ...
4
votes
1answer
113 views
Accelerometer for Lightsabers - slicing through the Dialog interfaces
I am doing a lightsaber app for fun. I followed a tutorial to learn how to get information from the accelerometer to play lightsaber sounds. It instructed me to have the Activity where I get the ...
8
votes
2answers
84 views
Camera intents and file manipulation
I am building an Android application and there are five Activity classes or if you're familiar with the MVC pattern they would usually be the ...
4
votes
2answers
62 views
Program to provide CRUD operations for a Boxers(Fighter) table in a database
I have been through a few SQLite tutorials and wrote this code on my own to reinforce the principles. The tutorials I went through varied widely in a few areas so this is what I came up with as a ...
1
vote
1answer
60 views
Lookup map for converting Strings into Android `R.raw` integers
I'm currently working on an Android app and I need to translate keys of type String to Integers which are determined at compile ...
2
votes
1answer
55 views
Play market in-app billing
I want to add in-app purchases to my application. In-app in test mode works great, but there is no check on their authenticity. While googling some info about making server-side of in-app, I found out ...
2
votes
1answer
60 views
Replace an element of a List with a concrete Id
I want to replace an object of a List with another one. To find the item to replace I need to check the field id of the object ...
0
votes
1answer
274 views
Custom ListAdapter with ViewHolder Pattern
I wrote this class for a custom list adapter for my list view. I use the view holder pattern to make the list view move smoother.
Could anyone advice tell me if I did something wrong, or some way to ...
2
votes
2answers
79 views
Parsing a text file of node data into Nodes and Edges
I'm a fairly new developer (well, engineer really, but currently working on a software project). In the Android project I'm working on, I read a node representation of a map into my app and interpret ...
2
votes
1answer
240 views
Checking for Internet connectivity on Android
I wrote this code to check an internet connection and was wondering if this is the best way to do this check.
...
1
vote
2answers
104 views
AsyncTask alternative with Runnable and CountdownLatch
What is wrong with this pattern which emulates AsyncTask functionality?:
...
3
votes
2answers
179 views
Memory efficient A* (AStar) Algorithm
I am writing a solved for 15 puzzle game which will find the solution path to any NxN board. For easier boards the algorithm works great solving almost any 3x3 boards, most 4x4 boards, but when I go ...
1
vote
1answer
293 views
Xamarin image download and resizing for Android
This code addresses performance issues specific to Android running Xamarin / C# when downloading images (BMP/PNG) into a listview. The caller simply specifies the URL to fetch the image from, and the ...
4
votes
0answers
104 views
Dots game in Android
I'm trying to clone a Dots game with some little differences (power ups and objectives) as a school project. I have almost every objective done so no, I'm not trying to get my work done for free. I am ...
5
votes
2answers
73 views
Open Source Tokenizer
I'm developing an open source annotation processor for Android (ngAndroid). Part of the library is a small Java subset compiled language that can be used for data binding, events, etc. I plan to ...
1
vote
0answers
27 views
Adding rows to LinearLayouts which serve as lists
I have a fragment with a ScrollView and, inside of it, I need maybe 5 or 6 lists. To make things simpler, let's say there are three lists - list of names, list of ...
2
votes
1answer
106 views
Message queue with multiple producer, single consumer and no duplicates
I had to make a message queue in an android app which my thread takes messages from and processes them. There can be multiple producers and duplicate messages should be avoided. Rate of insertion is ...