2014-01-20 1 views
1

다음에 대한 도움을 받으십시오. 사용자 정의 가능한 확장 가능 목록을 작성하고 각 이미지에 sdcard에 저장된 이미지를 저장하려면 어떻게합니까? 각 이미지의 경로가있는 데이터베이스가 있습니다. . (할 수있는 사람의 도움을^^ 고마워^^확장 가능한 목록을 sdcard에 저장된 이미지로 생성하십시오.

는 달리의 경우에 도움이 될 것입니다 이제 확장 만드는 방법의 예를

:.

cursor = builder.query(
      /* from */ Usuario.getInstance().getReadableDatabase(), 
      /* select */ columnsToReturn, 
      /* where */ Usuario.CPF_KEY + " = \'" + LastLoginData.getCpf() + "\'", 
      null, null, null, 
      /* order by */ Usuario.REG_ID_KEY + " ASC"); 

    listAdapter = new SimpleCursorTreeAdapter(
     this, cursor, R.layout.registro_parent, 
     new String[] { Usuario.REG_DATE_KEY, Usuario.REG_TYPE_KEY, Usuario.REG_STATUS_KEY }, 
     new int[] { R.id.textData, R.id.textRegTipo, R.id.textStatus }, 
     R.layout.registro_child, 
     new String[] { Usuario.REG_MEDIA_THUMB_KEY, Usuario.REG_INFO_KEY }, 
     new int[] {R.id.imgSnapshot2 , R.id.textComentarios }) 
    { 
     @Override 
     protected Cursor getChildrenCursor(Cursor cursor) { 

      String id = cursor.getString(cursor.getColumnIndexOrThrow(Usuario.REG_ID_KEY)); 
      SQLiteDatabase db = Usuario.getInstance().getWritableDatabase(); 

      String query = "select " + Usuario.REG_ID_KEY + ", " + Usuario.REG_MEDIA_THUMB_KEY + ", " + Usuario.REG_INFO_KEY + " from " + Usuario.REG_TABLE + " where " + Usuario.REG_ID_KEY + "='" + id + "'"; 
      Cursor cur = db.rawQuery(query, null); 

      return cur; 
     } 

     @Override 
     protected void bindGroupView(View view, Context context, Cursor cursor, boolean isExpanded) { 
      super.bindGroupView(view, context, cursor, isExpanded); 

      ImageView img = (ImageView)view.findViewById(R.id.imageExpand); 
      if(img != null) { 
       if(isExpanded) { 
        img.setImageResource(R.drawable.btn_circulo_baixo); 
       } 
       else { 
        img.setImageResource(R.drawable.btn_circulo_dir); 
       } 
      } 

      TextView status = (TextView)view.findViewById(R.id.textStatus); 
      if(status != null) { 
       String s = status.getText().toString(); 
       if(s.equals(getString(R.string.Enviada))) { 
        status.setTextColor(0xffff0000); 
       } 
       else if(s.equals(getString(R.string.EmAndamento))) { 
        status.setTextColor(0xffffcc00); 
       } 
       else if(s.equals(getString(R.string.Atendida))) { 
        status.setTextColor(0xff00cc00); 
       } 
       else { 
        status.setTextColor(0xff808080); 
       } 
      } 

      if(isExpanded) { 
       img = (ImageView)view.findViewById(R.id.imageRodape); 

       if(img != null) { 
        img.setVisibility(View.INVISIBLE); 
       } 
      } 
      else { 
       img = (ImageView)view.findViewById(R.id.imageRodape); 
       if(img != null) { 
        img.setVisibility(View.VISIBLE); 
       } 
      } 
     } 
    }; 

    listView.setAdapter(listAdapter); 

이 코드는 잘하지만 사진 모두를 삽입

답변

관련 문제