我有一个名为 SResponses 的类,它具有函数“getsrthreadid”,我试图从我的另一个类中调用它,我这样做是:
SResponses sres=new SResponses();
String queryz = "SELECT " + MySQLiteHelper.COLUMN_ID + "," + MySQLiteHelper.COLUMN_MESSAGE+","+MySQLiteHelper.COLUMN_THREADID+","+MySQLiteHelper.COLUMN_POSITION + " FROM " + MySQLiteHelper.TABLE_NAME + " WHERE "+MySQLiteHelper.COLUMN_THREADID+ "="+sres.getsrthreadid();
//Log.e("datasource", sres.getsrthreadid());
cursors = database.rawQuery(queryz, null);
SResponses 类中的函数定义为:
private String threadid;
public String getsrthreadid()
{
return threadid;
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.sresponses);
datasource = new DataSource(getApplicationContext());
datasource.open();
Intent intent=getIntent();
threadid = intent.getStringExtra("threadid");
}
但我没有从这个函数中得到任何价值。请帮我找出问题所在。
来自 Logcat 的错误:
11-07 01:43:01.072: E/AndroidRuntime(848): java.lang.RuntimeException: Unable to start activity ComponentInfo{soft.b.peopleassist/soft.b.peopleassist.SResponses}: java.lang.NullPointerException: println needs a message