¡@

Home 

2014/10/16 ¤W¤È 08:11:56

android Programming Glossary: cursor

Sending and Receiving SMS and MMS in Android (pre Kit Kat Android 4.4)

http://stackoverflow.com/questions/14452808/sending-and-receiving-sms-and-mms-in-android-pre-kit-kat-android-4-4

in the getMMSApns method of the APNHelper class. final Cursor apnCursor this.context.getContentResolver .query Uri.withAppendedPath.. getMMSApns method of the APNHelper class. final Cursor apnCursor this.context.getContentResolver .query Uri.withAppendedPath..

How to read contacts on Android 2.0

http://stackoverflow.com/questions/1721279/how-to-read-contacts-on-android-2-0

then you can loop through your phone contacts like this Cursor cursor getContentResolver .query ContactsContract.Contacts.CONTENT_URI.. You know it has a number so now query it like this Cursor phones getContentResolver .query ContactsContract.CommonDataKinds.Phone.CONTENT_URI.. phones.close Cursor emails getContentResolver .query ContactsContract.CommonDataKinds.Email.CONTENT_URI..

How to get the Android device's primary e-mail address

http://stackoverflow.com/questions/2112965/how-to-get-the-android-devices-primary-e-mail-address

price of admission. Below is a full example that uses a CursorLoader to retrieve profile data rows containing email addresses... extends Activity implements LoaderManager.LoaderCallbacks Cursor public void onCreate Bundle savedInstanceState super.onCreate.. .initLoader 0 null this @Override public Loader Cursor onCreateLoader int id Bundle arguments return new CursorLoader..

Get/pick an image from Android's built-in Gallery app programmatically

http://stackoverflow.com/questions/2169649/get-pick-an-image-from-androids-built-in-gallery-app-programmatically

gallery String projection MediaStore.Images.Media.DATA Cursor cursor managedQuery uri projection null null null if cursor..

How to pick an image from gallery (SD Card) for my app in Android?

http://stackoverflow.com/questions/2507898/how-to-pick-an-image-from-gallery-sd-card-for-my-app-in-android

String filePathColumn MediaStore.Images.Media.DATA Cursor cursor getContentResolver .query selectedImage filePathColumn..

How to send image via MMS in Android?

http://stackoverflow.com/questions/2972845/how-to-send-image-via-mms-in-android

this.context context public List APN getMMSApns final Cursor apnCursor this.context.getContentResolver .query Uri.withAppendedPath.. context public List APN getMMSApns final Cursor apnCursor this.context.getContentResolver .query Uri.withAppendedPath.. current null null null null if apnCursor null return Collections.EMPTY_LIST else final List APN results..

How to call Android contacts list?

http://stackoverflow.com/questions/866769/how-to-call-android-contacts-list

import android.content.Intent import android.database.Cursor import android.os.Bundle import android.provider.Contacts.People.. import android.widget.ListView import android.widget.SimpleCursorAdapter import android.widget.TextView public class Contacts.. public void onCreate Bundle icicle super.onCreate icicle Cursor C getContentResolver .query People.CONTENT_URI null null null..

How to use an existing database with an Android application [duplicate]

http://stackoverflow.com/questions/9109438/how-to-use-an-existing-database-with-an-android-application

import android.content.Context import android.database.Cursor import android.database.SQLException import android.database.sqlite.SQLiteDatabase.. return this public void close mDbHelper.close public Cursor getTestData try String sql SELECT FROM myTable Cursor mCur.. Cursor getTestData try String sql SELECT FROM myTable Cursor mCur mDb.rawQuery sql null if mCur null mCur.moveToNext ..

Stop EditText from gaining focus at Activity startup

http://stackoverflow.com/questions/1555109/stop-edittext-from-gaining-focus-at-activity-startup

starts the EditText immediately has input focus flashing cursor . I don't want any control to have input focus at startup. I..

How to read contacts on Android 2.0

http://stackoverflow.com/questions/1721279/how-to-read-contacts-on-android-2-0

you can loop through your phone contacts like this Cursor cursor getContentResolver .query ContactsContract.Contacts.CONTENT_URI.. null null null null while cursor.moveToNext String contactId cursor.getString cursor.getColumnIndex.. null null null while cursor.moveToNext String contactId cursor.getString cursor.getColumnIndex ContactsContract.Contacts._ID..

How to get the Android device's primary e-mail address

http://stackoverflow.com/questions/2112965/how-to-get-the-android-devices-primary-e-mail-address

DESC @Override public void onLoadFinished Loader Cursor cursorLoader Cursor cursor List String emails new ArrayList String.. void onLoadFinished Loader Cursor cursorLoader Cursor cursor List String emails new ArrayList String cursor.moveToFirst while.. Cursor cursor List String emails new ArrayList String cursor.moveToFirst while cursor.isAfterLast emails.add cursor.getString..

Get/pick an image from Android's built-in Gallery app programmatically

http://stackoverflow.com/questions/2169649/get-pick-an-image-from-androids-built-in-gallery-app-programmatically

String projection MediaStore.Images.Media.DATA Cursor cursor managedQuery uri projection null null null if cursor null int.. cursor managedQuery uri projection null null null if cursor null int column_index cursor .getColumnIndexOrThrow MediaStore.Images.Media.DATA.. projection null null null if cursor null int column_index cursor .getColumnIndexOrThrow MediaStore.Images.Media.DATA cursor.moveToFirst..

How to pick an image from gallery (SD Card) for my app in Android?

http://stackoverflow.com/questions/2507898/how-to-pick-an-image-from-gallery-sd-card-for-my-app-in-android

String filePathColumn MediaStore.Images.Media.DATA Cursor cursor getContentResolver .query selectedImage filePathColumn null.. .query selectedImage filePathColumn null null null cursor.moveToFirst int columnIndex cursor.getColumnIndex filePathColumn.. null null null cursor.moveToFirst int columnIndex cursor.getColumnIndex filePathColumn 0 String filePath cursor.getString..

Get filename and path from uri from mediastore

http://stackoverflow.com/questions/3401579/get-filename-and-path-from-uri-from-mediastore

getRealPathFromURI Context context Uri contentUri Cursor cursor null try String proj MediaStore.Images.Media.DATA cursor context.getContentResolver.. cursor null try String proj MediaStore.Images.Media.DATA cursor context.getContentResolver .query contentUri proj null null.. .query contentUri proj null null null int column_index cursor.getColumnIndexOrThrow MediaStore.Images.Media.DATA cursor.moveToFirst..

Strange out of memory issue while loading an image to a Bitmap object

http://stackoverflow.com/questions/477572/strange-out-of-memory-issue-while-loading-an-image-to-a-bitmap-object

The image preview on the list view is being done with the cursor and ListAdapter . This makes it pretty simple but I am not sure..

Usage CursorLoader without ContentProvider

http://stackoverflow.com/questions/7182485/usage-cursorloader-without-contentprovider

when I needs URI in constructor of CursorLoader android cursor android cursorloader android loadermanager android contentprovider.. URI in constructor of CursorLoader android cursor android cursorloader android loadermanager android contentprovider share.. the UI thread @Override public void deliverResult Cursor cursor if isReset An async query came in while the loader is stopped..

How can I read SMS messages from the inbox programmatically in Android?

http://stackoverflow.com/questions/848728/how-can-i-read-sms-messages-from-the-inbox-programmatically-in-android

WHERE_CONDITION AND thread_id ignoreThreadId Cursor cursor context.getContentResolver .query SMS_INBOX_CONTENT_URI new.. person date body WHERE_CONDITION null SORT_ORDER if cursor null try count cursor.getCount if count 0 cursor.moveToFirst.. null SORT_ORDER if cursor null try count cursor.getCount if count 0 cursor.moveToFirst String columns..

How to call Android contacts list?

http://stackoverflow.com/questions/866769/how-to-call-android-contacts-list

create a new query and extract the name from the returned cursor. @Override public void onActivityResult int reqCode int resultCode..

Sending and Receiving SMS and MMS in Android (pre Kit Kat Android 4.4)

http://stackoverflow.com/questions/14452808/sending-and-receiving-sms-and-mms-in-android-pre-kit-kat-android-4-4

error gets thrown after querying the Carriers ContentProvider in the getMMSApns method of the APNHelper class. final Cursor apnCursor this.context.getContentResolver .query Uri.withAppendedPath Carriers.CONTENT_URI current null null null null Apparently.. thrown after querying the Carriers ContentProvider in the getMMSApns method of the APNHelper class. final Cursor apnCursor this.context.getContentResolver .query Uri.withAppendedPath Carriers.CONTENT_URI current null null null null Apparently..

How to read contacts on Android 2.0

http://stackoverflow.com/questions/1721279/how-to-read-contacts-on-android-2-0

to your AndroidManifest.xml file then you can loop through your phone contacts like this Cursor cursor getContentResolver .query ContactsContract.Contacts.CONTENT_URI null null null null while cursor.moveToNext String.. if Boolean.parseBoolean hasPhone You know it has a number so now query it like this Cursor phones getContentResolver .query ContactsContract.CommonDataKinds.Phone.CONTENT_URI null ContactsContract.CommonDataKinds.Phone.CONTACT_ID.. String phoneNumber phones.getString phones.getColumnIndex ContactsContract.CommonDataKinds.Phone.NUMBER phones.close Cursor emails getContentResolver .query ContactsContract.CommonDataKinds.Email.CONTENT_URI null ContactsContract.CommonDataKinds.Email.CONTACT_ID..

How to get the Android device's primary e-mail address

http://stackoverflow.com/questions/2112965/how-to-get-the-android-devices-primary-e-mail-address

addresses are fairly sensitive pieces of data so this is the price of admission. Below is a full example that uses a CursorLoader to retrieve profile data rows containing email addresses. public class ExampleActivity extends Activity implements.. containing email addresses. public class ExampleActivity extends Activity implements LoaderManager.LoaderCallbacks Cursor public void onCreate Bundle savedInstanceState super.onCreate savedInstanceState setContentView R.layout.activity_main getLoaderManager.. setContentView R.layout.activity_main getLoaderManager .initLoader 0 null this @Override public Loader Cursor onCreateLoader int id Bundle arguments return new CursorLoader this Retrieve data rows for the device user's 'profile'..

Get/pick an image from Android's built-in Gallery app programmatically

http://stackoverflow.com/questions/2169649/get-pick-an-image-from-androids-built-in-gallery-app-programmatically

store first this will only work for images selected from gallery String projection MediaStore.Images.Media.DATA Cursor cursor managedQuery uri projection null null null if cursor null int column_index cursor .getColumnIndexOrThrow MediaStore.Images.Media.DATA..

How to pick an image from gallery (SD Card) for my app in Android?

http://stackoverflow.com/questions/2507898/how-to-pick-an-image-from-gallery-sd-card-for-my-app-in-android

RESULT_OK Uri selectedImage imageReturnedIntent.getData String filePathColumn MediaStore.Images.Media.DATA Cursor cursor getContentResolver .query selectedImage filePathColumn null null null cursor.moveToFirst int columnIndex cursor.getColumnIndex..

How to send image via MMS in Android?

http://stackoverflow.com/questions/2972845/how-to-send-image-via-mms-in-android

public String MMSProxy public APNHelper final Context context this.context context public List APN getMMSApns final Cursor apnCursor this.context.getContentResolver .query Uri.withAppendedPath Telephony.Carriers.CONTENT_URI current null null null.. String MMSProxy public APNHelper final Context context this.context context public List APN getMMSApns final Cursor apnCursor this.context.getContentResolver .query Uri.withAppendedPath Telephony.Carriers.CONTENT_URI current null null null null if.. .query Uri.withAppendedPath Telephony.Carriers.CONTENT_URI current null null null null if apnCursor null return Collections.EMPTY_LIST else final List APN results new ArrayList APN if apnCursor.moveToFirst do final String..

How to call Android contacts list?

http://stackoverflow.com/questions/866769/how-to-call-android-contacts-list

the internet but it doesnt work. import android.app.ListActivity import android.content.Intent import android.database.Cursor import android.os.Bundle import android.provider.Contacts.People import android.view.View import android.widget.ListAdapter.. import android.view.View import android.widget.ListAdapter import android.widget.ListView import android.widget.SimpleCursorAdapter import android.widget.TextView public class Contacts extends ListActivity private ListAdapter mAdapter public TextView.. 0 Called when the activity is first created. @Override public void onCreate Bundle icicle super.onCreate icicle Cursor C getContentResolver .query People.CONTENT_URI null null null null startManagingCursor C String columns new String People.NAME..

How to use an existing database with an Android application [duplicate]

http://stackoverflow.com/questions/9109438/how-to-use-an-existing-database-with-an-android-application

Write a DataAdapter class like import java.io.IOException import android.content.Context import android.database.Cursor import android.database.SQLException import android.database.sqlite.SQLiteDatabase import android.util.Log public class.. Log.e TAG open mSQLException.toString throw mSQLException return this public void close mDbHelper.close public Cursor getTestData try String sql SELECT FROM myTable Cursor mCur mDb.rawQuery sql null if mCur null mCur.moveToNext return.. return this public void close mDbHelper.close public Cursor getTestData try String sql SELECT FROM myTable Cursor mCur mDb.rawQuery sql null if mCur null mCur.moveToNext return mCur catch SQLException mSQLException Log.e TAG getTestData..

Stop EditText from gaining focus at Activity startup

http://stackoverflow.com/questions/1555109/stop-edittext-from-gaining-focus-at-activity-startup

Activity with two elements EditText ListView When my Activity starts the EditText immediately has input focus flashing cursor . I don't want any control to have input focus at startup. I tried EditText.setSelected false No luck. How can I convince..

How to read contacts on Android 2.0

http://stackoverflow.com/questions/1721279/how-to-read-contacts-on-android-2-0

to your AndroidManifest.xml file then you can loop through your phone contacts like this Cursor cursor getContentResolver .query ContactsContract.Contacts.CONTENT_URI null null null null while cursor.moveToNext String contactId.. like this Cursor cursor getContentResolver .query ContactsContract.Contacts.CONTENT_URI null null null null while cursor.moveToNext String contactId cursor.getString cursor.getColumnIndex ContactsContract.Contacts._ID String hasPhone cursor.getString.. .query ContactsContract.Contacts.CONTENT_URI null null null null while cursor.moveToNext String contactId cursor.getString cursor.getColumnIndex ContactsContract.Contacts._ID String hasPhone cursor.getString cursor.getColumnIndex ContactsContract.Contacts.HAS_PHONE_NUMBER..

How to get the Android device's primary e-mail address

http://stackoverflow.com/questions/2112965/how-to-get-the-android-devices-primary-e-mail-address

specified one. ContactsContract.Contacts.Data.IS_PRIMARY DESC @Override public void onLoadFinished Loader Cursor cursorLoader Cursor cursor List String emails new ArrayList String cursor.moveToFirst while cursor.isAfterLast emails.add cursor.getString.. ContactsContract.Contacts.Data.IS_PRIMARY DESC @Override public void onLoadFinished Loader Cursor cursorLoader Cursor cursor List String emails new ArrayList String cursor.moveToFirst while cursor.isAfterLast emails.add cursor.getString ProfileQuery.ADDRESS.. @Override public void onLoadFinished Loader Cursor cursorLoader Cursor cursor List String emails new ArrayList String cursor.moveToFirst while cursor.isAfterLast emails.add cursor.getString ProfileQuery.ADDRESS Potentially filter on ProfileQuery.IS_PRIMARY..

Get/pick an image from Android's built-in Gallery app programmatically

http://stackoverflow.com/questions/2169649/get-pick-an-image-from-androids-built-in-gallery-app-programmatically

first this will only work for images selected from gallery String projection MediaStore.Images.Media.DATA Cursor cursor managedQuery uri projection null null null if cursor null int column_index cursor .getColumnIndexOrThrow MediaStore.Images.Media.DATA.. gallery String projection MediaStore.Images.Media.DATA Cursor cursor managedQuery uri projection null null null if cursor null int column_index cursor .getColumnIndexOrThrow MediaStore.Images.Media.DATA cursor.moveToFirst return cursor.getString.. Cursor cursor managedQuery uri projection null null null if cursor null int column_index cursor .getColumnIndexOrThrow MediaStore.Images.Media.DATA cursor.moveToFirst return cursor.getString column_index this is..

How to pick an image from gallery (SD Card) for my app in Android?

http://stackoverflow.com/questions/2507898/how-to-pick-an-image-from-gallery-sd-card-for-my-app-in-android

RESULT_OK Uri selectedImage imageReturnedIntent.getData String filePathColumn MediaStore.Images.Media.DATA Cursor cursor getContentResolver .query selectedImage filePathColumn null null null cursor.moveToFirst int columnIndex cursor.getColumnIndex.. MediaStore.Images.Media.DATA Cursor cursor getContentResolver .query selectedImage filePathColumn null null null cursor.moveToFirst int columnIndex cursor.getColumnIndex filePathColumn 0 String filePath cursor.getString columnIndex cursor.close.. cursor getContentResolver .query selectedImage filePathColumn null null null cursor.moveToFirst int columnIndex cursor.getColumnIndex filePathColumn 0 String filePath cursor.getString columnIndex cursor.close Bitmap yourSelectedImage BitmapFactory.decodeFile..

Get filename and path from uri from mediastore

http://stackoverflow.com/questions/3401579/get-filename-and-path-from-uri-from-mediastore

path mediastore share improve this question public String getRealPathFromURI Context context Uri contentUri Cursor cursor null try String proj MediaStore.Images.Media.DATA cursor context.getContentResolver .query contentUri proj null null null.. getRealPathFromURI Context context Uri contentUri Cursor cursor null try String proj MediaStore.Images.Media.DATA cursor context.getContentResolver .query contentUri proj null null null int column_index cursor.getColumnIndexOrThrow MediaStore.Images.Media.DATA.. MediaStore.Images.Media.DATA cursor context.getContentResolver .query contentUri proj null null null int column_index cursor.getColumnIndexOrThrow MediaStore.Images.Media.DATA cursor.moveToFirst return cursor.getString column_index finally if cursor..

Strange out of memory issue while loading an image to a Bitmap object

http://stackoverflow.com/questions/477572/strange-out-of-memory-issue-while-loading-an-image-to-a-bitmap-object

my new activity which is nothing more than an image widget. The image preview on the list view is being done with the cursor and ListAdapter . This makes it pretty simple but I am not sure how I can put a resized image I.e. Smaller bit size not..

Usage CursorLoader without ContentProvider

http://stackoverflow.com/questions/7182485/usage-cursorloader-without-contentprovider

use it with custom CursorAdapter and without ContentProvider when I needs URI in constructor of CursorLoader android cursor android cursorloader android loadermanager android contentprovider share improve this question I wrote a simple CursorLoader.. CursorAdapter and without ContentProvider when I needs URI in constructor of CursorLoader android cursor android cursorloader android loadermanager android contentprovider share improve this question I wrote a simple CursorLoader that does.. @Override public abstract Cursor loadInBackground Runs on the UI thread @Override public void deliverResult Cursor cursor if isReset An async query came in while the loader is stopped if cursor null cursor.close return Cursor oldCursor mCursor..

How can I read SMS messages from the inbox programmatically in Android?

http://stackoverflow.com/questions/848728/how-can-i-read-sms-messages-from-the-inbox-programmatically-in-android

if ignoreThreadId 0 Log.v Ignoring sms threadId ignoreThreadId WHERE_CONDITION AND thread_id ignoreThreadId Cursor cursor context.getContentResolver .query SMS_INBOX_CONTENT_URI new String _id thread_id address person date body WHERE_CONDITION.. SMS_INBOX_CONTENT_URI new String _id thread_id address person date body WHERE_CONDITION null SORT_ORDER if cursor null try count cursor.getCount if count 0 cursor.moveToFirst String columns cursor.getColumnNames for int i 0.. new String _id thread_id address person date body WHERE_CONDITION null SORT_ORDER if cursor null try count cursor.getCount if count 0 cursor.moveToFirst String columns cursor.getColumnNames for int i 0 i columns.length i Log.v..

How to call Android contacts list?

http://stackoverflow.com/questions/866769/how-to-call-android-contacts-list

the name of the selected contact you need to use that URI to create a new query and extract the name from the returned cursor. @Override public void onActivityResult int reqCode int resultCode Intent data super.onActivityResult reqCode resultCode..