Tag: java

Restore Android back stack after app has been closed

What’s the best practise to manage / restore application back stack between multiple sessions ? Exemple of a Workflow : Activity A started (stack: A) Activity B started (stack: A B) Activity C started (stack: A B C) … User uses a different application (let’s say the GMail app) for a while … User goes […]

Java equivalent of .NET RSACryptoServiceProvider with SHA-1

I have the following data signing code in C# RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); string PrivateKeyText = “<RSAKeyValue><Modulus>….</D></RSAKeyValue>”; rsa.FromXmlString(PrivateKeyText); string data = “my data”; byte[] SignedByteData = rsa.SignData(Encoding.UTF8.GetBytes(data), new SHA1CryptoServiceProvider()); and I want reproduce the same code in Java (Android): String modulusElem = “…”; String expElem = “…”; byte[] expBytes = Base64.decode(expElem, Base64.DEFAULT); byte[] modulusBytes […]

com.google.firebase.database.DatabaseException: Serializing Arrays is not supported, please use Lists instead

I am trying to persist a custom object using the following code: DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference(); DatabaseReference curWorkoutExercisesRef = databaseReference.child(“workouts”) .child(mCurrentWorkout.getId()) .child(“workoutExercises”); WorkoutExercise we = new WorkoutExercise(exercise); curWorkoutExercisesRef.push().setValue(we); Here’s my object: public class WorkoutExercise { private String id; private Exercise exercise; public WorkoutExercise() {} // getters, setters, other methods // … } public class Exercise […]

Android/PhoneGap: Using third-party libraries in plugin-development

I’m working on a PhoneGap/Cordova plugin that’s supposed to provide a socket for sending and receiving OSC messages (Open Sound Control). For that purpose I’d like to use JavaOSC but I’m uncertain about how to include the library into my project. I’m using Android Studio and I’ve basically followed this tutorial to set up my […]

android eclipse not creating blank activity

The problem is, in Eclipse, the new >> Project >> Android >> Android Application Project >> BlankActivity does not create any Activities in the src directory, and does not include the Activities in the manifest.xml. I know this question has been asked before: Eclipse Juno won’t create Android Activity Eclipse doesn’t create Main Activity and […]

Android: handle unexpected internet disconnect while downloading data

I have here a function that downloads data from a remote server to file. I am still not confident with my code. My question is, what if while reading the stream and saving the data to a file and suddenly I was disconnected in the internet, will these catch exceptions below can really catch that […]

how to add a contact to a group android

I have following code to add contact to a group into android‘s contact app / people app, it does add the group but not the contact in that group, what am i missing ? I am adding contact successfully also creating group, i do get the ids of both the things , i m using […]

How to remove repeatable keys, key preview of the Android custom keyboard

How to remove repeating keys, key preview of Android Custom Keyboard. I used following method to remove key preview of the keys that I want. But that method is not working for repeatable keys. (android:isRepeatable=”true”) If the key is not repeatable, following method is working. delete key xml <Key android:codes=”-5″ android:keyWidth=”13%p” android:keyIcon=”@drawable/ic_key_delete_white” android:keyBackground=”@color/dark_key_background” android:isRepeatable=”true” android:horizontalGap=”3.5%p” […]

Gradle Javadoc task without warnings

I generate a javadoc .jar file with Gradle for my Android project. I’m using a similar setup like in this instruction. But I’m getting a lot of warnings that many symbols are missing. I noticed that the javadoc task doesn’t find any of my dependencies. How can I add my dependencies to javadoc task’s classpath? […]

Is it impossible to make an Android game stutter-free? I am going crazy here

I have been working on an Android game for the past 6 months or so, and have posted on here several times about various lag issues that I cannot get rid of. I ended up grabbing the LunarLander example and stripping it down to its very core components to see if I could make anything […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.