Updating a view from a separate thread

Recently I got the following exception in an android application, when I tried to update a view from a separate thread started in an activity.

03-15 21:39:35.799: E/AndroidRuntime(15580): 
Only the original thread that created a view hierarchy can touch its views.

The reason for this exception is that the view can not be updated from a thread other than the main thread that will be implicitly started and controlled by the system when the application is launched. This main thread is responsible for updating the UI. Actually this is a main element in the android framework (but also very common in other frameworks), as it enforces that updates to the UI will be done in a sequential manner within a single thread controlled by the system.

Updating a view from a separate thread weiterlesen

How to setup a wifi USB device on the raspberry pi


To connect my raspberry pi to a wifi network I am using a wifi USB device with a RTL8188CUS chipset. This is how I managed to connect that device to my raspberry pi which is equipped with a preloaded raspbmc image.

Normally the configuration of the wifi USB device should be very easy using the XBMC settings menu, but actually I didn’t want to make usage of the XBMC application at all. I just wanted to connect via ssh to the raspberry device without making usage of the graphical environment.

How to setup a wifi USB device on the raspberry pi weiterlesen

Sudoku generator OpenSudokuLib

What is OpenSudokuLib?

Sudoku is a logic puzzle in a 9×9 square, where all columns, all rows and all 3×3 inner squares of the sudoku have to be filled with the numbers from 1 to 9. In each of these columns, rows and inner squares the numbers from 1 to 9 have to appear exactly once. OpenSudokuLib is a small and simple sudoku generator written in Java to create 9×9 sudoku squares using a backtracking method to find valid cases.

You can use this sudoku generator for free and modify it under the terms of the GNU General Public License.

Note! This project has been renamed recently from JMLSudoku to OpenSudokuLib.

Sudoku generator OpenSudokuLib weiterlesen

Programming microcontroller using a bootloader

This post is about programming microcontroller using a bootloader firmware.

During the programming process of a microcontroller the application firmware has to be transferred, sooner or later, to the memory of the chip. This is normally done with a programmer device that burns the machine code to the program memory.

An optional way to program the application firmware onto the device is using a bootloader. The bootloader is a short program used to burn the firmware to the microcontroller without any programmer device, as it writes any data onto the flash memory of the device, provided to the serial interface. The process of burning the provided data to the program memory is controlled by the bootloader itself.

Programming microcontroller using a bootloader weiterlesen

How to migrate the android menu button to the action bar

Today I would like to describe how to migrate the android menu button, on devices with release older than 3.0, to the action bar using the Android Support Libraries. The menu button is well known on devices which were shipped with Android release 2.3.x and older and has been deprecated in newer releases. Actually devices which were shipped with newer releases than 2.3.x usually don’t have a hardware button which is related to the options menu. Although it is possible to emulate the hardware button using backward compatibility, it is recommended to migrate to the action bar instead.

How to migrate the android menu button to the action bar weiterlesen

Android permission READ_EXTERNAL_STORAGE

Recently I noticed some bug reports about a failing permission for my Android applications regarding read activities on external USB storage. Every try of the application to read items from the USB storage failed with the following error message.

Unable to resume activity {de.jml_port.ospfree/de.jml_port.ospfree.OSPActivity}: 
java.lang.SecurityException: External path: /mnt/sdcard/background.png: 
Neither user 14091 nor current process has android.permission.READ_EXTERNAL_STORAGE

Android permission READ_EXTERNAL_STORAGE weiterlesen

How to handle backward compatibility for android menu button

With the intention to get rid of hardware buttons on Android devices, the android menu button has been replaced in honeycomb release 3.0 (API level 11) and later, in favor of virtual touch fields on the screen. However the menu button won’t even be available as a virtual touch field in newer releases as of honeycomb. All those actions of your application, which were implemented in the menu, should be migrated instead to the action bar which is an Android UI item available since API level 11, though as a workaround you can rely on the backward compatibility to emulate the menu button for newer Android releases.

How to handle backward compatibility for android menu button weiterlesen

Open slide puzzle

What is open slide puzzle?

Open slide puzzle is a patience game where you have to rearrange the 15 tiles of a picture into the right order by sliding the single tiles to the right position. Therefore you will be able to move only one tile at once into the gap to get the puzzle solved. Although the idea of a slide puzzle is very simple, it can be challenging trying to put the right tiles together.

Open slide puzzle weiterlesen

Backtracking method

The core of the OpenSudokuLib engine to generate sudoku configurations is the method backTrackingRows, a backtracking method which enables the class to find a valid sudoku case.

Backtracking is a recursive algorithm which tries to find a solution by trying a certain partial path and extending it step by step until a final solution is being found. If the partial path does not fulfill the criteria of a valid solution, we have to step back and try a different path from the point where it still was satisfying the criteria.

Backtracking method weiterlesen

Sharing experiences and ideas about hardware and software topics