2014-07-15 65 views
0

嗯,即時嘗試做一個屏幕,需要幾個字段,然後,它將信息發送到我的服務器。該代碼的作品,我可以進行插入,但現在,我試圖完成與我的應用程序的類組的複選框選擇器的屏幕。與ListViews和適配器卡住

問題是,比我在不同的課程中可變數量的組,所以我必須做到動態。

我工作的班就是這樣。意見之間的包裹代碼就是失敗

public class NuevaTarea extends Activity { 

    EditText nombretarea; 
    DatePicker fechainicio, fechafin; 
    ExpandableListView listagrupos; 
    Button crear; 
    TimePicker horainicio, horafin; 
    ProgressDialog pDialog; 
    Httppostaux post; 
    CheckBox op1, op2, op3, op4, op5; 
    JSONArray Grupos; 
    ArrayList<PostData> data; 
    PostAdapter adapter; 
    ListView lista; 






    @SuppressWarnings("null") 
    public void onCreate(Bundle savedInstanceState) { { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_insertatarea); 


     nombretarea = (EditText) findViewById(R.id.editText1); 
     fechainicio = (DatePicker) findViewById(R.id.datePicker1); 
     fechafin = (DatePicker) findViewById(R.id.datePicker2); 
     listagrupos = (ExpandableListView) findViewById(R.id.expandableListView1); 
     crear = (Button) findViewById(R.id.buttoncrear); 
     horainicio = (TimePicker) findViewById(R.id.timePicker1); 
     horafin = (TimePicker) findViewById(R.id.timePicker2); 
     op1 = (CheckBox) findViewById(R.id.checkBox1); 
     op2 = (CheckBox) findViewById(R.id.checkBox2); 
     op3 = (CheckBox) findViewById(R.id.checkBox3); 
     op4 = (CheckBox) findViewById(R.id.checkBox4); 
     op5 = (CheckBox) findViewById(R.id.checkBox5); 

     //////////////// Grupos 


     Log.d("Grupos", "Previo Inicio"); 
     if (savedInstanceState == null) { 
      Log.d("Grupos", "SavedInstance == NULL"); 
      Log.d("Todos los Grupos", "ARRAY GRUPOS = " + Constantes.cargainfogrupos); 
      //new asynccargagrupos().execute(); 
      Log.d("Todos los Grupos", "ARRAY GRUPOS = " + Constantes.cargainfogrupos); 
      data = new ArrayList<PostData>(); 
      if (Constantes.cargainfogrupos != null) { 
       Log.d("Grupos", "Grupos != NULL"); 
       Log.d("Grupos", "Dentro del WHILE"); 
        String tex; 
        try { 
         Log.d("Grupos", "Dentro del Try"); 
         for (int i = 0; i < Constantes.cargainfogrupos.length(); i++){ 
          Log.d("Grupos", "Dentro del For"); 
          JSONObject jsonObject = Constantes.cargainfogrupos.getJSONObject(i); 
          tex = jsonObject.getString("nombregrupo"); 
          data.add(new PostData(tex, false)); 
          Log.d("Grupos", "Primera Vista a data" + data); 
         } 
         Log.d("Grupos", "Version de Data que paso a Adapter" + data); 
         adapter = new PostAdapter(NuevaTarea.this, data); 

        } 
        catch (Exception e){ 

        } 

      } 

     }else { 
      Log.d("Grupos", "ELSE"); 
      data = savedInstanceState.getParcelableArrayList("saveddata"); 
      adapter = new PostAdapter(NuevaTarea.this, data);  
     } 
     ListView lv = (ListView) findViewById(android.R.id.list); 
     lv.setAdapter(adapter); 

     /////////////////// GRUPOS 

我的XML文件是

<ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

    <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Nombre Tarea" /> 

    <EditText 
     android:id="@+id/editText1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:ems="10" > 
    </EditText> 

    <TextView 
     android:id="@+id/textView4" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Tipo de Tarea" /> 

    <CheckBox 
     android:id="@+id/checkBox1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Examen Práctico Parcial" /> 

    <CheckBox 
     android:id="@+id/checkBox2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Examen Práctico Final" /> 

    <CheckBox 
     android:id="@+id/checkBox3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Examen Teórico Parcial" /> 

    <CheckBox 
     android:id="@+id/checkBox4" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Exament Teórico Final" /> 

    <CheckBox 
     android:id="@+id/checkBox5" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Entregable" /> 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Fecha de Inicio" /> 

    <TimePicker 
     android:id="@+id/timePicker1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 


    <DatePicker 
     android:id="@+id/datePicker1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 

    <TextView 
     android:id="@+id/FechaFinalizacion" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="TextView" /> 

    <TimePicker 
     android:id="@+id/timePicker2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 


    <DatePicker 
     android:id="@+id/datePicker2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 
    <TextView 
     android:id="@+id/textView3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Grupo" /> 

    <ExpandableListView 
     android:id="@+id/expandableListView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 
    </ExpandableListView> 

    <!-- CHECKBOXs --> 

    <RelativeLayout 
    android:id="@+id/LinearLayout1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="#999999" 
    android:padding="2dp" > 

    <CheckBox 
     android:id="@+id/leido" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerVertical="true" 
     android:focusable="false" /> 

    <TextView 
     android:id="@+id/tvTitulo" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerVertical="true" 
     android:layout_toRightOf="@id/leido" 
     android:text="Titulo del post" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

    <ListView 
     android:id="@+id/listView1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 
    </ListView> 



    </RelativeLayout> 



    <!-- CHECKBOXs --> 
    <Button 
     android:id="@+id/buttoncrear" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Crea Tarea" /> 



     </LinearLayout> 


    </ScrollView> 



</LinearLayout> 

,我用兩個外部類,POSTDATA和PostAdapter

public class PostData implements Parcelable{ 

    private String titulo; 
    private boolean leido; 

    public PostData(String equip, boolean checked) { 

     this.titulo = equip; 
     this.leido = checked; 

    } 

    public PostData(Parcel in){ 
     this.titulo= in.readString(); 
     this.leido = in.readInt() == 1 ? true:false; 
    } 


    public void setChecked(boolean value) { 
    this.leido = value; 
} 

    public boolean getChecked() { 
     return leido; 
    } 

    public String getEquipos() { 
     return titulo; 
    } 

    public void setEquipos(String equipos) { 
     this.titulo = equipos; 
    } 

    @Override 
    public int describeContents() { 
    return 0; 
    } 

    @Override 
    public void writeToParcel(Parcel dest, int flags) { 
    dest.writeString(getEquipos()); 
    dest.writeInt(getChecked() ? 1 : 0); 
    } 

    public static final Parcelable.Creator<PostData> CREATOR = new Parcelable.Creator<PostData>() { 
    public PostData createFromParcel(Parcel in) { 
      return new PostData(in); 
     } 

     public PostData[] newArray(int size) { 
      return new PostData[size]; 
     } 
    }; 

這是我班PostAdapter

public class PostAdapter extends BaseAdapter { 

static class ViewHolder 
{ 
     TextView tvFecha_pub; 
     TextView tvtitulo_post; 
     CheckBox cb; 
    } 

    private static final String TAG = "CustomAdapter"; 
    private static int convertViewCounter = 0; 

    private ArrayList<PostData> data; 
    private LayoutInflater inflater = null; 

public PostAdapter(Context c, ArrayList<PostData> d) 
    { 
     Log.v(TAG, "Constructing CustomAdapter"); 

     this.data = d; 
     inflater = LayoutInflater.from(c); 
    } 

    @Override 
    public int getCount() 
    { 
     Log.v(TAG, "in getCount()"); 
     return data.size(); 
} 

    @Override 
    public Object getItem(int position) 
{ 
     Log.v(TAG, "in getItem() for position " + position); 
     return data.get(position); 
    } 

    @Override 
    public long getItemId(int position) 
{ 
     Log.v(TAG, "in getItemId() for position " + position); 
     return position; 
    } 

    @Override 
    public int getViewTypeCount() 
    { 
     Log.v(TAG, "in getViewTypeCount()"); 
     return 1; 
    } 

    @Override 
    public int getItemViewType(int position) 
    { 
     Log.v(TAG, "in getItemViewType() for position " + position); 
     return 0; 
    } 

    @Override 
    public void notifyDataSetChanged() 
    { 
     super.notifyDataSetChanged(); 
    } 

    @Override 
    public View getView(int position, View convertView, ViewGroup parent) 
    { 

     ViewHolder holder; 

     Log.v(TAG, "in getView for position " + position + ", convertView is " 
       + ((convertView == null) ? "null" : "being recycled")); 

    if (convertView == null) 
     { 
      convertView = inflater.inflate(R.layout.activity_insertatarea, null); 

      convertViewCounter++; 
      Log.v(TAG, convertViewCounter + " convertViews have been created"); 

      holder = new ViewHolder(); 


      holder.tvtitulo_post = (TextView) convertView 
        .findViewById(R.id.tvTitulo); 
      holder.cb = (CheckBox) convertView.findViewById(R.id.leido); 
      holder.cb.setOnClickListener(checkListener); 

      convertView.setTag(holder); 

    } else 
      holder = (ViewHolder) convertView.getTag(); 

    // Para porde hacer click en el checkbox 
     PostData d = (PostData) getItem(position); 
     holder.cb.setTag(d); 
     // Setting all values in listview 

     holder.tvtitulo_post.setText(data.get(position).getEquipos()); 
     holder.cb.setChecked(data.get(position).getChecked()); 

     return convertView; 
} 

    public void setCheck(int position) 
    { 
     PostData d = data.get(position); 

     d.setChecked(!d.getChecked()); 
     notifyDataSetChanged(); 
} 

    public void checkAll(boolean state) 
{ 
     for (int i = 0; i < data.size(); i++) 
      data.get(i).setChecked(state); 
    } 

    public void cancelSelectedPost() 
    { 

     int i = 0; 
     while (i < getCount()) 
     { 
      if (data.get(i).getChecked()) 
      { 
       data.remove(data.indexOf(data.get(i))); 
     } else 
       i++; 
     } 
     notifyDataSetChanged(); 

} 

    public boolean haveSomethingSelected() 
    { 
     for (int i = 0; i < data.size(); i++) 
      if (data.get(i).getChecked()) 
       return true; 
     return false; 
    } 

    /** 
    * Este método es para poder seleccionar una fila directamente con el 
    * checkbox en lugar de tener que pulsar en la liste en sí 
    */ 
private OnClickListener checkListener = new OnClickListener() 
    { 

     @Override 
     public void onClick(View v) 
    { 
      PostData d = (PostData) v.getTag(); 
     d.setChecked(!d.getChecked()); 
     } 
    }; 

} 

而且我堅持了這個錯誤日誌

07-14 20:34:52.972: E/AndroidRuntime(5961): FATAL EXCEPTION: main 
    07-14 20:34:52.972: E/AndroidRuntime(5961): java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.CalendarView$WeekView 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.CalendarView.onScroll(CalendarView.java:1183) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.CalendarView.access$900(CalendarView.java:76) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.CalendarView$2.onScroll(CalendarView.java:1075) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1340) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.ListView.layoutChildren(ListView.java:1762) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.AbsListView.onLayout(AbsListView.java:2012) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.View.layout(View.java:14289) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewGroup.layout(ViewGroup.java:4562) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.LinearLayout.onLayout(LinearLayout.java:1434) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.View.layout(View.java:14289) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewGroup.layout(ViewGroup.java:4562) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.View.layout(View.java:14289) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewGroup.layout(ViewGroup.java:4562) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1660) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.LinearLayout.onLayout(LinearLayout.java:1436) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.View.layout(View.java:14289) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewGroup.layout(ViewGroup.java:4562) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.View.layout(View.java:14289) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewGroup.layout(ViewGroup.java:4562) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.LinearLayout.onLayout(LinearLayout.java:1434) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.View.layout(View.java:14289) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewGroup.layout(ViewGroup.java:4562) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.ScrollView.onLayout(ScrollView.java:1459) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.View.layout(View.java:14289) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewGroup.layout(ViewGroup.java:4562) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.LinearLayout.onLayout(LinearLayout.java:1434) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.View.layout(View.java:14289) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewGroup.layout(ViewGroup.java:4562) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.View.layout(View.java:14289) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewGroup.layout(ViewGroup.java:4562) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:349) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.View.layout(View.java:14289) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewGroup.layout(ViewGroup.java:4562) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.View.layout(View.java:14289) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewGroup.layout(ViewGroup.java:4562) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1976) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1730) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.Choreographer.doCallbacks(Choreographer.java:562) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.Choreographer.doFrame(Choreographer.java:532) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.os.Handler.handleCallback(Handler.java:730) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.os.Handler.dispatchMessage(Handler.java:92) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.os.Looper.loop(Looper.java:137) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at android.app.ActivityThread.main(ActivityThread.java:5103) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at java.lang.reflect.Method.invokeNative(Native Method) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at java.lang.reflect.Method.invoke(Method.java:525) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
07-14 20:34:52.972: E/AndroidRuntime(5961):  at dalvik.system.NativeStart.main(Native Method) 
07-14 20:39:55.014: E/AndroidRuntime(5993): FATAL EXCEPTION: main 
07-14 20:39:55.014: E/AndroidRuntime(5993): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.PFC.pablo/com.PFC.pablo.Cursos}: java.lang.NullPointerException 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at android.app.ActivityThread.access$600(ActivityThread.java:141) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at android.os.Handler.dispatchMessage(Handler.java:99) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at android.os.Looper.loop(Looper.java:137) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at android.app.ActivityThread.main(ActivityThread.java:5103) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at java.lang.reflect.Method.invokeNative(Native Method) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at java.lang.reflect.Method.invoke(Method.java:525) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at dalvik.system.NativeStart.main(Native Method) 
07-14 20:39:55.014: E/AndroidRuntime(5993): Caused by: java.lang.NullPointerException 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at com.PFC.pablo.Cursos.agregarFilasTabla(Cursos.java:113) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at com.PFC.pablo.Cursos.onCreate(Cursos.java:74) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at android.app.Activity.performCreate(Activity.java:5133) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) 
07-14 20:39:55.014: E/AndroidRuntime(5993):  ... 11 more 

當我嘗試加載的活動,一切正常,甚至可以爲循環獲取數據以及做好NuevaTarea.java,但是這就是壞了。具體來說,來到這裏,並從那裏它不通過

Log.d("Grupos", "Version de Data que paso a Adapter" + data); 
        adapter = new PostAdapter(NuevaTarea.this, data); 

任何想法?

回答

0

從堆棧跟蹤看來,您將一個LinearLayout投影到某個CalendarView的某個地方是一個名爲Cursos的類。

你可能有一行類似

LinearLayout mLayout = (LinearLayout) findViewById(R.id.my_view); 

但具有ID R.id.my_view實際上是一個日曆視圖的視圖。

+0

事情是我在這個活動中沒有CalendarView,我在這裏使用課程,所以我瘋了。 – RsG

+0

您是否發佈了該活動的代碼? –

+0

從Cursos?不,我從應用程序試圖用「我沒有正確初始化」的字段「返回」該活動時從Cursos中得到錯誤。 如果我註釋行////// Grupos之間的代碼,它完美的工作,我可以插入的信息,除了我必須從我想創建的複選框中獲得的字段 – RsG