Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>And finally, I can find the solution it would be. I'm going to tell you how I did.</p> <p>I wanted to display details customer by this way:</p> <ol> <li>row 1-> Name: name_value </li> <li>row 2-> Last Name: lastname_value</li> <li>row 3-> Phone: phone_value ...</li> </ol> <p>N. n row -> n_field: n_value</p> <p>Fields that describe what value is going to show, i mean "Name:", "Last Name:", "Phone:", ... I put all this values on a <i> string-array </i>. I captured that by a <i> String [] </i>.</p> <p>Values, show proper value next the correct field. I put all this inside a ArrayList and next only have to write the proper adapter:</p> <p>This Activity inherit <em>ListActivity</em>, <em>ListView</em> by default.</p> <p><strong>SimpleCursorAdapter</strong> is not proper because we have to pass the cursor as argument of this adapter but my Cursor only returns <i> only one result, only one record </i>.</p> <p>And <strong>CursorAdapter</strong> is refused by the same reason. What can I do next? <b> ArrayAdapter </b>:</p> <pre><code>public class DetalleClienteAdapter extends ArrayAdapter&lt;String&gt; { private String[] campos_cliente; private ArrayList&lt;String&gt; detalles_cliente; public DetalleClienteAdapter(Context contexto, int layout, ArrayList&lt;String&gt; detalles) { super(contexto,layout,detalles); //mInflater = LayoutInflater.from(contexto); // LOS VALORES DE LOS CAMPOS: detalles_cliente = detalles; // CAMPOS DE DETALLES: nombre, apellidos, etc... android.content.res.Resources res = getResources(); campos_cliente = res.getStringArray(R.array.array_detalle_cliente); } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub //return super.getView(position, convertView, parent); LayoutInflater inflater= getLayoutInflater(); View fila = inflater.inflate(R.layout.detalles_cliente, parent, false); TextView campo =(TextView)fila.findViewById(R.id.detalles_campo); TextView valor =(TextView)fila.findViewById(R.id.detalles_valor); campo.setText(campos_cliente[position]); valor.setText(detalles_cliente.get(position)); return fila; } } </code></pre> <p>Now I'm going to write a more efficient adapter, with ViewHolder. What is your opinion about that?</p> <p>Thanks.</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. This table or related slice is empty.
    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