Example #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_measures_list);

    app = (MyExApp) getApplication();
    mAdapter = new MeasuresAdapter(app, this, app.getDataManager().getMeasures(null, null));

    // Click on list
    mListView = (ListView) findViewById(android.R.id.list);
    mListView.setEmptyView(findViewById(android.R.id.empty));
    mListView.setClickable(true);
    mListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) {
            Measure measure = (Measure) mAdapter.getItem(position);
            Intent intent = new Intent(MeasuresActivity.this, MeasuresEditActivity.class);
            intent.putExtra("id", measure.getId());
            startActivityForResult(intent, 0);
          }
        });

    // Fill the list
    mAdapter = new MeasuresAdapter(app, this, app.getDataManager().getMeasures(null, null));
    mListView.setAdapter(mAdapter);
  }
Example #2
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == RESULT_OK) {
     // Re-Fill the list
     mAdapter = new MeasuresAdapter(app, this, app.getDataManager().getMeasures(null, null));
     mListView.setAdapter(mAdapter);
   }
 }
Example #3
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   app = (MyExApp) getActivity().getApplication();
   mAdapter = new DebtorsAdapter(app, getActivity(), app.getDataManager().getDebtors(null, null));
 }