小编Mar*_*Rey的帖子

Netbeans IDE 8.0.2 C++输入/输出错误

我在Windows 7上安装了netbeans C++,并使用Cywgin4作为编译器.当我运行任何程序甚至一个简单的Hello世界时它会编译并运行但是我也会得到以下错误.我似乎无法在网上找到任何参考.有人能指出我正确的解决方案吗?谢谢!

从主机读取失败:输入/输出错误

RUN FAILED(退出值1,总时间:47ms)

c++ netbeans

20
推荐指数
1
解决办法
2万
查看次数

如果SQLite游标没有结果,应用程序崩溃

我有一个使用游标运行SQlite查询的应用程序.

    public Cursor totaltrips(){
    Cursor cursor = database.rawQuery("SELECT * AS TTotal FROM " + DatabaseHelper.TABLE_NAME, null);
    return cursor;
}
Run Code Online (Sandbox Code Playgroud)

结果存储到最多5个值的Arraylist.如果数据库中没有记录,则应用程序崩溃.如果我有一个或多个数据库条目,它工作正常.有没有人知道如何在没有数据库条目时阻止它崩溃?

 // get column value
    if (Distance.moveToNext())
        result = String.valueOf(Distance.getDouble(Distance.getColumnIndex("myTotal")));

    tnmView.setText(result);

    List<String> distancearray = new ArrayList<String>();
    Cursor cursor =  dbManager.totaldistance();


    do{
        distancearray.add(cursor.getString(1));
    }while ((cursor.moveToNext()));
    ttrips = cursor.getCount();
    Log.i("Graph", "TTRIPS = " + ttrips);

    // Be sure here to have at least the 5 desired elements into the list
    while(distancearray.size() < 5){
        distancearray.add("0");
    }
Run Code Online (Sandbox Code Playgroud)

该应用程序因错误而崩溃

android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size …
Run Code Online (Sandbox Code Playgroud)

sqlite android arraylist android-sqlite

5
推荐指数
1
解决办法
451
查看次数

标签 统计

android ×1

android-sqlite ×1

arraylist ×1

c++ ×1

netbeans ×1

sqlite ×1