Ejemplo n.º 1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
      return true;
    }
    if (id == R.id.action_update) {
      manager_.sendAsyncTracksRequest();
      return true;
    }

    return super.onOptionsItemSelected(item);
  }
Ejemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    listView_ = (ListView) this.findViewById(R.id.track_list);

    manager_.getTracks();

    listView_.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Log.v("Position", Integer.toString(position));
            int itemId = previews_.get(position).getId_();

            Intent intent = new Intent(TracksActivity.this, MapActivity.class);
            intent.putExtra("SelectedItemId", itemId);
            startActivity(intent);
          }
        });
  }