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
04070f2971bd4f7d211a60dd547453c8dd258a9bb8fb838d0ffd4fd1eaa0a2582e315d6b654fb9028c7f01b0123913a2531b959d64405217d1cba6175ee252d191;nortss |
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
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
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
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(); |
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
//Querying email addresses is similar to phone numbers. A query must be performed to get email addresses //from the database. Query the URI stored in ContactsContract.CommonDataKinds.Email.CONTENT_URI to query the //email address table. | |
Cursor emailCur = cr.query( | |
ContactsContract.CommonDataKinds.Email.CONTENT_URI, | |
null,ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = ?", | |
new String[]{id}, null); | |
while (emailCur.moveToNext()) { | |
// This would allow you get several email addresses | |
// if the email addresses were stored in an array |
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
//retrieving phone numbers | |
//Phone numbers are stored in their own table and need to be queried separately. To query the phone //number table use the URI stored in the SDK variable ContactsContract.CommonDataKinds.Phone.CONTENT_URI. //Use a WHERE conditional to get the phone numbers for the specified contact. | |
if (Integer.parseInt(cur.getString( | |
cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) { | |
Cursor pCur = cr.query( | |
ContactsContract.CommonDataKinds.Phone.CONTENT_URI, | |
null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?", | |
new String[]{id}, null); |
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
//Basic contact information stored in Contacts table with detailed information stored in individual //tables for normalization. In Android 2.0 to query the base contact records the URI to query is stored //in ContactsContract.Contacts.CONTENT_URI. | |
ContentResolver cr = getContentResolver(); | |
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, | |
null, null, null, null); | |
if (cur.getCount() > 0) { | |
while (cur.moveToNext()) { | |
String id = cur.getString( |
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
private double gps2m(float lat_a, float lng_a, float lat_b, float lng_b) { | |
float pk = (float) (180/3.14169); | |
float a1 = lat_a / pk; | |
float a2 = lng_a / pk; | |
float b1 = lat_b / pk; | |
float b2 = lng_b / pk; | |
float t1 = FloatMath.cos(a1)*FloatMath.cos(a2)*FloatMath.cos(b1)*FloatMath.cos(b2); | |
float t2 = FloatMath.cos(a1)*FloatMath.sin(a2)*FloatMath.cos(b1)*FloatMath.sin(b2); |
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
private String getMyNumber(){ | |
TelephonyManager mTelephonyMgr; | |
mTelephonyMgr = (TelephonyManager) | |
getSystemService(Context.TELEPHONY_SERVICE); | |
return mTelephonyMgr.getLine1Number(); | |
} |
NewerOlder