Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this one, it has helped me.</p> <pre><code>public class AndroidList extends ListActivity { public class MyCustomAdapter extends ArrayAdapter&lt;String&gt; { public MyCustomAdapter(Context context, int textViewResourceId, String[] objects) { super(context, textViewResourceId, objects); // TODO Auto-generated constructor stub } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub //return super.getView(position, convertView, parent); View row = convertView; if(row==null){ LayoutInflater inflater=getLayoutInflater(); row=inflater.inflate(R.layout.row, parent, false); } TextView label=(TextView)row.findViewById(R.id.weekofday); label.setText(month[position]); ImageView icon=(ImageView)row.findViewById(R.id.icon); if (month[position]=="December"){ icon.setImageResource(R.drawable.icon); } else{ icon.setImageResource(R.drawable.icongray); } return row; } } String[] month = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); /*setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.row, R.id.weekofday, DayOfWeek));*/ setListAdapter(new MyCustomAdapter(AndroidList.this, R.layout.row, month)); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { // TODO Auto-generated method stub //super.onListItemClick(l, v, position, id); String selection = l.getItemAtPosition(position).toString(); Toast.makeText(this, selection, Toast.LENGTH_LONG).show(); } } </code></pre> <p>found here: <a href="http://android-er.blogspot.com/2010/06/using-convertview-in-getview-to-make.html" rel="nofollow noreferrer">http://android-er.blogspot.com/2010/06/using-convertview-in-getview-to-make.html</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload