How to read a single Contact from sql of android : I am here with a problem in SQL of android to read a single contact. I have tried every thing to solve the issue butt failed to do so. When I called the method form main my app crashed. Here is my code, I need quick solution kindly help me out fast.

    public contactsdetail readContact(int id)
	{
		SQLiteDatabase db = this.getReadableDatabase();
		contactsdetail contact = new contactsdetail();
		// get contact query
		Cursor cursor = db.query(table_Contact,new String[] { name_ID,  contact_NAME, contact_NUMBER }, name_ID + "=?", new String[]{ String.valueOf(id) }, null, null, null, null);
		// if results !=null, parse the first one
		if(cursor != null)
			cursor.moveToFirst();
				contactsdetail contact = new contactsdetail(Integer.parseInt(cursor.getString(0)),cursor.getString(1), cursor.getString(2));
		
		
		return contact;
	}

  