I am making a todo app. I am getting these two errors when i am going through the showactivity:
This is my class:
public class ShowToDoActivity extends ListActivity implements LoaderManager.LoaderCallbacks<Cursor> {
private SimpleCursorAdapter adapter;
private static final int ACTIVITY_CREATE = 0;
private static final int ACTIVITY_EDIT = 1;
private static final int DELETE_ID = Menu.FIRST + 1;
DbContentProvider dbcp;
SQLiteDatabase database;
DBCompanyClass db;
private String[] allTodoColumns = {DBCompanyClass.COL_TODO_ID, DBCompanyClass.COL_TODO_NAME, DBCompanyClass.COL_TODO_CATEGORY};
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_show_to_do);
    fillData();
    registerForContextMenu(getListView());
}
// create the menu based on the XML defintion
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.listmenu, menu);
    return true;
}
// Reaction to the menu selection
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.insert:
            createTodo();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
private void createTodo() {
    Intent i = new Intent(this, AddTodoActivity.class);
    startActivity(i);
}
private void fillData() {
    String[] from = new String[]  {DBCompanyClass.COL_TODO_NAME};
    ArrayList<String> from_updated=new ArrayList<String>();
    String[] array = new String[from.length];
    this.db = new DBCompanyClass(this);
    database = db.getWritableDatabase();
    Cursor from_cursor = database.query(DBCompanyClass.TABLE_NAME_TODO,allTodoColumns,null,null,null,null,DBCompanyClass.COL_TODO_CATEGORY) ;
    from_cursor.moveToFirst();
    while(!from_cursor.isAfterLast()){
        from_updated.add(from_cursor.getInt(0),from_cursor.getString(1));
        from_cursor.moveToNext();
    }
    array = from_updated.toArray(array);
    // Fields on the UI to which we map
    int[] to = new int[] { R.id.label };
    getLoaderManager().initLoader(0, null, this);
    adapter = new SimpleCursorAdapter(this,R.layout.datarow,null,array,to,0);
    setListAdapter(adapter);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    getListView().getAdapter();
    // You might consider using Bundle.putStringArray() instead
}
@Override
public boolean onContextItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case DELETE_ID:
            AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item
                    .getMenuInfo();
            Uri uri = Uri.parse(DbContentProvider.CONTENT_URI + "/"
                    + info.id);
            getContentResolver().delete(uri, null, null);
            fillData();
            return true;
    }
    return super.onContextItemSelected(item);
}
// Opens the second activity if an entry is clicked
protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    Intent edit = new Intent(this, AddTodoActivity.class);
    Uri todoUri = Uri.parse(DbContentProvider.CONTENT_URI + "/" + id);
    edit.putExtra(DbContentProvider.CONTENT_ITEM_TYPE, todoUri);
    startActivity(edit);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
                                ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.add(0, DELETE_ID, 0, R.string.menu_delete);
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String[] projection = { DBCompanyClass.COL_TODO_ID , DBCompanyClass.COL_TODO_NAME};
    CursorLoader cursorLoader = new CursorLoader(this,
            DbContentProvider.CONTENT_URI, projection, null, null, null);
    return cursorLoader;
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data)
{
    adapter.swapCursor(data);
}
// data is not available anymore, delete reference
@Override
public void onLoaderReset(Loader<Cursor> loader)
{
    adapter.swapCursor(null);
}
}
This is the class where i am getting errors when I am running the App. I tried to debug it also.
I am getting the IndexOutOfBoundsException at line : from_updated.add(from_cursor.getInt(0),from_cursor.getString(1));
Can you tell me why is this so ?
 
    