Tag: java

How do you simulate low memory in the Android emulator?

Is there an easy way to simulate low memory inside the emulator ? I’m interested to perform resource cleanups similar to this post

SDK Manager.exe doesn't work

When I clicked SDK Manager on Program Files or run it in cmd, nothing happened. I did: Installed latest JDK Installed latest Android SDK Set environment JAVA_HOME and put %JAVA_HOME%\bin in path variable** Actually a black cmd window appears and disappears a milliseconds. How to fix it? Edit: I Googled day by day but can’t […]

Why should a Comparator implement Serializable?

New to Java. Learning it while working on an Android app. I am implementing a Comparator to sort a list of files and the android docs say that a Comparator should implement Serializable: It is recommended that a Comparator implements Serializable. This is the Serializable interface here. I just want to sort a list of […]

how to add button click event in android studio

So I have done some research, and after defining you button as an object by the code private Button buttonname; buttonname = (Button) findViewById(R.id.buttonnameinandroid) ; here is my problem buttonname.setOnClickListener(this); //as I understand it, the “**this**” denotes the current `view(focus)` in the android program then your OnClick() event… Problem: When I type in the “this”, […]

“You need to use a Theme.Appcompat theme…” when testing ActionBarActivity, but I am

I have a problem when testing an app which uses ActionBarActivity from android-support-v7-appcompat via Android JUnit test in Eclipse. When running in an emulator or device everything seems to work fine. I tried using a mock application as in ActivityUnitTestCase and startActivity with ActionBarActivity and changed the parent theme in values-v11 etc. as suggested in […]

Setting up Android support package v7 for eclipse – GridLayout

I’ve been trying this all evening to no avail so I’m going to list my exact steps starting from scratch. I’ve installed the support package via SDK manager. I create a new android project which I call “testinggridlayout”. The build target I select is Android 2.1 API 7. List item This will be my project […]

Passing a List in as varargs

This question already has an answer here: How to pass an ArrayList to a varargs method parameter? 1 answer

Difference between system.gc() and runtime.gc()

What is the difference between System.gc() and Runtime.gc()?

TrueType Fonts in libGDX

Does anyone know how I can use a TTF font in libGDX? I have looked around and have seen things about StbTrueTypeFont but it doesn’t seem to be in the latest release. EDIT: I found the StbTrueType font stuff, the jar file is located in the extensions directory. I’ve added it to my project. Now […]

Convert a String to a byte array and then back to the original String

Is it possible to convert a string to byte array and then convert it back to the original string in Java or Android? My objective is to send some strings to a microcontroller (Arduino) and store it into EEPROM (which is only 1 KB). I tried to use an MD5 hash, but it seems it’s only […]

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