a blog about coding & IT

  • Most efficient Mac browser Safari

    Safari is the most efficient Mac browser using the least amount of battery power (amperage) compared to Firefox and Chrome on Apple MacBooks.  In a quick test of watching YouTube videos in browsers here’s how much battery/energy each browser used: Safari: 1250 mA Firefox: 1600mA Chrome: 3600mA Chrome is far and away the most power hungry…

  • Robotium reference

    Enter text EditText / text field solo.enterText((EditText) solo.getView(R.id.email_edittext), “[email protected]”); Click Button solo.clickOnButton(“Login”); Check for Toast Text Message assertTrue(solo.waitForText(getActivity().getResources() .getString(R.string.msg_login_failed)));     More to come…

  • Android Robolectric Support Fragment FragmentTestUtil

    To use Android Support Fragment v4 in Robolectric 3.0 you must add gradle dependency in /app/build.gradle testCompile ‘org.robolectric:shadows-support-v4:3.0’ Then import into your Robolectric testing java class import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; then you can create/start android support v4 fragments within your Robolectric testing java class for unit testing: SupportFragmentTestUtil.startVisibleFragment(fragment); Cross posted to StackOverflow Android Robolectric Support Fragment.

  • Android Studio generate foreach loop

    Begin typing foreach until autocomplete pops up.  Select “Create a for each loop”. You’ll then get an empty for each loop that you can start filling in, first supplying the Type of each object, a variable name of your choice for that object, then hit Enter to move to the name of the variable (a…

  • Pause genymotion Android Emulator on Mac

    To Pause genymotion Android Emulator on Mac: Press the power button of emulator (bottom right corner) This is equivalent to executing “avd stop” within adb shell on the emulator Find the process ID number of VBoxHeadless using Activity Monitor In Terminal: kill -STOP <ID number from step 2> Your emulator is now effectively paused and uses no…

  • Android Studio androidTest sourceSets gradle not recognized

    Android Studio (app) build.gradle sourceSets androidTest java.srcDir property may not be recognized when using the array format of this source directory property setting. BAD sourceSets { androidTest { java.srcDirs = [‘androidTest/java’] } } GOOD sourceSets { androidTest { java.srcDir file(‘androidTest/java’) } } For setting up Robotium UI / Integration testing, it’s important that your androidTest source directory…

  • Android Fix Failed to Find Build Tools Revision

    Failed to Find Build Tools Revision 2X.X.X Android Build tools get updated often and whenever an Android project you import that is using a different Build Tools Revision than the one you’re using, you’ll see this error in Android Studio. To fix “Failed to Find Build Tools Revision” you have 2 options: Install the missing…

  • Refresh Gradle build.gradle Dependencies

    In Project Explorer: Right click on Gradle project Gradle Refresh All New dependencies should be downloaded and project refreshed. Java import statements for new Gradle project dependencies should work after this.

  • Eclipse – Add Java Gradle Project to existing Eclipse Project

    How to add a java Gradle Project into an existing Eclipse project Start by importing your required Java Gradle projects into Eclipse’s Project Explorer. Highlight your main project in Project Explorer. This is the project you want to add a Gradle java project to (so you can use import statements on packages found in the other Gradle project).…

  • Kill Tomcat on Mac

    How To Kill Tomcat on Mac when IntelliJ IDEA or Eclipse has crashed or you forgot to stop Tomcat before closing Eclipse. Step 1: find which java process is Tomcat Start Activity Monitor (Applications > Utilities), then order list by Process name Scroll to find java processes Note the PID #’s (process ID’s) Step 2: Pause java…

Got any book recommendations?