2017-05-13 4 views
0

문제가 무엇인지 전혀 알지 못해 간단합니다. 발리 요청에 대한 나의 onResponse에서 TextView를 만들고 있습니다. 그렇게하면 응용 프로그램이 충돌합니다. 스택 트레이스를 이해할 수 없다. 90 % 어셈블리 인 것 같다. 내 어셈블리 지식은 1과 0으로 구성되어있다. 다음은 스택에 대한 링크 (그것은 약 50000 문자이고 나는 그것에 관련된 어떤 단서 ...이 없다)이다 : https://justpaste.it/16l9mVolley보기 생성시 onResponse에서 충돌 발생

을 그리고 여기 onResponse입니다 :

int i = 0; 
      GridLayout.Spec r = GridLayout.spec(0, 1); 
      GridLayout.Spec c1 = GridLayout.spec(0, 1); 
      GridLayout.LayoutParams f1 = new GridLayout.LayoutParams(r, c1); 
      f1.rightMargin = 250; 
      GridLayout.Spec c2 = GridLayout.spec(1, 1); 
      GridLayout.LayoutParams l1 = new GridLayout.LayoutParams(r, c2); 
      l1.rightMargin = 25; 
      GridLayout.Spec c3 = GridLayout.spec(2, 1); 
      GridLayout.LayoutParams p1 = new GridLayout.LayoutParams(r, c3); 
      p1.rightMargin = 25; 
      GridLayout.Spec c4 = GridLayout.spec(3, 1); 
      GridLayout.LayoutParams co = new GridLayout.LayoutParams(r, c4); 
      co.rightMargin = 25; 
      GridLayout.Spec c5 = GridLayout.spec(4,1); 
      GridLayout.LayoutParams d1 = new GridLayout.LayoutParams(r, c5); 
      TextView firstT = new TextView(context); 
      firstT.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); 
      firstT.setText("Product"); 
      grid.addView(firstT, f1); 
      TextView lastT = new TextView(context); 
      lastT.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); 
      lastT.setText("Quantity"); 
      grid.addView(lastT, l1); 
      TextView purchasesT = new TextView(context); 
      purchasesT.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); 
      purchasesT.setText("Price"); 
      grid.addView(purchasesT, p1); 
      TextView creditsT = new TextView(context); 
      creditsT.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); 
      creditsT.setText("Credits"); 
      grid.addView(creditsT, co); 
      /*TextView dateT = new TextView(context); 
      creditsT.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); 
      creditsT.setText("Date"); 
      grid.addView(dateT, d1); 
      */ 
      grid.refreshDrawableState(); 
      try { 
       while (response.has(String.valueOf(i))) { 
        GridLayout.Spec row = GridLayout.spec(i + 1, 1); 
        GridLayout.Spec col1 = GridLayout.spec(0, 1); 
        GridLayout.LayoutParams f = new GridLayout.LayoutParams(row, col1); 
        GridLayout.Spec col2 = GridLayout.spec(1, 1); 
        GridLayout.LayoutParams l = new GridLayout.LayoutParams(row, col2); 
        GridLayout.Spec col3 = GridLayout.spec(2, 1); 
        GridLayout.LayoutParams p = new GridLayout.LayoutParams(row, col3); 
        GridLayout.Spec col4 = GridLayout.spec(3, 1); 
        GridLayout.LayoutParams c = new GridLayout.LayoutParams(row, col4); 
        GridLayout.Spec col5 = GridLayout.spec(4, 1); 
        GridLayout.LayoutParams d = new GridLayout.LayoutParams(row, col5); 
        TextView first = new TextView(context); 
        first.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); 
        first.setText(response.getJSONObject(String.valueOf(i)).getString("Product")); 
        grid.addView(first, f); 
        TextView last = new TextView(context); 
        last.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); 
        last.setText(response.getJSONObject(String.valueOf(i)).getString("Quantity")); 
        grid.addView(last, l); 
        TextView purchases = new TextView(context); 
        purchases.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); 
        purchases.setText(response.getJSONObject(String.valueOf(i)).get("Price").toString()); 
        grid.addView(purchases, p); 
        TextView credits = new TextView(context); 
        credits.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); 
        credits.setText(response.getJSONObject(String.valueOf(i)).get("Credits").toString()); 
        grid.addView(credits, c); 
        /*TextView date = new TextView(context); 
        credits.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); 
        credits.setText(response.getJSONObject(String.valueOf(i++)).get("Date").toString()); 
        grid.addView(date, d); 
        */ 
        grid.refreshDrawableState(); 
       } 
       pd.cancel(); 
      } catch (JSONException e) { 
       e.printStackTrace(); 
      } 
     } 

그것은 오류를 제공하지 않습니다 언제나 동일한 TextView에서 실행되지만 항상 첫 번째 인스턴스를 인스턴스화하는 행에 있습니다. 마지막으로, 끔찍한 변수 이름에 기대지 말아주세요. 나는 그것을 고쳐야합니다.

답변

0

실수로 i ++가 포함 된 코드 섹션을 주석 처리했습니다. while 루프는 결코 종료되지 않았습니다.