Profile

Cover photo
Michal Harakal
431 followers|34,191 views
AboutPostsPhotosVideos

Stream

Michal Harakal

Shared publicly  - 
 
 
Are you using OkHttp with Volley? (Or do you want to?)

Here's a new HttpStack implementation which uses OkHttp's native request/response API instead of relying on the HttpURLConnection wrapper. Bonus: This means that OkHttp's hot new interceptors feature will now work with it!
6 comments on original post
1
Add a comment...
 
 
For those running into errors about missing dependencies when building Android apps using the newer AppCompat and Google Play Services (and other) libraries, read this to avoid some pain.

#gde   #android   #blogpost  
Some of the newer Android/Google libraries have been published with invalid dependency information. It looks like an endemic issue, but the ones that have caught me so far have been com.google.android.gms:play-services:6.1.7...
6 comments on original post
1
Add a comment...

Michal Harakal

Shared publicly  - 
 
 
Today’s #AndroidTesting #Protip from +Stephan Linzner is about unit testing your code using  Mockito.

Writing unit tests is an important part of the Android development cycle as it encourages an incremental development approach and allows you to easily refactor your code, to continuously improve its quality. Unit tests are all about dependencies or about replacing dependencies with test doubles [0]. This allows you to run your tests in isolation as much as possible. But this raises the question on how you can efficiently create test doubles in your unit tests. One way to create test doubles on Android is to use Mockito [1]. Mockito is an open source mocking framework that offers a fluent and readable API which allows for both “state-based-testing” (stubbing) as well as “behavioral-testing” (verifications) [2].

To get started with Mockito in your unit tests you need to include the following dependencies in your build.gradle file [3]:

dependencies {
    androidTestCompile 'org.mockito:mockito-core:1.9.5'
    androidTestCompile 'com.google.dexmaker:dexmaker:1.0'
    androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.0'
}

To create a mock object in your tests you can either use Mockito’s static methods or use annotations. 

AccountManager mMockAccountManager = mock(AccountManager.class);

This will create a mock object for Android’s AccountManager class. A slightly cleaner approach is to use the @Mock annotation which greatly improves readability of the test code.

@Mock
private AccountSelectionUi mAccountSelectionUi;

Stubbing methods with mockito follows the when/then pattern. To stub a method, call 

when(mMockAccountManager.getAccounts()).thenReturn(TWO_ACCOUNTS);

Here, AccountMananger.getAccounts() will return a fake account when it is called by the AccountsController. This lets you easily simulate dependencies, which can be very handy when dealing with framework classes. But Mockito also allows for verifying interactions.

verify(mAccountSelectionUi).showAccounts(aryEq(TWO_ACCOUNTS));

In this case we verify that the showAccounts() method was called on the AccountSelectionUi with the expected array of Account objects. You can find the sample code for the AccountsControllerTest in this gist http://goo.gl/IOjbXU.

Mockito can be a very handy tool when it comes to creating test doubles, but be aware of it’s limitations. Mockito can't create mocks for final classes and methods. Mockito’s philosophy is that tests should be easy to understand and low maintenance, therefore use mocks to stub  dependent methods of the unit under test and assert on the state of your unit rather than using behavioral verification which will more likely result in a fragile test. Have other Mockito tips? Let us know in the comments. Happy testing!

[0] http://www.martinfowler.com/bliki/TestDouble.html 
[1] https://code.google.com/p/mockito/
[2] http://martinfowler.com/articles/mocksArentStubs.html
[3] To use Mockito in Eclipse, you need to copy the following dependencies into the /libs folder of your Android test project.

#AndroidDev
36 comments on original post
1
Add a comment...

Michal Harakal

Shared publicly  - 
 
 
Please share: EventBus 2.3 and 2.4 released
Almost two and a half years after its 1.0 release, EventBus has grown to one of the most popular libraries for Android [1]. We were thrilled to learn that well known apps with 100+ million downloads use EventBus. That was more than enough motivation to start working on the next release.

OK, so what’s new? From the feedback we got, we learned that people want to adjust some details on how EventBus behaves in special situations. Should EventBus log if no subscriber is available for an event? What to do when a subscriber throws an exception? EventBus 2.3+ addresses those questions by being more flexible. But there's more: check the change log [2] for full coverage.

But why do we release 2.3 and 2.4 at the same time? Both are identical, except that 2.4 removes some deprecated APIs. If you still depend on those, 2.3 is your last chance. In all other cases, 2.4 is the better choice.

[1] AppBrain statistics: http://www.appbrain.com/stats/libraries/details/eventbus/greenrobot-eventbus, > 2,500 stars on GitHub
[2] Changelog: https://github.com/greenrobot/EventBus/blob/master/CHANGELOG.md
1 comment on original post
1
Add a comment...

Michal Harakal

Shared publicly  - 
 
 
Only two days left until Google I/O #io14!
Remember to RSVP to the event at https://plus.google.com/events/c8skrpernk3pn600jh24vlnbgmo to be able to enter the Silvertower!
View original post
2
1
Vladimir Pantelic's profile photoMichal Harakal's profile photoKalle “DAtterman” Mandl's profile photo
2 comments
 
Maybe in Hamburg. Not for sure yet.
Add a comment...

Michal Harakal

Shared publicly  - 
 
 
That was faster than I expected! Commit pushes ART to the default.
commit, 08d410f53249c18d752f56a881ed2335403080d4[log][tgz]. author, Brian Carlstrom , Thu Jan 16 17:55:07 2014 -0800. committer, Brian Carlstrom , Tue Jan 28 09:52:15 2014 -0800. tree, f90cf1e311c90b1e56cb0c0f39a9cceafa172f11 ...
3 comments on original post
3
Add a comment...

Michal Harakal

Shared publicly  - 
 
 
The fopdf tool (DocBook-to-PDF) is now called fopub, has been relocated to the #asciidoctor organization.
6 comments on original post
1
Add a comment...
In his circles
237 people
Have him in circles
431 people
Omar Noe Tsereteli's profile photo
Manfred Raid's profile photo
joao mateus's profile photo
Barbara Seniorenbetreuung's profile photo
Sven Bender's profile photo
Roger Hunziker's profile photo
Ronny Christel's profile photo
Jens Hohl's profile photo
SANID GmbH's profile photo

Michal Harakal

Shared publicly  - 
 
 
zählt nochmal ganz genau nach und kann es immer noch nicht glauben: Wir haben über 500.000 markierte Orte auf der Karte!!!!!

UNGLAUBLICH! Vielen Dank allen die dabei geholfen haben.

Zur Feier des Tages haben wir einige Geschichten und Zahlen rund um Wheelmap.org zusammengefasst. Denn seit dem Start mit 1.000 markierten Orten im Sommer 2011 ist viel passiert - und wir haben noch ein Menge vor. Dafür brauchen wir eure Unterstützung. Für 12,50 Euro können wir die Wheelmap eine Stunde weiter betreiben. 

Also jetzt Spendenheld oder Spendenheldin werden: www.wheelmap.org/spenden

Teilt die Bilder und am besten auch den Link. Lasst uns Feiern!
 ·  Translate
1 comment on original post
1
Add a comment...

Michal Harakal

Shared publicly  - 
 
 
A new edition of WhereCamp Berlin on 13-15 of November 2014!
This time is all about Navigation and Location Intelligence
http://wherecamp.de/
View original post
1
Add a comment...

Michal Harakal

Shared publicly  - 
 
 
freut sich wie ein Kind im Süßigkeitenladen über die neue Version der +Wheelmap.org-App für Android!!!

Das ganze Layout wurde überarbeitet, es gibt jetzt die Möglichkeit Orte zu bearbeiten, Bilder hinzuzufügen, die Karten kommen jetzt von Mapbox und und und...

Alle Neuerungen sind hier zusammengefasst: www.wheelmap.org/neue-android-app/

Es wäre total toll, wenn ihr euch die App anschaut und eure Freunde darauf hinweist.
 ·  Translate
Die Wheelmap Android-App ist die mobile App für Wheelmap.org - der Onlineka...
2 comments on original post
2
Add a comment...
 
 
Falls jemand wissen möchte, was ich vor meinem Feierabend mache: Ich arbeite an der Infrastruktur des Businessmarketplace.
 ·  Translate
Alle Vorteile zum Nachlesen: https://portal.telekomcloud.com/informationen/vorteile/ Software aus der Cloud hat viele Vorteile gegenüber herkömmlicher Softwa...
View original post
1
Vladimir Pantelic's profile photoKurt Huwig's profile photo
2 comments
 
Und wie! Die Dinger stehen in Deutschland, das Zertifikat wurde mit einem sicheren Zufallszahlengenerator erzeugt, als Verschlüsselungsprotokolle kommen nur die guten zum Einsatz. Es werden mehrere Firewalls hintereinander von verschiedenen Herstellern verwendet. Die Server sind in Käfigen mit Video-Überwachung und sogar der Unterboden und die Klimaanlage hat einen Durchkriechschutz. Selbst ich als Entwickler habe keine Möglichkeit, auf Kundendaten zuzugreifen. Sogar wenn die NSA-Jungs mit Kneifzangen und Lötkolben anrücken, kann ich denen nicht weiter helfen.
 ·  Translate
Add a comment...
People
In his circles
237 people
Have him in circles
431 people
Omar Noe Tsereteli's profile photo
Manfred Raid's profile photo
joao mateus's profile photo
Barbara Seniorenbetreuung's profile photo
Sven Bender's profile photo
Roger Hunziker's profile photo
Ronny Christel's profile photo
Jens Hohl's profile photo
SANID GmbH's profile photo
Links
Basic Information
Gender
Male