package com.mmad.sales;
import java.util.ArrayList;
import java.util.List;
import com.mmad.sales.CopyOfDailyReport.ViewHolder;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
public class DailyReport extends Activity {
ListView lv;
LocationAdapter locationAdapter;
List<String> day;
List<BeanOutlet> outletList;
Helper helper;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.daily_report);
lv = (ListView) findViewById(R.id.listView1);
helper = new Helper(getApplicationContext());
dailyReport();
}
private void dailyReport() {
outletList = helper.getOutlet();
locationAdapter = new LocationAdapter(this);
lv.setAdapter(locationAdapter);
locationAdapter.setNotifyOnChange(true);
locationAdapter.notifyDataSetChanged();
}
public class ViewHolder {
TextView dayName;
TextView nameOfOutlet;
}
public class LocationAdapter extends ArrayAdapter {
Context context;
public LocationAdapter(Context context) {
super(context, R.layout.daily_report_details, outletList);
this.context = context;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = (LinearLayout) LayoutInflater.from(context)
.inflate(R.layout.daily_report_details, null);
holder = new ViewHolder();
holder.dayName = (TextView) convertView
.findViewById(R.id.textView1);
holder.nameOfOutlet = (TextView) convertView
.findViewById(R.id.textView2);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// holder.dayName.setText(day.get(position));
holder.dayName.setText(outletList.get(position).getOutletCity());
holder.nameOfOutlet.setText(outletList.get(position)
.getOutletName());
return convertView;
}
}
}
import java.util.ArrayList;
import java.util.List;
import com.mmad.sales.CopyOfDailyReport.ViewHolder;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
public class DailyReport extends Activity {
ListView lv;
LocationAdapter locationAdapter;
List<String> day;
List<BeanOutlet> outletList;
Helper helper;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.daily_report);
lv = (ListView) findViewById(R.id.listView1);
helper = new Helper(getApplicationContext());
dailyReport();
}
private void dailyReport() {
outletList = helper.getOutlet();
locationAdapter = new LocationAdapter(this);
lv.setAdapter(locationAdapter);
locationAdapter.setNotifyOnChange(true);
locationAdapter.notifyDataSetChanged();
}
public class ViewHolder {
TextView dayName;
TextView nameOfOutlet;
}
public class LocationAdapter extends ArrayAdapter {
Context context;
public LocationAdapter(Context context) {
super(context, R.layout.daily_report_details, outletList);
this.context = context;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = (LinearLayout) LayoutInflater.from(context)
.inflate(R.layout.daily_report_details, null);
holder = new ViewHolder();
holder.dayName = (TextView) convertView
.findViewById(R.id.textView1);
holder.nameOfOutlet = (TextView) convertView
.findViewById(R.id.textView2);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// holder.dayName.setText(day.get(position));
holder.dayName.setText(outletList.get(position).getOutletCity());
holder.nameOfOutlet.setText(outletList.get(position)
.getOutletName());
return convertView;
}
}
}
No comments:
Post a Comment