The code does not give error, it shows in design mode, but does not appear the Listview
populated. I'm using the example set up on the link
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/listada"
android:layout_width="380dp"
android:layout_height="330dp"
android:layout_marginTop="148dp"
/>
</RelativeLayout>
</GridLayout>
public class ResultadosActivity extends Activity {
@Override
public void onCreate(Bundle savedInstance) {
super.onCreate(savedInstance);
setContentView(R.layout.resultados);
ListView lista = (ListView) findViewById(R.id.lista); //listada no real
String[] strings = new String[] { "nome1", "nome2", "nome3", "nome4" };
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,strings);
lista.setAdapter(adapter);
}
}
results.xml , an illustrative XML that supports this view:
<LinearLayout>
<ListView
android:id="@+id/lista" />
</LinearLayout>
These two sections