Skip to content

Instantly share code, notes, and snippets.

String noteWhere = ContactsContract.Data.CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ?";
String[] noteWhereParams = new String[]{id,
ContactsContract.CommonDataKinds.Note.CONTENT_ITEM_TYPE};
Cursor noteCur = cr.query(ContactsContract.Data.CONTENT_URI, null, noteWhere, noteWhereParams, null);
if (noteCur.moveToFirst()) {
String note = noteCur.getString(noteCur.getColumnIndex(ContactsContract.CommonDataKinds.Note.NOTE));
}
noteCur.close();
String addrWhere = ContactsContract.Data.CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ?";
String[] addrWhereParams = new String[]{id,
ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE};
Cursor addrCur = cr.query(ContactsContract.Data.CONTENT_URI,
null, where, whereParameters, null);
while(addrCur.moveToNext()) {
String poBox = addrCur.getString(
addrCur.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.POBOX));
String street = addrCur.getString(
addrCur.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.STREET));
Uri smsUri = Uri.parse("tel:1234567");
Intent intent = new Intent(Intent.ACTION_VIEW, smsUri);
intent.putExtra("sms_body", "Hello frend, How are you?");
intent.setType("vnd.android-dir/mms-sms");
startActivity(intent);
http://developer.android.com/resources/tu
torials/notepad/index.html - Simple
notepad
http://www.vogella.de/articles/Android/ar
ticle.html - getting started, first
///////////////////////// TestActivity //////////////////////////////////////
package com.begin;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
public abstract class AbstractSQLiteSupport {
protected SQLiteDatabase db;
public AbstractSQLiteSupport(SQLiteDatabase db) {
this.db = db;
@codesburner
codesburner / Cross platform mobile development
Created April 4, 2011 10:55
list of tools offering cross platform mobile development & alternative to xcode
http://rhomobile.com/
http://www.motherapp.com/
http://code.google.com/p/iui/
http://snippetspace.com/
http://www.taplynx.com/
http://www.big5apps.com/
http://www.anscamobile.com/
http://www.nimblekit.com/index.php
http://www.sencha.com/
http://www.mosync.com/
Here be some notes on the insane set of gymnastics I have to go through every time
I fuck up and start recording video with my iPhone held vertically.
I do this a LOT. I don't know why it happens. Often I am standing over something and
recording it, and the phone doesn't understand that I actually mean to hold it
horizontally.
META QUESTIONS:
Why isn't there a way to prevent the phone from shooting video in vertical format? Who
UITouch *touch = [touches anyObject];
CGPoint currentPosition = [touch locationInView:[self view]];
CGFloat deltaX = fabsf(gestureStartPoint.x - currentPosition.x);
CGFloat deltaY = fabsf(gestureStartPoint.y - currentPosition.y);
if (deltaX >= kMinimumGestureLength && deltaY <= kMaximumVariance) {
[label setText:@"Horizontal swipe detected"];
[self performSelector:@selector(eraseText) withObject:nil afterDelay:2];
} else if (deltaY >= kMinimumGestureLength && deltaX <= kMaximumVariance) {
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
NSMutableArray* sect = (NSMutableArray*)[tableContents objectAtIndex:indexPath.section];
[sect removeObjectAtIndex:indexPath.row];
if ([sect count] == 0)
[tableContents removeObjectAtIndex:indexPath.section];
[tableView beginUpdates]