Please help me how to delete google accounts from "accounts and sync". I'm trying to call this code in my app:
AccountManagerService ams = new AccountManagerService(mContext); ams.onServiceChanged(null,true); Its crashing at object creation. If anybody is aware of any other way to delete account plz let me know. ============================================================== onServiceChanged() method is defined in AccountManagerService.java. AccountManagerService.java (frameworks\base\core\java\android \accounts) public void onServiceChanged(AuthenticatorDescription desc, boolean removed) { boolean accountDeleted = false; SQLiteDatabase db = mOpenHelper.getWritableDatabase(); Cursor cursor = db.query(TABLE_ACCOUNTS, new String[]{ACCOUNTS_ID, ACCOUNTS_TYPE, ACCOUNTS_NAME}, ACCOUNTS_TYPE + "=?", new String[]{desc.type}, null, null, null); try { while (cursor.moveToNext()) { final long accountId = cursor.getLong(0); final String accountType = cursor.getString(1); final String accountName = cursor.getString(2); Log.d(TAG, "deleting account " + accountName + " because type " + accountType + " no longer has a registered authenticator"); db.delete(TABLE_ACCOUNTS, ACCOUNTS_ID + "=" + accountId, null); accountDeleted = true; } } finally { cursor.close(); if (accountDeleted) { sendAccountsChangedBroadcast(); } } ======================================================================== -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en