Code example for MatrixCursor

Methods: newRow

0
     * @param date In millisec since epoch. Use NOW to use the current time. 
     * @param duration In seconds of the call. Use RAND_DURATION to pick a random one. 
     * @param type Eigher Call.OUTGOING_TYPE or Call.INCOMING_TYPE or Call.MISSED_TYPE. 
     */ 
    private void insert(String number, long date, int duration, int type) {
        MatrixCursor.RowBuilder row = mCursor.newRow();
        row.add(mIndex);
        mIndex ++;
        row.add(number);
        if (NOW == date) {
            row.add(new Date().getTime());
        } 
        if (duration < 0) {
            duration = mRnd.nextInt(10 * 60);  // 0 - 10 minutes random.
        } 
        row.add(duration);  // duration
        if (mVoicemail.equals(number)) {
            assertEquals(Calls.OUTGOING_TYPE, type);
        } 
        row.add(type);  // type
        row.add("");    // cached name