Android Open Source - sdl_tester_android Sdl Image Adapter

From Project

Back to project page sdl_tester_android.


The source code is released under:

Copyright (c) 2014, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are m...

If you think the Android project sdl_tester_android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.livio.sdl.adapters;
// w w w . j a  va 2 s  .c o m
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.livio.sdl.R;
import com.livio.sdl.SdlImageItem;

public class SdlImageAdapter extends ArrayAdapter<SdlImageItem> {

  public SdlImageAdapter(Context context, List<SdlImageItem> objects) {
    super(context, R.layout.simple_listview_with_image, objects);

  public SdlImageAdapter(Context context) {
    super(context, R.layout.simple_listview_with_image);

  public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    if(convertView == null){
      LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      view = inflater.inflate(R.layout.simple_listview_with_image, null);
    SdlImageItem item = getItem(position);
    if(item != null){
      populateView(view, item);
    return view;
   * Populate the input parent view with information from the SDL log message.
   * @param view The view to populate
   * @param item The data with which to populate the view
  private void populateView(View view, SdlImageItem item){
    ImageView iv_image = (ImageView) view.findViewById(;
    TextView tv_text = (TextView) view.findViewById(;

Java Source Code List