Tag: java

Logging on device to file

How to redirect logging on device to file? My application is hang on device but works great on emulator – I want to see logging on my device without sdk and its tools.

Using Paint.setStrokeJoin() and Paint.setStrokeMiter()

I’m curious about what these methods do and how to use them as there doesnt seem to be any details beyond the single sentence descriptions in the Javadocs: setStrokeJoin setStrokeMiter Anybody have some example code or a good description?

RealmObject AND Parcelable

I’m new to Realm for Android so I’m not sure I’m approaching this the right way. I have a class which looks like this: public class Entry extends RealmObject implements Parcelable { … } The problem is the Parcelable interface contains methods like describeContents() writeToParcel() and RealmObjects aren’t supposed to have methods other than getters […]

ZXing Barcode Reader: How to make custom border around capture screen?

I want to put custom border around zxing capture screen (camera screen). What modification would I need to make for this? Which activity and layouts would I need to change to have this effect?

Are new threads automatically assigned to a different CPU Core in Java?

In Java, and more specifically, Android, are new Threads automatically assigned to a different CPU core than the one I am currently utilizing, or should I take care of that? Also, does it matter how the new thread is created, using the Thread class or submitting a Runnable to an Executor, that maintans a pool […]

Android studio won't let me use switch on a string?

I’m creating a android app in android studio and trying to create a switch case on a string. As far as i know this is possible, as long as you got a JDK equals to 7 or higher. I’m using the following /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home and still gets an error when trying to switch on a string. […]

Android – How to run intent from JavaScript

I am new to Android and Java. I have constructed an app using HTML/Javascript that is working great. I now need to create an activity that launches the email client, fills in subject and body, and (the tough part) adds a file attachment. I have not been able to do this from within JavaScript, mailto: […]

SimpleDateFormat behaviour change in Android Marshmallow

I have encountered an issue with date formatting on Android 6.0, Marshmallow. The code throwing the exception noted below is a pure-Java library (built separately) which my application uses for API requests (“the client”). The library is built with Java 1.6 if that is related…anyway, here is the code; SimpleDateFormat dateFormat = new SimpleDateFormat(“yyyy-MM-dd E […]

How to use java.nio.file package in android?

I want to create a file manager application for Android using java.nio.file API which is the part of JDK7. I think this (java.noi.file)API contains easy solutions to design file manager application where JDK6(IO) and apache commons IO API does not have the same facility. Please give some solution, how I use the JDK7 (IO) in […]

Java optimizations: (Hotspot/Dalvik) Optimization of final method returning a constant?

Can anyone tell me if either Hotspot or Dalvik is smart enough to inline calls to a final method returning a constant (static final) int value? Ideally the method call would be replaced by the constant. This might either be at class load time or through JIT. This has implications in the design of some […]

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