Can someone tell me why the Listview is not showing up? I call the items from a CustomAdapter and its string from object class. It will show multiple return from web in a listview. Here's my code including the custom adapater.
public class ClaimVoucherDetailsActivity extends FragmentActivity implements OnClickListener{
ArrayList<VoucherObj> items;
Button claimVoucher;
EditText etEmail,etVoucherCode;
TextView tvName,tvEmail,tvVoucherCode,tvIssueBranch,tvDateIssued,tvExpiration,tvStatus,tvVoucherSource;
String sName,sEmail,sVoucher,sIssueBranch,sDateIssued,sExpiration,sStatus,sVoucherName,sCustomerID,sType,empID,branch,brID;
ImageLoader imageLoader;
DisplayImageOptions options;
ImageView voucher;
Spinner spinEmployee;
SQLiteAdapter mysqlAdapter;
ProgressDialog progressDialog;
VoucherObj vouch;
private ClaimVoucherAdapter m_adapter;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.voucher_details);
imageLoader = ImageLoader.getInstance();
ImageLoaderConfig();
options = new DisplayImageOptions.Builder()
.showStubImage(R.drawable.ic_launcher)
.showImageForEmptyUri(R.drawable.ic_launcher)
.cacheInMemory()
.cacheOnDisc()
.build();
mysqlAdapter = new SQLiteAdapter(ClaimVoucherDetailsActivity.this);
mysqlAdapter.openToRead();
branch = mysqlAdapter.getValue("SELECT branch from branch_tb");
brID = mysqlAdapter.getValue("SELECT ID from branch_tb where branch = '"+branch+"'");
TextView branchTV = (TextView)findViewById(R.id.branch);
branchTV.setText(branch);
Intent intent = this.getIntent();
sCustomerID = intent.getStringExtra("customerID").trim();
sType = intent.getStringExtra("type").trim();
sName = intent.getStringExtra("name").trim();
sEmail = intent.getStringExtra("email").trim();
sVoucher = intent.getStringExtra("voucher").trim();
sIssueBranch = intent.getStringExtra("branch").trim();
sDateIssued = intent.getStringExtra("issued").trim();
sExpiration = intent.getStringExtra("expiration").trim();
sStatus = intent.getStringExtra("status").trim();
sVoucherName = intent.getStringExtra("vouchername").trim();
String employ = intent.getStringExtra("employeeid").trim();
ListView lstitems = (ListView) this.findViewById(R.id.listView1);
items = new ArrayList<VoucherObj>();
vouch = new VoucherObj();
items.add(vouch);
m_adapter = new ClaimVoucherAdapter(ClaimVoucherDetailsActivity.this,R.layout.list, items);
lstitems.setAdapter(m_adapter);
Voucher Class
public class VoucherObj {
public String customerID="";
public String type="";
public String name="";
public String email="";
public String voucher="";
public String branch="";
public String issued = "";
public String expiration="";
public String status = "";
public String vouchername = "";
public String employeeid = "";
}
Adapter Class
public class ClaimVoucherAdapter extends ArrayAdapter<String> {
private ArrayList<VoucherObj> items;
private LayoutInflater vi;
TextView tvName,tvEmail,tvVoucherCode,tvIssueBranch,tvDateIssued,tvExpiration,tvStatus,tvVoucherSource;
public ClaimVoucherAdapter(Context context, int textViewResourceId, ArrayList<VoucherObj> myList) {
super(context, textViewResourceId);
this.items = myList;
vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
final VoucherObj i = items.get(position);
if (i != null) {
final VoucherObj ei = (VoucherObj)i;
v = vi.inflate(R.layout.voucher_details, null);
tvName = (TextView) v.findViewById(R.id.tvName);
tvEmail = (TextView)v.findViewById(R.id.tvEmail);
tvVoucherCode = (TextView)v.findViewById(R.id.tvVoucherCode);
tvIssueBranch = (TextView)v.findViewById(R.id.tvIssuingBranch);
tvDateIssued = (TextView)v.findViewById(R.id.tvDateIssued);
tvExpiration = (TextView)v.findViewById(R.id.tvExpirationDate);
tvStatus = (TextView)v.findViewById(R.id.tvStatus);
tvVoucherSource = (TextView)v.findViewById(R.id.tvVoucherSource);
tvName.setText(items.get(position).toString());
tvEmail.setText(items.get(position).toString());
tvVoucherCode.setText(items.get(position).toString());
tvIssueBranch.setText(items.get(position).toString());
tvDateIssued.setText(items.get(position).toString());
tvExpiration.setText(items.get(position).toString());
tvStatus.setText(items.get(position).toString());
tvVoucherSource.setText(items.get(position).toString());
}
return v;}}