私はアンドロイド開発にかなり慣れていません。コンテンツプロバイダーを使用してテーブルに挿入し、テーブルをチェックして、存在する場合はレコードを取得しようとしています。存在すると言い続けていますが、私が探していたレコードではありません。
Cursor c = contentResolver.query(ContentDescriptor.Survey.CONTENT_URI, projection,
ContentDescriptor.Survey.Cols.SURVEYNAME + " =?", new String[] {surveyName}, null);
if((c != null) && (c.moveToFirst())){
//-----------------------------------------------------------------------------------
//what if it does exist do something here
Toast.makeText(getBaseContext(), "Survey Already Exists " + surveyName, Toast.LENGTH_SHORT).show();
Intent i = new Intent().setClass(CreateSurveyActivity.this, PickSurveyActivity.class);
}
else{
//does not exist in database
survey = SurveyRepository.instance().createNewSurvey(context, surveyName);
Log.i(TAG, "survey did not exist creating survey");
SurveyRepository.instance().loadContent(context);
}
c.close();
}