- Forum-Beiträge: 37
18.09.2015, 18:02:21 via Website
18.09.2015 18:02:21 via Website
Hallo guys,
ich habe ein Riesenproblem! Ich bekomm es nicht hin von meiner main.xml die listview sowie aus meinem customlayout die imageview in meinen Adapter zu implementieren!!! Da ich dies nicht kann habe ich das problem das meine imageview in meinem customlayout nicht erkannt wird und ich nicht in der lage bin das Bild ausgesucht aus der Gallery in die imageview zu setzen! Es kommt nur ganz kurz zum Vorschein in der imageview und verschwindet danach sofort wieder(das Bild!!!)!!!
Bitte dringend um Hilfe und jemand der mich leitet meinen adapter zu modifizieren.
Dsa ist mein Adapter...
public class RecipesAdapter extends ArrayAdapter {
protected List<ParseObject> mRecipes;
public Context mContext;
public RecipesAdapter(Context context, List<ParseObject> comment) {
super(context, R.layout.recipes_customlayout, comment);
mContext = context;
mRecipes = comment;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = LayoutInflater.from(mContext).inflate(
R.layout.recipes_customlayout, null);
holder = new ViewHolder();
holder.imgPic = (ParseImageView) convertView.findViewById(R.id.img_recipes);
holder.username_recipesChat = (TextView) convertView.findViewById(R.id.row_username_recipes);
holder.message_recipesChat = (TextView) convertView.findViewById(R.id.row_message_recipes);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
ParseObject recipesObject = mRecipes.get(position);
String username = recipesObject.getString("user");
holder.username_recipesChat.setText(username);
String message = recipesObject.getString("commentStatus");
holder.message_recipesChat.setText(message);
return convertView;
}
public static class ViewHolder {
TextView username_recipesChat;
TextView message_recipesChat;
ParseImageView imgPic;
}
}
Listview in main layout...
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/android:list"
android:paddingLeft="5dp"
android:divider="@null"
android:dividerHeight="0dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_above="@+id/add_text" />
Imageview in Customlayout...
android:layout_width="match_parent"
android:layout_height="200dp"
android:id="@+id/img_recipes"
android:paddingRight="5dp"
android:background="@drawable/button_border"
android:contentDescription="@string/title_activity_recipes_ideas" />
— geändert am 18.09.2015, 18:11:34
Empfohlener redaktioneller Inhalt
Mit Deiner Zustimmung wird hier ein externer Inhalt geladen.
Mit Klick auf den oben stehenden Button erklärst Du Dich damit einverstanden, dass Dir externe Inhalte angezeigt werden dürfen. Dabei können personenbezogene Daten an Drittanbieter übermittelt werden. Mehr Infos dazu findest Du in unserer Datenschutzerklärung.