List of usage examples for android.database SQLException toString
public String toString()
From source file:com.ohso.omgubuntu.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { if (Build.VERSION.SDK_INT > 11) enableStrictMode();// ww w.ja v a 2 s.c o m super.onCreate(savedInstanceState); Fragment articlesFragment = new ArticlesFragment(); Fragment categoriesFragment = new CategoriesFragment(); Fragment starredFragment = new StarredFragment(); Fragment settingsFragment = new SettingsFragment(); Fragment feedbackFragment = new FeedbackFragment(); Fragment aboutFragment = new AboutFragment(); fragments.put("sidebar_home", articlesFragment); fragments.put("sidebar_categories", categoriesFragment); fragments.put("sidebar_starred", starredFragment); fragments.put("sidebar_settings", settingsFragment); fragments.put("sidebar_feedback", feedbackFragment); fragments.put("sidebar_about", aboutFragment); articleFragmentContainer = (RelativeLayout) findViewById(R.id.fragment_articles_container); setTitle(R.string.app_name); OMGUbuntuDatabaseHelper db = new OMGUbuntuDatabaseHelper(this); try { db.getWritableDatabase(); db.close(); } catch (SQLException e) { throw new SQLException("Couldn't get db " + e.toString()); } FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); sidebar.setActiveFragment("sidebar_home"); fragmentTransaction.replace(R.id.fragment_articles_container, articlesFragment); fragmentTransaction.commit(); if (getSharedPreferences(OMGUbuntuApplication.PREFS_FILE, 0) .getBoolean(SettingsFragment.NOTIFICATIONS_ENABLED, true)) { NotificationAlarmGenerator.generateAlarm(this); } // Debug lines to force notifications for testing // if (!NotificationService.isNotificationAlarmActive()) { // NotificationAlarmGenerator.generateAlarm(getApplicationContext()); // } // Intent testIntent = new Intent(this, NotificationService.class); // startService(testIntent); }
From source file:com.yuntongxun.ecdemo.storage.IMessageSqlManager.java
public static String queryBodyBymsgId(String contactId) { Cursor cursor = null;//from ww w . java 2 s . c o m String threadId = null; if (contactId != null) { String where = IMessageColumn.MESSAGE_ID + " = '" + contactId + "' "; try { cursor = getInstance().sqliteDB().query(DatabaseHelper.TABLES_NAME_IM_MESSAGE, null, where, null, null, null, null); if (cursor != null && cursor.getCount() > 0) { if (cursor.moveToFirst()) { threadId = cursor.getString(cursor.getColumnIndexOrThrow(IMessageColumn.BODY)); } } } catch (SQLException e) { LogUtil.e(TAG + " " + e.toString()); } finally { if (cursor != null) { cursor.close(); cursor = null; } } } return threadId; }
From source file:com.yuntongxun.ecdemo.storage.IMessageSqlManager.java
/** * ???ID/* w ww. jav a 2 s .co m*/ * * @param contactId * @return */ public static long querySessionIdForByContactId(String contactId) { Cursor cursor = null; long threadId = 0; if (contactId != null) { String where = IThreadColumn.CONTACT_ID + " = '" + contactId + "' "; try { cursor = getInstance().sqliteDB().query(DatabaseHelper.TABLES_NAME_IM_SESSION, null, where, null, null, null, null); if (cursor != null && cursor.getCount() > 0) { if (cursor.moveToFirst()) { threadId = cursor.getLong(cursor.getColumnIndexOrThrow(IThreadColumn.ID)); } } } catch (SQLException e) { LogUtil.e(TAG + " " + e.toString()); } finally { if (cursor != null) { cursor.close(); cursor = null; } } } return threadId; }