0
我能夠將字符串數組檢索到列表視圖中,但是當我嘗試獲取存儲在解析的「newStatus」列中的信息並將其放入新的「StatusDetailView」活動時,出來。
任何幫助將是有益的。我提供的代碼來自udemy教程,我無法聯繫到教練。從解析服務器中檢索數據
當點擊網頁列表上的一行,從該行的文本顯示在另一個活動 「StatusDetailView」
StatusDetailView.java:
public class StatusDetailView extends Activity {
String objectId;
protected TextView mStatus;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.content_status_detail_view);
// initialize
mStatus = (TextView) findViewById(R.id.statusDetailView);
// Get the intent that started the activity
Intent intent = getIntent();
objectId = intent.getStringExtra("objectID"); // matches key in HomePageActivity
// query data from parse
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Status");
// Retrieve the object by id
query.getInBackground("objectId", new GetCallback<ParseObject>() {
@Override
public void done(ParseObject parseObject, ParseException e) {
if (e == null) {
// Success we have a status
String userStatus = parseObject.getString("newStatus"); // column
mStatus.setText(userStatus);
} else {
// there was an error, advise user
AlertDialog.Builder builder = new AlertDialog.Builder(StatusDetailView.this);
builder.setMessage(e.getMessage());
builder.setTitle("Sorry");
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// close the dialog
dialog.dismiss();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
}
});
當我運行應用程序,並選擇一行,它帶我到StatusDetailView活動的一個錯誤,但列表顯示8行:
@ρяσѕρєяK我怎樣才能做到這一點?我有ParseLogInterceptor,這就是我得到的:Body:{「where」:「{\」objectId \「:\」objectId \「}」,「_method」:「GET」then ... Body:{「results 「:[]} – LizG