Profile cover photo
Profile photo
Qian JIN
122 followers
122 followers
About
Qian JIN's posts

Post has shared content
I have uploaded my slides from "Simple HTTP with Retrofit 2" from Droidcon NYC. The video will follow in a few weeks.

To coincide with the talk, I have also released Retrofit 2.0.0-beta1! While it's not done, it's very usable.

#AndroidDev

Post has shared content
Yeah, no longer need to pay that 5 euro ;)
The video recording for Dependency Injection with Dagger 2 is now available to watch for $FREE.

Unlike my talk on Dagger 1 last year, this is not tailored towards Android. It covers dependency injection as a pattern, how to use Dagger 2, and a peek under the hood at how Dagger 2 fulfills the dependency injection contract.

As always, I try to move through at a moderate pace with high information density under the assumption that you could re-watch. And now you can!

Video: https://parleys.com/play/5471cdd1e4b065ebcfa1d557 Slides: https://speakerdeck.com/jakewharton/dependency-injection-with-dagger-2-devoxx-2014

Post has shared content
Espresso 2.0 is here!

A release is never too late, nor is it too early. It arrives precisely when it’s meant to.” That being said, we would like to apologize for such a long wait. Part of the delay was caused by work that ensures that this does not happen again.

Espresso 2.0 is packed with new features[0], but perhaps the most important change is that Espresso is now part of the Android Support Library and available in the Android Open Source Project (AOSP) soon. This will make it easier for you to contribute to future releases.

With this release, we would also like to introduce the new AndroidJUnitRunner[1], which contains all the functionality of GoogleInstrumentationTestRunner and adds extra features[2], including Junit4 support.

Although this is an API-breaking release (hence the major version bump), we do not expect the majority of projects to be affected by anything other than the package name change.

We have added a new set of individual sample projects, available on GitHub[3], to make it easier for you to learn about the new features and get started with Espresso.

Documentation[4,5] and Javadocs[6,7,8] are still hosted on android-test-kit, but will move to d.android.com in early 2015.

We hope that you enjoy the new Espresso experience and look forward to your feedback and contributions.

Happy holidays and happy testing!

#androiddev  #androidTesting

[0] Release Notes - http://goo.gl/oJBysE
[1] AndoidJUnitRunner Javadoc - http://goo.gl/Tct8R5
[2] AndroidJUnitRunner Docs - http://goo.gl/pSr8oB
[3] Android-Testing Github Samples - http://goo.gl/zNHuS9
[4] Espresso Setup Guide - http://goo.gl/WR9t36
[5] Espresso Documentation - http://goo.gl/jSI0xl
[6] Espresso-Core Javadoc - http://goo.gl/OyaHKn
[7] Espresso-Contrib Javadoc - http://goo.gl/gZgISI
[8] Espresso-Idling Javadoc - http://goo.gl/ZwVyn7
Photo

Post has attachment
v1.2 out

Post has attachment

Post has attachment

Post has attachment
Moodstocks Scanner v2.0, brand new design & custom setting. Now works with Google Glass!! :) #android   #moodstocks   #glass   #imagerecognition  

Post has shared content
Today’s #AndroidDev #Protip from +Katherine Kuan is about running a tool called Monkey on your app to catch crashes.

Even if you have a thorough test plan, it’s worth running the Monkey tool to stress test your app. This is good practice before any Play Store release to evaluate the app’s stability across different devices. Monkey is a program that generates a pseudo-random stream of user clicks, gestures, and system events. You can run it from the command line on a device or emulator. Monkey will stop and report the stacktrace if your app crashes or throws an ANR (Application not responding) error. 

Example command to execute 10,000 events for an app with a specific package name:

adb shell monkey -p your.package.name -v 10000

Example Monkey output in console:

:Sending Touch (ACTION_DOWN): 0:(619.0,108.0)
:Sending Trackball (ACTION_MOVE): 0:(1.0,-5.0)
:Sending Flip keyboardOpen=true
:Sending Touch (ACTION_UP): 0:(283.21295,1511.7723)
// CRASH: com.example.foo (pid 14650)
// Short Msg: android.os.NetworkOnMainThreadException
// Long Msg: android.os.NetworkOnMainThreadException

 { Full stack trace would appear here }

** Monkey aborted due to error.
Events injected: 78
:Sending rotation degree=0, persist=false
:Dropped: keys=0 pointers=0 trackballs=0 flips=0 rotations=0
## Network stats: elapsed time=393ms (0ms mobile, 0ms wifi, 393ms not connected)
** System appears to have crashed at event 78 of 10000 using seed 1391391361152

End users can often run into the same errors that Monkey finds, so it’s worth investigating the root cause. On some occasions, there may be errors that only Monkey can reproduce due to the rapid succession of events it executes. Hence, use your judgment on the priority of these bugs.

And if you've got special areas of your code that Monkey shouldn't ever reach (for example, submitting a real credit card payment), you can guard this code with the wonderfully named ActivityManager.isUserAMonkey() method (goo.gl/BARX).

For more advanced features of Monkey, check out the documentation (goo.gl/3Es0cP).

In the comments below, tell us if you catch anything with Monkey!

Post has attachment

Post has shared content
Here's a quick  #androiddev   #protip  on Printing from +Rich Hyndman 
If your app uses a WebView for rendering any content, maybe your help pages, there is a really handy helper function in KitKat for printing them out.

Calling WebView.createPrintDocumentAdapter() [1] and passing the result into the PrintManager is all you need to do to bring up the system Print dialog, using the application's name as the document name will also help the user:

PrintManager printManager = (PrintManager) getSystemService(Context.PRINT_SERVICE);
PrintDocumentAdapter adapter = mWebView.createPrintDocumentAdapter();
printManager.print(getString(R.string.app_name), adapter, null);

Don't forget to API-gate the function, a res/menu-v19 folder can help with that.

[1] http://developer.android.com/reference/android/webkit/WebView.html#createPrintDocumentAdapter()
Wait while more posts are being loaded