Skip to content

Content Tagged "java"

Page 2 of 2

TIL: Lambda Expressions

October 19, 2015Category: Software
TL;DR: A lambda expression is a shortcut notation to anonymous inner classes containing a single method . Usually, they define implementations for functional interfaces (interfaces declaring a single method). Today I finally found out what lambda expressions are (formally) by watching…

Manually Create a Retrofit/OkHttp Response for Testing

September 21, 2015Category: Software
I've got a method in an use case which requires a Retofit Response object as parameter and I need to test it. Now, I can use the Retrofit itself and build one with the network, but it would require the full android shebang. I've opted instead for building a Retrofit Response manually. My method is…

Android: Provide Local Asset in Testing

March 13, 2015Category: Software
In the past few days I had a little bit of a problem: InstrumentationTestCase gives access to local assets while AndroidTestCase gives access to getAssets() for assets specific to testing. I had a scenario to test where I get a file from my local src/androidTest/assets directory while the code…

Use a Java Enum with Strings

March 10, 2015Category: Software
In my project I wanted to log messages using predefined categories. Traditionally, I do it via classes (if the messages are specific to the functions provided by that class): or an interface (pretty much the same thing): These solutions are prone to errors (e.g. when performing copy-paste and…

Android java.lang.VerifyError and Boilerplate code

August 19, 2014Category: Software
TL;DR: Change the java version compatibility in your gradle file (see below) or remove Hugo references from your e.g. "debug" code in Velcro. The other day I discovered a bunch of template-based application generators for android. While they are very interesting and apply some of the best…

ELI5 - Injection Concepts

August 9, 2014Category: Software
TL;DR: Injection is the process to automatically initialise variables (or parameters) when building an instance. I'we tried to wrap my head around dagger for a few days until I realised I was missing actually the concept of injections in java (to my defense, I stopped using recent java releases…

ELI5 - Android and Java Libraries and Concepts

August 8, 2014Category: Software
These days I'm learning how to build an Android application. After building a step-by-step simple app (like a " Hello world! ", but with lists and fragments), I wanted to go further and build something more complex, using afree tamplate. There are a lot of boilerplate templates for an app, but…

Use a GraphView in a Fragment

February 22, 2014Category: Software
From what I've seen, most tutorials relative to GraphView use direct Action s. I wanted to use a Fragment instead. Here are the steps I did (using the Android Studio): Create a Layout Fragment First, create a fragment (create a new Layout Resource File ), based on a LinearLayout . I ended up…

Web services: Create a client with wsimport

May 14, 2010Category: Software
Following is a quick tutorial on how to create/use a web service (WS) client with wsimport. Recently, I have been playing with creating a client to a WS using wsimport . Why wsimport? Because I've hass the WS server (using AXIS ) and a bunch of source code generated using AXIS too. For my purpose…

All tags