I would like to develop an application with two languages. Actually, the goal is to generate two differents application, one with a language (Java), the other on in another language (C#). I would like to use makefiles to help me generate one application or the other one, thanks to targets definition. I don…
How to disable loggers of a class or of whole package?
I am using Apache Commons Logging ™. For now I wanted to use SimpleLog implementation, but when I changed the level, loggers from the libraries came out. I want it to turn them off. Is there a easy way to change log level for whole package (can Log4j do that)? I have tried to set org.apache.commons.logging.si…
Android MVVM Design Pattern Examples
I currently do a lot of WPF development and have started creating some basic Android apps. When creating WPF apps I often use MVVM, normally using Prism, and would like to know if there are any examples of MVVM for the Android platform? Answer I am the developer of Android-Binding. Like @Brentley said, itR…
Cannot make a static reference to the non-static method
Building a multi-language application in Java. Getting an error when inserting String value from R.string resource XML file: This is the error message: Error: Cannot make a static reference to the non-static method getText(int) from the type Context How is this caused and how can I solve it? Answer Since getT…
I am getting “java.lang.ClassNotFoundException: com.google.gson.Gson” error even though it is defined in my classpath
I’m trying to parse some JSON object strings that I’m getting using gson-1.6.jar I have placed it in the same location as my other .jars and have added it to my buildpath in eclipse. The other libraries worked fine when I added them and I can use them without any issues, but when I try to create t…
HashMap with multiple values under the same key
Is it possible for us to implement a HashMap with one key and two values. Just as HashMap? Please do help me, also by telling (if there is no way) any other way to implement the storage of three values with one as the key? Answer You could: Use a map that has a list as the value. Map<KeyType, List<Value…
Remove multiple elements from ArrayList
I have a bunch of indexes and I want to remove elements at these indexes from an ArrayList. I can’t do a simple sequence of remove()s because the elements are shifted after each removal. How do I solve this? Answer Sort the indices in descending order and then remove them one by one. If you do that, the…
How to reference an ImageView from inside Java code in Android?
I have this xml-file: I’m calling my TextView in my java code like this: Is there any way to do the same for an ImageView? Answer Ya sure.. you can create an object as like TextView you did above,and create a folder named drawable under res folder and place the image u need,and set image view image by c…
How to set eclipse console locale/language
When developing web application with Eclipse (Helios) the tomcat output is being sent to the console. Ok, but the messages are being translated to my OS language. In fact, my Eclipse is in English, but the Tomcat output (logging) is being translated to Portuguese. Probably it’s a Tomcat configuration is…
How to filter string for unwanted characters using regex?
Basically , I am wondering if there is a handy class or method to filter a String for unwanted characters. The output of the method should be the ‘cleaned’ String. Ie: Expecting result would be: A better example: I expect the result to be: Because, i let the cleaner know that ‘ ‘, R…