2013-11-25 4 views
0

메신저로 목록보기를 표시하기 위해 목록 항목을 만들려고합니다. 코드는 않습니다 : 내가이에 할 노력하고있어 무엇생성자 ClipData.Item이 정의되지 않았습니다. Android

public static List<Item> getItemList(List<Picture> pictures, Context context) 
    { 
     List <Item> items = new ArrayList<Item>(); 
     for (int i = 0; i < pictures.size(); i++) { 
      Item item = new Item(pictures.get(i).getID(),pictures.get(i).getAddress(),pictures.get(i).getDescription(),pictures.get(i).getPath()); 
      items.add(item); 
     } 
     return items; 
    } 

데이터베이스에 각 사진에 대한 항목을 작성하는 것입니다. (으로 getDescription는 주소와 경로를 동일한 데이터베이스 핸들러에서 그림 설명을 얻을하는 것)

그러나 (내가이

생성자 ClipData.Item "를 얻는다"사용하는 라인에 다음과 같은 오류가 메신저 int, String, String, String)은 정의되지 않습니다.

무엇이 될 수 있습니까? 고맙습니다!

사진 클래스

public class Picture { 
int _id; 
String _name; 
String _address; 
String _description; 
String _path; 

// Empty constructor 
public Picture(){ 

} 
// constructor 
public Picture(int id, String name, String _address, String _description, String _path){ 
    this._id = id; 
    this._name = name; 
    this._address = _address; 
    this._description = _description; 
    this._path = _path; 
} 

// constructor 
public Picture(String name, String _address, String _description){ 
    this._name = name; 
    this._address = _address; 
    this._description = _description; 
    this._path = _path; 
} 
// getting ID 
public int getID(){ 
    return this._id; 
} 

// setting id 
public void setID(int id){ 
    this._id = id; 
} 

// getting name 
public String getName(){ 
    return this._name; 
} 

// setting name 
public void setName(String name){ 
    this._name = name; 
} 

public void setDescription(String description){ 
    this._description = description; 
} 

public String getDescription(){ 
    return this._description; 
} 

// getting phone number 
public String getAddress(){ 
    return this._address; 
} 

// setting phone number 
public void setAddress(String phone_number){ 
    this._address = phone_number; 
} 

public String getPath(){ 
    return this._path; 
} 

public void setPath(String path){ 
    this._path = path; 
} 

}

+0

이 오류 로그 캣를 게시 각 루프에 사용할 u는 점점에 null 값을 확인하십시오. –

+0

Logcat을 검사 할 수 없도록 실행할 수 없습니다. 그림 엔티티 클래스가있어 각 루프에 사용할 수 있도록 – Alejandro

+0

이 있습니다. –

답변

0

시도는

public static List<Item> getItemList(List<Picture> pictures, Context context) 
    { 
     List <Item> items = new ArrayList<Item>(); 
     for (Picture pic:pictures) { 
      int id = pic.getID(); 
      String address = pic.getAddress(); 
      String desc= pic.getDescription(); 
      String path= pic.getPath(); 
      Item item = new Item(id ,address ,desc,path); 
      items.add(item); 
     } 
     return items; 
    } 
+0

동일한 오류가 발생했습니다. 정의되지 않았습니다. (생성자 ClipData.Item (int, String , String, String)이 정의되지 않았습니다. – Alejandro

+0

줄 번호 및 게시 가져 오기 그림 엔터티 클래스 –

+0

Item 클래스는 무엇입니까? 아이템 클래스 코드 –

관련 문제