@Override public void onPause() { super.onPause(); if (mLocationClient != null) { mLocationClient.disconnect(); } }
@Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); setUpLocationClientIfNeeded(); mLocationClient.connect(); if (StatusActivity.IS_FIRST) finish(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.driver_activity_add_supplier); preferenceHelper = new PreferenceHelper(this); mUser = preferenceHelper.getUserInfo(); btn_next = (ImageView) findViewById(R.id.btn_next); btn_minus = (ImageView) findViewById(R.id.btn_minus); btn_plus = (ImageView) findViewById(R.id.btn_plus); btn_next.setOnClickListener(this); btn_minus.setOnClickListener(this); btn_plus.setOnClickListener(this); txt_value_mile = (TextView) findViewById(R.id.txt_value_mile); txt_value_mile.setText(String.valueOf(valueMile)); listView = (ListView) findViewById(R.id.list); adapter = new MyAdapter(); listView.setAdapter(adapter); listView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (position >= 0 && position < mList.size()) { Supplier item = mList.get(position); if (checked.get(item.id) == null) { checked.put(item.id, item); } else { checked.remove(item.id); } adapter.notifyDataSetChanged(); } } }); }