i'm trying to call more than one adapter in one of my activity, when i run it, only one adapter running and others doesn't run.. this is my layout :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/medium_gray">
<LinearLayout
android:id="@+id/unitlink1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="#FF0000"
android:text="TRANSAKSI"
android:textStyle="bold"
android:divider="#000000"
android:dividerHeight="1dp"
android:layout_marginTop="8dp"/>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/size10ptWhite3dpBold"
android:layout_width="0dip"
android:layout_weight=".35"
android:gravity="left"
android:orientation="vertical"
android:paddingTop="5dip"
android:paddingBottom="10dip">
<!--Kolom 1-->
<TextView
android:text="Transaksi"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="17sp"
android:paddingTop="10dip"
android:paddingBottom="10dip" />
</LinearLayout>
<!-- Kolom 2 -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/size10ptWhite3dpBold"
android:layout_width="0dip"
android:layout_weight=".35"
android:orientation="vertical"
android:paddingTop="5dip"
android:paddingBottom="10dip" >
<TextView
android:text="Jumlah"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:paddingTop="10dip"
android:paddingBottom="10dip"
android:gravity="center" />
<TextView
android:text="Tanggal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#b5b5b5"
android:textSize="14sp"
android:gravity="center"
android:paddingBottom="10dip"/>
</LinearLayout>
<!-- Kolom 3 -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/size10ptWhite3dpBold"
android:layout_width="0dip"
android:layout_weight=".30"
android:orientation="vertical"
android:paddingTop="5dip"
android:paddingBottom="10dip">
<TextView
android:id="@+id/jumlah_unit"
android:text="Jumlah Unit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:paddingTop="10dip"
android:paddingBottom="10dip"
android:gravity="right"/>
<TextView
android:id="@+id/harga_unit"
android:text="Harga Unit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="#b5b5b5"
android:gravity="right"
android:paddingBottom="10dip"/>
</LinearLayout>
</TableRow>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<include layout="@layout/line"/>
</LinearLayout>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#000000"
android:dividerHeight="1dp"
android:focusable="false"
android:clickable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/unitlink2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/title1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="#FF0000"
android:text="RINGKASAN DANA TRANSAKSI"
android:textStyle="bold"
android:divider="#000000"
android:dividerHeight="1dp"
android:layout_marginTop="8dp"/>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/size10ptWhite3dpBold"
android:layout_width="0dip"
android:layout_weight=".35"
android:gravity="left"
android:orientation="vertical"
android:paddingTop="5dip"
android:paddingBottom="10dip">
<!--Kolom 1-->
<TextView
android:text="Jenis dana Transaksi"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="17sp"
android:paddingTop="10dip"
android:paddingBottom="10dip" />
</LinearLayout>
<!-- Kolom 2 -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/size10ptWhite3dpBold"
android:layout_width="0dip"
android:layout_weight=".35"
android:orientation="vertical"
android:paddingTop="5dip"
android:paddingBottom="10dip" >
<TextView
android:text="Total Unit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:paddingTop="10dip"
android:paddingBottom="10dip"
android:gravity="center" />
<TextView
android:text="Harga Unit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#b5b5b5"
android:textSize="14sp"
android:gravity="center"
android:paddingBottom="10dip"/>
</LinearLayout>
<!-- Kolom 3 -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/size10ptWhite3dpBold"
android:layout_width="0dip"
android:layout_weight=".30"
android:orientation="vertical"
android:paddingTop="5dip"
android:paddingBottom="10dip">
<TextView
android:id="@+id/jumlah_unit1"
android:text="Nilai POLIS"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:paddingTop="10dip"
android:paddingBottom="10dip"
android:gravity="right"/>
<TextView
android:id="@+id/harga_unit1"
android:text="Tanggal NAB"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="#b5b5b5"
android:gravity="right"
android:paddingBottom="10dip"/>
</LinearLayout>
</TableRow>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<include layout="@layout/line"/>
</LinearLayout>
<ListView
android:id="@+id/listview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#000000"
android:dividerHeight="1dp"
android:focusable="false"
android:clickable="false"/>
</LinearLayout>
</LinearLayout>
this is how i call two adapter in one class :
(jenis_link.equals("unit_link")) {
RingkasanUlinkVariabel VarRKS = null;
JSONArray rks_ulink = transaksi.getJSONArray("rks_ulink");
for (int j=0; j<rks_ulink.length();j++){
JSONObject rks = rks_ulink.getJSONObject(j);
VarRKS= new RingkasanUlinkVariabel(rks.optString("lji_invest"),
rks.optString("total_unit"),
rks.optString("harga_unit"),
rks.optString("nilai"),
rks.optString("tgl"));
ListRingkasan.add(VarRKS);
System.out.println("Adam levine");
setContentView(R.layout.unitlinklist);
LinearLayout unitlink1=(LinearLayout)findViewById(R.id.unitlink2);
list=(ListView)findViewById(android.R.id.list);
RingkasanAdapter ringkasan = new RingkasanAdapter(InvestasiViewerEpolicy.this,
ListRingkasan);
list.setAdapter(ringkasan);
}
UnitLinkVariabel VarUnit = null;
JSONArray ulink = transaksi.getJSONArray("ulink");
for (int k=0; k<ulink.length();k++){
JSONObject unit = ulink.getJSONObject(k);
VarUnit= new UnitLinkVariabel(unit.optString("transaksi"),
unit.optString("jumlah"),
unit.optString("tgl_nab"),
unit.optString("jumlah_unit"),
unit.optString("harga_unit"));
ListUnitLink.add(VarUnit);
System.out.println("json parser done harusnya... :D");
setContentView(R.layout.unitlinklist);
LinearLayout unitlink1=(LinearLayout)findViewById(R.id.unitlink1);
list=(ListView)findViewById(android.R.id.list);
TransaksiUnitAdapter unitlink = new TransaksiUnitAdapter(InvestasiViewerEpolicy.this,
ListUnitLink);
list.setAdapter(unitlink);
}
is there any wrong in my code? if yes, can you tell me where's my fault and how to fix it? thank you