Boa tarde, como eu posso fazer pra popular um json que vem de um webservice, dentro de uma tabela ?, eu já consegui popular em um textfield dessa forma :
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_produto);
AcessoRest ar = new AcessoRest();
String chamadaWS;
chamadaWS = "http://192.168.0.106:8080/Final/webresources/generic/Produto/listar";
String resultado = ar.chamadaGet(chamadaWS);
Log.i(("JSON"),resultado);
try {
JSONObject json = new JSONObject(resultado);
TextView texto = (TextView)findViewById(R.id.texto);
Log.i(texto);
texto.setText(json.getString("descricao"));
}catch (Exception ex){
}
}
Mas dentro de uma tabela, não achei nenhum exemplo, alguém pode dar um norte ?
Código da minha tela
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="1">
<TableRow>
<TextView
a
android:text="Código"
android:padding="3dip" />
<TextView
android:layout_column="1"
android:text="Descrição"
android:padding="3dip" />
<TextView
android:text="Alterar"
android:gravity="right"
android:padding="3dip" />
<TextView
android:text="Excluir"
android:gravity="right"
android:padding="3dip" />
</TableRow>
</TableLayout>
</RelativeLayout>