zoukankan      html  css  js  c++  java
  • SQLite的时候判断语句是否纯在:出现RuntimeException

    写SQLite的时候判断语句是否纯在:

    public boolean exist(long id) {
    String filter = FRIEND_KEY_ID + "=" + id;
    Cursor cursor = m_db.query(DATABASE_TABLE_FRIEND,
    new String[]{FRIEND_KEY_ID, FRIEND_KEY_TEXT}, filter, null, null, null, null);
    if (cursor != null && cursor.getCount()>0)
    {
      Log.v("Database", "Exist");
      return true;
    }
    else {
        Log.v("Database", "Doesn't exist");
        return false;
      }
    }

    04-14 11:52:17.323: E/AndroidRuntime(1058): java.lang.RuntimeException: An error occured while executing doInBackground()

    An Exception is checked, and a RuntimeException is unchecked.

    Checked means that the compiler requires that your handle the exeception in a catch, or declare your method as throwing it (or one of it's ancestors).

    Generally, throw a checked exception if the caller of the API is expected to handle the exception, and an unchecked exception if it is something the caller would not normally be able to handle, such as an error with one of the parameters, i.e. a programming mistake.

    代码修改正确后实现,开始条件语句错误

  • 相关阅读:
    What is EJB
    Redis连接工具类
    MyBatis单列工厂的实现
    TCP和UDP的区别(Socket)
    webSocket协议与Socket的区别
    OSI七层模型
    Http协议和HTTPS协议
    Cookie和Session
    Request库使用response.text返回乱码问题
    Selenium元素定位问题
  • 原文地址:https://www.cnblogs.com/bruceyo/p/3663781.html
Copyright © 2011-2022 走看看