Android – Text to speech simple example

  In this article I will show the most simple way to add text to speech abilities to your Android application. Actually that’s the whole code. You just need to create a TextToSpeech object. Notice the constructor takes 2 parameters, the first is the Context Activity extends from. The second is an OnInitListener which you will need to implement. Ofcourese there are a lot more options but this is the gist of it. You can read more in the Android developer website. Download code example

Android – Using SQLite DataBase

Android OS comes with SQLite Database already built-in. This article will explain how to store and draw data. Currently I am working with Android version 2.2. 1. Extend SQLiteOpenHelper SQLiteOpenHelper is the main class responsible for SQLite operations. You will need to extend it. After extending SQLiteOpenHelper, you will need to trigger the super constructor with the proper parameters – the context (which Activity inherit from it) , the DB file name, CursorFactory (which we wont discuss in this article, leave it as null for now) and the DB version. 2. Create a table One of the functions you have inherited from SQLiteOpenHelper is public void onCreate(SQLiteDatabase db), which is triggered when the DB was created. You can use this function to create the table. 3. Create SQL queries From this point it is fairly easy to create SQL queries. Your object is now holding reference to 2 objects one for writing/deleting and one for reading. You will use them to make operations. Further reading – Android developer website Download demo project

GreaseMonkey usefull APIs

Many of the GreaseMonkey users are not familiar with the very useful set of APIs it has to offer. These functions can help you, especially if you are using it for large projects. I will show here a few of the more useful APIs to my taste, you can read the entire API reference in the product wiki. Logging A very useful function is GM_log(). It is used to print log messages into the JavaScript console. Example: Storing data locally Use the functions GM_setValue(), GM_getValue(), GM deleteValue() and GM_listValues() to store and retract data on the client side. This data is located in the Firefox preferences mechanism. Example: Adding menu commands Another cool option is being able to add commands to be triggered from Firefox menu. To do that use the function GM_registerMenuCommand(). This adds a new item under “Tools->Greasemonkey->User Script Commands” Example: Ajax calls Use GM_xmlhttpRequest to make ajax calls very easily. Example: Further reading The full API reference

Batch Image Resizer

I wrote this application so I could resize a batch of photos all at once. The use is very simple. You insert the input image folder and the out put folder. You enter the resizing percentage you wish and press the button. I have implemented this using my own EasyImage for the picture resizing. I have used Apache Pivot for the GUI. And that is it, very easy. View on Github  Download BatchImageResizer  Download Source code from Github