This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://developer.android.com/resources/tu | |
torials/notepad/index.html - Simple | |
notepad | |
http://www.vogella.de/articles/Android/ar | |
ticle.html - getting started, first |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////// TestActivity ////////////////////////////////////// | |
package com.begin; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.EditText; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// save the info system button image to where you can access it, this should be able to | |
// go anywhere it gets run by an iPhone program, easiest if you do it with the simulator | |
UIButton *info = [UIButton buttonWithType:UIButtonTypeInfoLight]; | |
NSData *img = UIImagePNGRepresentation([info imageForState:UIControlStateNormal]); | |
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"info.png"]; | |
[img writeToFile:path atomically:NO]; | |
NSLog(@"%@", path); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSString *) base64EncodingWithLineLength:(unsigned int) lineLength data:(NSData *)imgData { | |
static const char *encodingTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | |
const unsigned char *bytes = [imgData bytes]; | |
NSMutableString *result = [NSMutableString stringWithCapacity:[imgData length]]; | |
unsigned long ixtext = 0; | |
unsigned long lentext = [imgData length]; | |
long ctremaining = 0; | |
unsigned char inbuf[3], outbuf[4]; | |
short i = 0; |