Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Adapter extends BaseAdapter{
- private static LayoutInflater inflater=null;
- private static String [] placename;
- @SuppressWarnings("static-access")
- public StayAdapter(Activity a, String [] placename)
- {
- this.placename = placename;
- inflater = (LayoutInflater)a.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- }
- @Override
- public int getCount() {
- // TODO Auto-generated method stub
- return placename.length;
- }
- @Override
- public Object getItem(int position) {
- // TODO Auto-generated method stub
- return position;
- }
- @Override
- public long getItemId(int position) {
- // TODO Auto-generated method stub
- return position;
- }
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- // TODO Auto-generated method stub
- View vi=convertView;
- if(convertView==null)
- vi = inflater.inflate(R.layout.staylist, null);
- TextView namee = (TextView)vi.findViewById(R.id.name);
- namee.setText(placename[position]);
- int height = convertView.getHeight();[Null pointer exception here]
- return vi;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment