get返回值在android中的方法中为null

时间:2013-09-30 07:52:20

标签: android

我编写了一个从数据库中获取数据的函数。

我已设置断点并确保该函数已获取返回数据

但是当我使用函数时我无法在我的主函数中获取数据

是我的数据结构错误?或其他事情错误?

感谢您的帮助。

import java.util.ArrayList;

public class ScheduleData {

public String strID;
public String strName;
public String strDesc;
public Integer iScheduleDay;
public String strStartDate;
public ArrayList<ScheduleContent> alPOI;

public ScheduleData() {
    strID = new String();
    strName = new String();
    strDesc = new String();
    strStartDate = new String();
    iScheduleDay = 0;
    alPOI = new ArrayList<ScheduleContent>();       
}
}

//

public class ScheduleContent {

public String strPOIID;
public int iSequence ;
public int iDay ;
public String strTime;
public int iStayTime ;

public ScheduleContent() {

    iSequence = 1;
    iDay = 1;
    iStayTime = 0;
}

}

//

public boolean bInitData() {

ArrayList<ScheduleData> alEx = alGetAllSchedule();

}

private ArrayList<ScheduleData> alGetAllSchedule() {
    ArrayList<ScheduleData> alTmp = new ArrayList<ScheduleData>();
    try {
        mDATA.m_alAllSchedule.clear();
        Cursor c = objSchedule.getAllCursor();
        ScheduleDataInit();

        if (c.getCount() > 0) {
            if (c.moveToFirst()) {
                while (c.isAfterLast() == false) {
                    ScheduleData sTmp = new ScheduleData();
                    sTmp.strID = c.getString(c.getColumnIndex("SID"));
                    sTmp.strName = c.getString(c.getColumnIndex("S_Name"));

                    sTmp.strDesc = c.getString(c.getColumnIndex("S_Desc"));
                    sTmp.strStartDate = c.getString(c
                            .getColumnIndex("S_StartDate"));

                    sTmp.iScheduleDay = Integer.valueOf(c.getInt(c
                            .getColumnIndex("S_Day")));

                    sTmp.alPOI=mDATA.m_hAllScheduleContent.get(sTmp.strID);


                    alTmp.add(sTmp);
                    c.moveToNext();
                }
            }

        }
        mDATA.m_alAllSchedule = alTmp;
        c.close();
    } catch (Exception errMsg) {
        errMsg.printStackTrace();
    }
    return alTmp;
}

0 个答案:

没有答案