Skip to main content

Posts

Showing posts from November, 2013

EventBus for Android Quick Tutorial

Here I wanna demonstrate to you guys on how to get started on using GreenRobot's EventBus for Android. This is worked using Android Studio. To get started, add EventBus into Gradle dependency, inside build.gradle. dependencies {     compile 'de.greenrobot:eventbus:2.1.0' } (versions may vary. You need to check Maven Central for the latest version) The sample code is right here. https://github.com/L0rDKadaj/EventBusSample In this sample code, I have demonstrated how to pass an object from the PlaceHolderFragment to the SecondFragment by using sticky events, with a trigger of a Button. No more headaches on whether to convert an object into a Parcelable object or not. There are a lot of use cases that you can use EventBus for. For example, if you have a three pane layout in a 10 inch tablet, you can probably code two fragments to listen to the same event and the values will pass, which proves the decoupled concept.  But, you have to know ho

Setting Up Android CheckStyle in Android Studio

So we all want to abide by the Android Code Style Guidelines shown in the official Android developer website here . How do we get started by helping ourselves by abiding by the Java and Android code style rules? Simple. Set it in Android Studio with the instructions below:  1. Copy the file in  https://github.com/android/platform_development/blob/master/ide/intellij/codestyles/AndroidStyle.xml 2. Paste the file into ~/.AndroidStudioPreview/config/codestyles/ (in Ubuntu) or ~/Library/Preferences/AndroidStudioPreview/codestyles (in Mac OS X) 3. Go to Settings (or Preferences in Mac OS X) > Code Style > Java, select AndroidStyle, as well as Code Style > XML and select AndroidStyle. 4. Start code inspection and see the results by selecting Analyze > Inspect Code. You will see the results of inspection on the Inspection pane at the bottom and and you will notice things that you can improve in your Java code such as Code Style Issues, Android, D

Start and Stop Jenkins Daemon on Mac OS X

Just recently made a switch to a better work machine, being the retina Macbook Pro, and other day I've decided to nibble around Jenkins. After installation, Jenkins daemon fired up right away after that, and the browser pops up and loads the localhost 8080 to the Jenkins console. So basically there are two command lines that you should remember to start and stop the Jenkins daemon: sudo launchctl load /Library/ LaunchDaemons / org. jenkins - ci. plist sudo launchctl unload /Library/ LaunchDaemons / org. jenkins - ci. plist