2015-10-07 229 views
0

所以我现在有这样的:如何将图像添加到视图

final class Question { 

private final String questionType; 
private final String question; 
private final ArrayList<String> answers; 

private Question(final String questionType, final String question, final ArrayList<String> answers) { 
    this.questionType = questionType; 
    this.question = question; 
    this.answers = answers; 
} 

/** 
* Takes a comma separated String of the question type, the question, and the answers, and returns a {@link Question} representation of them. 
* 
* @param input The input String made up of the type of question, the question itself, and the answers (comma separated). 
* @return a {@link Question} representation of the input string. 
* @throws IllegalArgumentException 
*/ 
public static Question parse(final String input) throws IllegalArgumentException { 

    final String[] questionComponents; 
    final String questionType; 
    final String question; 
    final ArrayList<String> answers = new ArrayList<String>(); 

哪些订阅关闭此:

娱乐,阿德里安·布罗迪赢得了奥斯卡最佳男演员的电影时,钢琴家, The Village,King Kong,Dummy 娱乐,亚历克·吉尼斯赢得了最佳男主角奥斯卡的哪部电影?,桂河大桥,罗马帝国的秋天,马的嘴巴,薰衣草山Mob 娱乐,亚历克吉尼斯爵士赢得了哪一部电影的最佳男主角奥斯卡奖?,桂河大桥,金钱运行,最后一个假期,提高泰坦尼克号 娱乐,艺术卡尼赢得了最佳男主角奥斯卡为哪部电影?,哈利和托顿,Roadie,晚秀,拉尼甘的拉比 娱乐,布罗德里克克劳福德赢得了最佳男主角奥斯卡的电影?,所有国王的男人,黑天使,出生昨天,你生活的时间

即时通讯只是不知道如何将图像添加到文本列表我将只有一个额外的行与@ drawable /图像,我将如何impliment进入类?

回答

0

如果您正在使用图像URL然后把String,或者如果您使用的图像绘制使用int (R.drawable.image)

0

听起来像需要其自己的变量,没有办法添加图像转换为字符串数组。您可以通过您的解析方法使用R.drawable.image_id来传递您希望使用的图像ID。

+0

那么我会怎么称呼这些图像呢?像说有20?我会不会只放在文本文件@ drawable/image1,并使其成为imageview的图像源? –