Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Friday, 1 April 2016

Android Unit Testing

The Gradle Plugin supports two different types of tests.

Unit Testing is supported by locating all classes under the path src/test/java and any dependencies defined within the module gradle build file e.g. testCompile based dependencies.

Instrumented Tests covers all tests that are intended to be run against the app within the emulator or live device. These test classes by default are located under src/androidTest/java and have corresponding module dependencies e.g. testAndroidCompile

Unit tests can be run in one of two ways depending on context.

Command Line from the command line, the Gradle task test can be used to run and generate a report of the test results.

bash gradlew test; open app/build/reports/tests/debug/index.html

From the IDE from within IntelliJ or Android Studio the unit tests can be run by:

  • Select "Build Variants" from left tray
  • Select Test Artifact = Unit Tests
  • Run indiviual or groups of tests as usual

.

Tuesday, 28 August 2012

Beanshell Android Source Script

Edit: Updated 2014-08-26

Download

For those using SL4A and Beanshell on their Android, one of the things you need to do if you want to access the Android instance is to know the location of the android.bsh script which is included as part of the Beanshell installation.

The script embedded in the above QR code provides a simple way of working out this location without having to hard code it per script, making your scripts much more portable.

Feel free to use this any way you like, and in particular I would be interested to see any further optimisations to this script as the character count matters in a QR Code based scripts.

Monday, 14 May 2012

UFO: Enemy Unknown on Android

Watching the video for the most recent and promising remake of UFO: Enemy Unknown I decided to see if you can get the game running on Android.

Turns out it is pretty easy.

Emulator

I have tried two emulators for this now:

  • aDosBox Free and works well enough. Performance is not great and the app crashes when you lock the screen which means you can't pause play to do anything else. There is a niggle with the mouse in that the game locks up until you move the mouse sometimes.
  • DosBox Turbo £2.49 and is excellent. The performance is flawless and the mouse trackpad is arguably better than aDosBox (which I thought was pretty good already). The screen can be locked and the game resumed later when you're ready. Worth the money.

Get the game

Find a copy of the DOS version of UFO maybe?

Unzip it to your SDCard. e.g. /sdcard/games/UFO

DosBox conf

aDosBox

If you are using aDosBox, then edit the DosBox configuration file _/mnt/sdcard/app-data/org.hystudio.android.dosbox/.dosbox/dosbox-0.74.conf_ and changing the end of the config file to the following:

  • mount c: /sdcard/games/UFO
  • c:
  • UFO

DosBox Turbo

If you are using DosBox Turbo you can find the Autoexec configuration in the DosBox Manager App. Create a configuration for the game, then long press and select Edit Config. DosBox Settings -> Autoexec. This will give you a text field to enter your autoexec config into.

For more details see the authors website

I would also recommend use the Absolute Touchscreen Mouse. After a little practice I found this to be much quicker than relative mode.

Play

There you go, DosBox will start and load XCOM automatically.

The keyboard and mouse interface works nicely, again not as responsive as a real mouse and keyboard but enough to play.

Dropbox Sync

Finally I went one stage further and used Dropbox synchronisation to ensure that I had my saved game regardless of the system I played on. In particular an app called DropSync is perfect for this job.

Wednesday, 29 February 2012

Clear the User Dictionary on HTC Android Phones

This has been vexing me for a while. The touch input system on the Android is very powerful and easy to use, however it does seem to automatically remember every spelling mistake I make.

Searching seems to indicate that there is no direct way to remove all, or batches of incorrect words from your user dictionary.

However, there is a useful work-around which users of the HTC sense UI can make use of.

Under the All tab of Manage Applications settings area, is an application called Touch Input.

Clearing the data for this app will remove all input settings, including the User Dictionary.

Then you just need to redo your input settings. Is touch input slightly faster afterwards?

Monday, 6 February 2012

SL4A Scripting Languages for Android

In my hunt for programming capabilities on the Android, and some playing around with BeanShell I found something that worked very well.

I downloaded SL4A which is a scripting host for Android. It takes a bit of setting up, as you then need to install the BeanShell interpreter. However, from there I was able to automate a question I was wondering about.

The idea is simple, using a specific search term, can I get a feel for how much battery life people get from their handsets?

So after a bit of hacking at the script, I was able to simply searche for the handset name, and "battery lasts x days" where x was iterated.

The result:

HTC Wildfire battery days (1): 58
HTC Wildfire battery days (2): 199
HTC Wildfire battery days (3): 83
HTC Wildfire battery days (4): 8
HTC Desire battery days (1): 71
HTC Desire battery days (2): 943
HTC Desire battery days (3): 422
HTC Desire battery days (4): 7
Nexus One battery days (1): 4
Nexus One battery days (2): 240
Nexus One battery days (3): 444
Nexus One battery days (4): 0
Nexus S battery days (1): 37
Nexus S battery days (2): 237
Nexus S battery days (3): 72
Nexus S battery days (4): 3

My HTC Wildfire gets about 2 days, so that query technique feels like it has turned up some useful data.

And for those interested in the BeanShell script.

Sunday, 22 January 2012

Hack-O-Matic 3000 Android

The Android version of the Hack-O-Matic 3000 supports all Android handsets from Android 1.6 upwards.

Download: Hack-O-Matic for Android

Like the other versions, you can easily enter in all the available words on The screen and update each word you try with the matches count. The App will eliminate all words which are not possible making your search easier.

It is not currently available on The Android Marketplace and you will need to install by enabling installation of Apps from outside the App store, and then download and run the file to install it.