Categories
Uncategorized

Action: Sponsors Sought for U.S. Citizens to be Evacuated from Gaza

(WASHINGTON, D.C., 1/12/2009) – CAIR today issued a call for American sponsors willing to assist families of U.S. citizens who may be evacuated this week from the Gaza Strip.

SEE: U.S. Preparing Evacuation of 150 Americans

State Department officials tell CAIR that some of the almost 150 potential evacuees do not have family members in the United States.A number of those seeking evacuation are non-citizen parents of young American-born children. CAIR is calling on individuals and relief groups to offer support. Potential sponsors would have to provide all the needs of evacuees for a period of six months, demonstrate financial ability and submit an I-134 “Affidavit of Support” form.

CAIR has been seeking State Department assistance in evacuating two American children, ages six and three, along with all the other Americans in Gaza. The father of the two children said bullets fired from an Israeli tank hit the family home in Beit Hanoun on Saturday. He said his brother’s nearby two-story home was destroyed today by the Israelis.

The death toll from Israeli attacks on Gaza has topped 900, with many women and children among the dead and more than 4000 injured. In its attacks, Israel has denied access to wounded civilians and has targeted homes, schools, mosques, universities, medical and United Nations personnel, a hospital, and a church. A leading human rights group has accused Israel of using white-phosphorus munitions in its attacks on civilian areas.

SEE: 1 Dead, Dozens Injured in Gaza by Suspected White Phosphorus Munitions
SEE ALSO: Gaza War Comparable to Sabra and Shatila Massacre: Medics (AFP)
Israeli Missile Reduces Church-Backed Hospital to Rubble

The United Nations’ top human rights official said Friday that the Israeli military may have committed war crimes in Gaza.

SEE: UN Human Rights Chief Accuses Israel of War Crimes
SEE ALSO: Gaza “No Place for Civilians”: ICRC (Reuters)
UN Human Rights Council Condemns Israeli Military Action

ACTION REQUESTED:

Potential sponsors must be willing to provide all of the needs of the evacuees for a period of six months. Sponsors would also have to demonstrate the financial ability to sponsor and submit an I-134 “Affidavit of Support” form.

Those who are willing to meet these strict requirements should send an e-mail to:[email protected]

Categories
Uncategorized

Israeli Bullets Hit Home of American Children Trapped in Gaza

(WASHINGTON, D.C., 1/12/2009) – The Council on American-Islamic Relations (CAIR) reported today that Israeli bullets hit the house of two American children trapped under bombardment by Israel in the Gaza Strip.

CAIR has been seeking State Department assistance in evacuating the two children, ages six and three, along with all the other Americans in Gaza. Friends of the family contacted CAIR seeking help. (Photos of the family are available from CAIR.)

Reached by phone in Gaza, the father of the American children said bullets fired from an Israeli tank hit the family home in Beit Hanoun on Saturday. He said a nearby two-story home owned by his brother was destroyed today by the Israelis. The father, who graduated from George Washington University in Washington, D.C., said he has recently been contacted by American officials about a possible evacuation.

In a response to a letter CAIR sent January 7 to Secretary of State Condoleezza Rice, the State Department said that an evacuation is being planned this week for almost 150 American citizens and their family members trapped in Gaza. Officials say 16 American citizens were evacuated on January 2. American sponsors are also being sought for those evacuees who may be brought to the United States. A number of potential evacuees are non-citizen parents of young American-born children.

“We call for the immediate intervention of the Bush administration to demand that Israel stop its attacks on civilian areas so that all the American citizens facing death in Gaza can be safely evacuated,” said CAIR National Communications Director Ibrahim Hooper. “Each day the evacuation is delayed means another day in which U.S. citizens might be injured or killed by American taxpayer-funded weapons in a brutal campaign supported by our own government.”

He said citizens of many other nations, including Canada, Russia, the Philippines, Ukraine, Denmark, Austria, Norway, Romania, and Sweden have already been evacuated from Gaza.

Hooper noted that the death toll from Israeli attacks on Gaza has topped 900, including many women and children. In its attacks, Israel has denied access to wounded civilians and has targeted homes, schools, mosques, universities, medical and United Nations personnel, and a church. A leading human rights group yesterday accused Israel of using white-phosphorus munitions in its attacks on civilian areas.

SEE: Israel Accused of Using White Phosphorus in Gaza (Reuters)

The United Nations’ top human rights official said Friday that the Israeli military may have committed war crimes in Gaza.

SEE: UN Human Rights Chief Accuses Israel of War Crimes

CAIR, America’s largest Islamic civil liberties group, has 35 offices and chapters nationwide and in Canada. Its mission is to enhance the understanding of Islam, encourage dialogue, protect civil liberties, empower American Muslims, and build coalitions that promote justice and mutual understanding.

Categories
Android

Android and Alarms

Since I joined the Android user groups, there have been a lot of questions about 2 things – databases and alarms. I have already written a post about how to use a database in Android and in this one, I will talk about how to use Alarms. If there are any other topics you would like to see a tutorial on, please feel free to let me know. You can leave your requests in the comments section. Oh, and this post (like previous posts) is for Android 1.0.

Alarms in Android are not used in a conventional way. When your application sets an alarm, it’s just telling that alarm service to wake it up at a certain time. The user won’t hear any sounds and the phone won’t vibrate (unless your application plays a sound or makes the phone vibrate after it wakes up). Alarms will work if the device goes to sleep but they are cleared if the device is turned off or restarted. So, you will need to set the alarm again if you want it to “go off” even after a device re-boot.

Our receiver class will be called “AReceiver” (without the quotes, of course). In the manifest file, we will add this line (which is in bold below):

<application android:icon=”@drawable/icon5″ android:label=”@string/app_name”>
<activity android:name=”.SomeApp” android:label=”@string/app_name”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />
<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
</activity>
<receiver android:name=”AReceiver” android:process=”:remote” />

Now, that the alarm receiver is set, lets take a look at the class that will set and cancel the alarms:

package SomeApp.SomeApp;

import java.util.Calendar;

import java.lang.String;

import android.app.AlarmManager;
import android.app.ListActivity;
import android.app.PendingIntent;
import android.os.Bundle;
import android.util.Log;

import android.content.Intent;
import android.widget.Toast;

/**
 * When this code is run only one alert will be displayed even though 2 alerts were
 * were setup (as one of them will be cancelled later on
 */
public class SomeApp extends ListActivity {
	/* for logging - see my tutorial on debuggin Android apps for more detail */
	private static final String TAG = "SomeApp "; 

	protected Toast mToast; 

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.alert_list);
        try {

		Calendar cal = Calendar.getInstance();

		Intent intent        = new Intent(SomeApp.this, AReceiver.class);
		PendingIntent sender = PendingIntent.getBroadcast(this, 1234567, intent, 0);
		PendingIntent sende2 = PendingIntent.getBroadcast(this, 123123, intent, 0);

		AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
		am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis()+30000, sender); // to be alerted 30 seconds from now
		am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis()+15000, sende2); // to be alerted 15 seconds from now

		/* To show how alarms are cancelled we will create a new 		Intent and a new PendingIntent with the
	 	* same requestCode as the PendingIntent alarm we want to cancel. In this case, it is 1234567.
         	* Note: The intent and PendingIntent have to be the same as the ones used to create the alarms.
         	*/
		Intent intent1        = new Intent(SomeApp.this, AReceiver.class);
		PendingIntent sender1 = PendingIntent.getBroadcast(this, 1234567, intent1, 0);
		AlarmManager am1 = (AlarmManager) getSystemService(ALARM_SERVICE);
		am1.cancel(sender1);

        } catch (Exception e) {
        	Log.e(TAG, "ERROR IN CODE:"+e.toString());
        }
    }

}

You will notice that this is only a “one-shot” alarm. If you want to set a repeating alarm, it is explained in Android’s documentation. However, I will write on that too if there is demand for it. Now, let’s examine the code. For setting an alarm, you will need 4 things:

  • The class that’s setting the alarm
  • The class that will be called when the alarm “goes off”
  • The time at which the alarm should go off
  • A requestCode (which will use as a unique ID to identify the alarms) used in PendingIntent.

For cancelling an alarm, you need 3 things:

  • The class that set the alarm
  • The class that was to be called when the alarm “goes off”
  • The requestCode you used for PendingIntent object.

We have covered 2 things – the declaration of the receiver in our manifest file and the class that sets and cancels alarms. Now, we need to look at the class that will be called when the alarm goes off.

package someApp.someApp;

import java.util.Calendar;

import android.content.Context;
import android.content.BroadcastReceiver;
import android.util.Log;
import android.widget.Toast;

/** All receiver classes must extend BroadcastReceiver */
public class AReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context con, Intent in) {
		try {
			/* Display an alert */
			Toast.makeText(con, "hello my jello ", Toast.LENGTH_LONG).show();
		} catch (Exception r) {
			Toast.makeText(con, "You were supposed to do something"
					+" now but I can't retrieve what it was.",
					Toast.LENGTH_SHORT).show();
			Log.e("ALARM_RECEIVER", r.toString());
		}
	}
}
Categories
Android Uncategorized

G2 on the way?

According to some rumors on IT news websites, some new Android phones will be released in 2009. cellphonesignal.com claims that a phone, G2, is in the making and will be released in January of 2009. Another website claims that it will be released in April. Best of all, G2 will not be locked down to T-Mobile. It will be great to have a phone not locked down to T-mobile but this begs the question : WIll this phone be able to access T-mobile’s 3G services? And if yes, will it also be able to access 3G service of providers from the rest of the world who don’t use 1700 Mhz for 3G? I guess we will soon find out. 

An Australian company had announced the release of an Android based phone called Kogan Agora. It looks something like Samsung Blackjack and has no touch screen (as far as I can tell). A chinese firm, Lenovo, has also announced an Android based phone which will have touch screen but no physical keyboard. It looks something like HTC Touch HD from the front. The phone is called QIGI.

Looks like 2009 has some great things in store for all the phone lovers out there. Happy New Year everyone !

Categories
Uncategorized

Debugging services in C#

Recently, I have had to build a service for Windows and (not unlike everyone else who has tried to do this) I came across a hurdle of not being able to debug my service from the Visual Studio. I had to install the service manually, start it and debug it. Every time after the installation, I have to stop the service before I compile the code, then restart it again after the file has been copied. This can get very annoying if you have to do this multiple times a day. It’s a debugging nightmare for a developer.  However, you needn’t fear anymore as I have a solution to all of this chaos. You can edit Program.cs of  your project and insert this code in there :

 

    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            #if (!DEBUG)
            System.ServiceProcess.ServiceBase[] ServicesToRun;
            ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() };
            System.ServiceProcess.ServiceBase.Run(ServicesToRun);
            #else
            Service1 service = new Service1();
            service.Start();
            System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
            #endif 
        }
    }

 

What the code above will do is, if you are debugging your service, it will start your service as a thread and run it till you stop it. If you are compiling the code for a release, then it will run the whole thing as a regular Windows Service.

Categories
Android Uncategorized

Tmobile G1, AT&T and 3G

Google has released unlocked versions of Tmobile G1 for developers. It costs about $500 and you have to register with Google as a merchant for Android apps ($25 registration fee). Most developers who were (and still are) enthusiastic about G1 and Android failed to realize that G1’s (and Tmobile’s ) 3G network functions on the 1700 band and all other prodivers in USA (including AT&T) operate their 3G at another band (I think it’s 1900 or 2100). So, if you get G1 and your service provider is not Tmobile, then you wont be able to use the 3G service of your provider (unless their 3G service operates on the 1700 band).

Maybe Google should put a huge disclaimer on their site stating this so developers (and other people) can make an informed decision about getting an unlocked G1.  Having said that, I am not trying to blame Google or TMobile. They haven’t tried to hide the fact that their 3G service works on a different band, and it *is* the consumer’s responsibility to make sure they know what they are getting.

The same problem is with AT&T’s iPhone. You can jailbreak it but you lose some of its functionality (like visual voicemail) because AT&T had to make custom applications to support iPhone’s interaction with it’s network. I hope this doesn’t become a trend where a phone is locked to a provider. It would be a huge step backwards.

Categories
Android Uncategorized

Displaying dialogs in Android 1.0

When I say dialogs, I mean the little alert window that pops up and lets you know about an error that occurred or warns you about something you can’t do. It locks up the whole screen and demands you pay attention to it. I use a dialog to display information about the application.

Android has a few type of alert dialogs. One is a dialog that will not go away unless you make it go away. The other is a dialog that goes away after soem time. We will take a look at both of them here. 

First, let’s look at dialogs that don’t go away unless you tell them to. Here is the code for them :

 

 

public class SomeActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstance)  {
        AlertDialog.Builder dlgAlert  = new AlertDialog.Builder(this);
        dlgAlert.setMessage(“This is an alert with no consequence”);
        dlgAlert.setTitle(“App Title”);
        dlgAlert.setPositiveButton(“OK”, null);
        dlgAlert.setCancelable(true);
        dlgAlert.create().show();
    }

The code above will display an alert with a title, a message and an OK button at the bottom. You don’t really have to set the title, the ok button or the message but it helps to do so. If you don’t use an “OK” (or whatever) button, the dialog will never go. The user will have to close the application in order to get out of it. There are other types of buttons that you can use (and you can use multiple buttons also). You can take a look at AlertDialogBuilder’s API for more information here

The second type of dialog is more of a notification alert that is displayed on the main screen. I have used it before in my previous post which spoke about how to set alarms in Android. This alert will be shown for some time and regardless of whether a user responds to it or not, it will disappear after some time. Below is the code that is used to call it (or display it) :

 

Toast.makeText(con, “This is a message from hell. Yes my friend, HELL”, Toast.LENGTH_SHORT).show();

 

The above code will display an alert for a short amount of time and then close it. This alert is very simple and short and doesn’t require much to be displayed. You can also use Toast.LENGTH_LONG to display the alert for a longer period of time. And, like always below are the screenshots of what both of them look like.

 

The dialog that requires user to click something
The dialog that requires user to click something

 

The disappearing alert
The disappearing alert
Categories
Android Uncategorized

Sending email from Android

Sending an email is a very basic functionality (for some applications anyway). Android makes it very easy to do this. All you have to do is create a new intent, setup the content of the email and send it. 

Intent in = new Intent(Intent.ACTION_SEND); 
in.putExtra(Intent.EXTRA_TEXT, “this is the body of the email”); 
in.putExtra(Intent.EXTRA_SUBJECT, “Subject”); 
in.setType(“message/rfc822”); 
startActivity(Intent.createChooser(in, “Title:”));

Categories
PHP Uncategorized

Design Patterns – Singletons in PHP 5.x

Design Patterns (and anti-patterns) are techniques of programming. There are a lot of design patterns. It is upto the programmer to pick and choose which patterns to use based on their needs. Singleton is also a design pattern. A singleton is a type of class which can have only 1 object of its kind through the lifecycle of an application. It is very suitable for database, caching, etc. I will use a database class as an example as it is probably the most-widely used class in web development.

Why use a singleton you ask? A popular practice among PHP4’s developers is to make a database object global then use that variable anything a query needs to be run. It works in small applications and even in not-so-big applications. In enterprise applications where you use hundreds (if not thousands) of variables, there is a very good chance that you database object will get mutated or overridden. You also don’t want to have multiple instance of a database class (unless you are running a multi-threaded application).

A database class should be able to connect to a database, run queries, return results and close the connection to the database when it’s done. Keeping that in mind, let’s start writing our database class.

/**
 * Database wrapper
 */
class Database {
	private $_host;
	private $_user;
	private $_pass;
	private $_name;
	private $_conn;
	private $_err;

	/**
	 * Setting the constructor as private will make sure
	 * that the class cannot be instantiated using the
	 * "new" keyword. You can to instantiate it like this :
	 * $db = Database::getInstance();
	 * getInstance() is implemented right after the constructor
	 */
	private function __construct($host, $user, $pass, $name)
	{
		$this->_host = $host;
		$this->_user = $user;
		$this->_pass = $pass;
		$this->_name = $name;
	}

	/**
	 * This function is what makes this whole class a singleton.
	 * It will make sure only one instance of this class is available
	 */
	function getInstance($host='', $user='', $pass='', $name='')
	{
		static $obj;
		if (null == $obj) {
			$obj = new Database($host, $user, $pass, $name);
			$obj->connect();
		}
		return obj;
	}
	/**
	 * Connects to the database
	 */
	function connect()
	{
		$this->_err = null;
		if (!mysql_connect($this->_host, $this->_user, $this->_pass)) {
			$this->_err = mysql_error();
			return false;
		}
		if (!mysql_select_db($this->_name)) {
			$this->_err = mysql_error();
			return false;
		}
		return true;
	}

	function error()
	{
		return $this->_err;
	}

	function user($val=null)
	{
		if (null == $val) return $this->_user;
		$this->_user = $val;
	}
	function host($val=null)
	{
		if (null == $val) return $this->_host;
		$this->_host = $val;
	}
	function pass($val=null)
	{
		if (null == $val) return $this->_pass;
		$this->_pass = $val;
	}
	function name($val=null)
	{
		if (null == $val) return $this->_name;
		$this->_name = $val;
	}
}

So, we wrote a class called database and made its constructor private so you can’t instantiate it using the “new” keyword. We also wrote a method/function for this class called getInstance() which will return a database object. getInstance() has a local static variable called $obj. It checks if this variable is null. If it’s null then that means there is no object of the type “Database”. So, it creates an object and assigns it to $obj. It also returns the object to the code that called it. Setting permissions of private, protected and public could not have been done in PHP 4, which frustrated a lot of OOP enthusiasts. PHP 5, however, has the capability of doing it and thus fulfilling one of OOP’s main goals – encapsulation.

The first time  an object of the class Database is instantiated, it will have to pass all the variables required to make a database connection. Its subsequent calls need not do that.

// First call
$db = Database::getInstance('localhost', 'root', '', 'myDB');

function hello()
{
	// Second call
	$database = Database::getInstance();
}

Both $db and $database point to the same object. Any changes made to $database will be reflected in $db also. This eliminates the use of global variables for quite a few things (especially our database class).

Categories
Android Uncategorized

Working with a database in Android

Android uses SQLite for its database needs. SQLite is a very fast and lightweight database. It is file based which makes it highly portable and an ideal candidate for use as an embedded database. For those who prefer to just go through the code and learn, the Notebook application example on Android’s website can be very useful. Let’s begin with the tutorial shall we.

First, you will need to make a class that will interact with the database. After that class has been written, you will instantiate it and use it to perform your data operations. This will keep your code encapsulated and easy to maintain. Android tries to encourage its programmers to use the MVC concept and makes it easy to implement it.

Assume your table structure is this :

create tblData (
_id int primary key autoincrement,
alert_text text,

alert_date varchar(20),
alert_time varhcar(20)
);

Setting up Connections and getting everything ready

Our database interaction class will be called DBLayer. It is a public class, so it will need to be in a file called DBLayer.java. Let’s say we have a table with 3 fields and we want to set and get data from it. This is how you set the class up :

/**
 * Database Wrapper
 *
 * DB Schema:
 * ------------------------------------
 * Create table tblData (
 *     _id int primary key autoincrement,
 *     alert_text text,
 *     alert_date varchar(20),
 *     alert_time varchar(20)
 * );
 */
public class DBLayer {

	/*******************************************************
	* These constants refer to the fields in the database.
	* _id is Android's naming convention for ID fields.
	* Our database has 3 fields, so we have 3 constants.
	********************************************************/

	public static final String KEY_NAME  = "name";
	public static final String KEY_VAL   = "value";
	public static final String KEY_ROWID = "_id";

	/*******************************************************
	* This is not needed for the database. It is
	* here to help us tag our logging messages
	*******************************************************/
	public static final String TAG = "AlertDB";

	private DatabaseHelper dbHelper ;
	private SQLiteDatabase db;

	private Context mCtx = null;

	/*******************************************************
	* Some other constants related to our database's
	* information. They should be self explanatory
	********************************************************/
	private static final String DATABASE_NAME = "gAlert_db";
	private static final String DATABASE_TABLE = "tblData";
	private static final int DATABASE_VERSION = 2;
	private static final String DATABASE_CREATE =
	"create table gAlert_alerts ( "
	+ "_id integer primary key autoincrement, "
	+ "alert_text text not null,"
	+ "alert_date varchar(20) not null,"
	+ "alert_time varchar(20) not null"
	+");";

	/********************************************************
	* Think of this as a driver for your database
	* interaction. You can just copy and paste this part in
	* all your database interaction classes.
	*********************************************************/
	private static class DatabaseHelper extends SQLiteOpenHelper {
		DatabaseHelper(Context ctx) {
			super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
		}
		@Override
		public void onCreate(SQLiteDatabase db) {
			db.execSQL(DATABASE_CREATE);
		}
		@Override
		public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
			db.execSQL("DROP IF TABLE EXISTS "+DATABASE_TABLE);
			onCreate(db);
		}
	}

	/** Constructor */
	public DBLayer(Context ctx) {
		mCtx = ctx;
	}
	/********************************************************
	* This opens a connection to the database but if
	* something goes wrong, it will throw an exception.
	********************************************************/
	public DBLayer open () throws SQLException {
		dbHelper = new DatabaseHelper(mCtx);
		db = dbHelper.getWritableDatabase();
		return this;
	}
	/** Closes a database connection */
	public void close() {
		dbHelper.close();
	}
}

I have read articles which state a different way using databases in Android. From what I can tell these tutorials were for versions prior to 1.0. In version 1.0, you create a class which extends SQLiteOpenHelper and you encase that class in another class which you will call to insert and retrieve data. The comments in the code above should be self-explanatory. If you have any questions I haven’t answered, please leave a comment and I will post a reply.

You don’t need to have a database already set up. If the database you try to open doesn’t exist, then Android will create it. It will run the onCreate() method when it creates the database. And, if the database version changes on the phone. It will run the onUpgrade() method.

Running your Queries

Now the class DBLayer can connect to the database. However, just connecting is of no use unless you can retrieve some data from your database. There are 4 methods you can use in Android and they all perform different functions. They are : query, insert, delete and update. query() is used to retrieve data. The others should be self-explanatory.

Here’s a method that will retrieve multiple rows from the database:

	public Cursor fetchAllAlerts() {
		try {
			return db.query(DATABASE_TABLE,
				new String[] {KEY_ALERT_TEXT, KEY_ALERT_DATE,
				KEY_ALERT_TIME, KEY_ROWID}, null, null,
				null, null, null);
		} catch (Exception e) {
			Log.e("yo", e.getMessage());
			return null;
		}
	}

You will rarely (if ever) find yourself writing any SQL for Android applications. The reason being Android’s framework does all the dirty work behind the scenes. All you have to do is set  your object up and provide the data retrieval, insertion methods with the neccesary information.

Here are some more methods. Everything should be self explanatory.

	public long createAlert(String text, String date, String time) {
	ContentValues vals = new ContentValues();
	vals.put(KEY_ALERT_TEXT, text);
	vals.put(KEY_ALERT_DATE, date);
	vals.put(KEY_ALERT_TIME, time);
	return db.insert(DATABASE_TABLE, null, vals);
}

public boolean deleteAlert(long rowId) {
	return db.delete(DATABASE_TABLE, KEY_ROWID+"="+rowId, null) > 0;
}

public Cursor fetchAllAlerts() {
	try {
		return db.query(DATABASE_TABLE, new String[] {
				KEY_ALERT_TEXT, KEY_ALERT_DATE,
				KEY_ALERT_TIME, KEY_ROWID}, 
					null, null, null, null, null);
	} catch (Exception e) {
		Log.e("yo", e.getMessage());
		return null;
	}
}

public Cursor fetchAlert(long rowId) throws SQLException {
	Cursor ret = db.query(DATABASE_TABLE, new String[] {
				KEY_ALERT_TEXT, KEY_ALERT_DATE,
				KEY_ALERT_TIME, KEY_ROWID},
				KEY_ROWID+"="+rowId, null, null,
				null, null);
	if (ret != null) {
		ret.moveToFirst();
	}
	return ret;
}

public boolean updateAlert(long rowId, String text, String date, String time) {
	ContentValues vals = new ContentValues();
	vals.put(KEY_ALERT_TEXT, text);
	vals.put(KEY_ALERT_DATE, date);
	vals.put(KEY_ALERT_TIME, time);
	return db.update(DATABASE_TABLE, vals,KEY_ROWID+"="+rowId, null) > 0;
}

You can get the code for the whole class here. In this article, there wasn’t much explanation because I didn’t think I needed to explain anymore after pasting the code. I am sure there are people reading this who feel otherwise. Please let me know what needs more explanation and I will elaborate on that topic.