2016-06-09 4 views
0

문자열보기를 목록보기로 가져올 수 있지만 구문 분석의 "newStatus"열에 저장된 정보를 가져 와서 "StatusDetailView"라는 새 활동에 넣으면 아무것도 표시되지 않습니다. 나온다.
도움이 될 것입니다. 내가 제공하는 코드는 udemy에 대한 자습서에서 나온 것이므로 강사에게 연락 할 수 없습니다.구문 분석 서버에서 데이터 가져 오기

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"

**OnListItemClick**

StatusDetailView.java 다른 활동에 표시됩니다 나는 응용 프로그램을 실행하고 행을 선택하면, 그것은 StatusDetailView Activity에 오류가 있지만 목록에 8 행이 표시됩니다 :

error

여기

list of statuses

+0

내가 어떻게 작업을 수행 할 수 있습니다

이 같은 변경 작업을 얻으려면? 나는 ParseLogInterceptor를 가지고 있으며 이것은 내가 얻은 것이다 : Body : { "where": "{\"objectId \ ": \"objectId \ "}", "_method": "GET"... Body : { "results ": []} – LizG

답변

1

:

query.getInBackground("objectId", new GetCallback<ParseObject>() { 
         ^^^^^^^ 
.. 
} 

이드 대신 intent.getStringExtra를 사용하여 초기화된다 objectId 문자열의 값 objectId 문자열을 전달. ρяσѕρєяK @

query.getInBackground(objectId, new GetCallback<ParseObject>() { 

... 
} 
관련 문제