Android Open Source - CompiBus Search Result Activity






From Project

Back to project page CompiBus.

License

The source code is released under:

GNU General Public License

If you think the Android project CompiBus listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.cuju.buscompiegne;
/*from w  w  w  .  j  av  a 2  s. c  om*/
import java.util.ArrayList;

import org.cuju.buscompiegne.R;

import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class SearchResultActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_result);
    setupActionBar();
    
    String stop = getIntent().getStringExtra("stop");
    String dest = getIntent().getStringExtra("dest");
    
    this.setTitle(stop + " > " + dest);
    
    ListView lv = (ListView) findViewById(R.id.result_list);
        ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, 
            //BusDatabaseQuery.timetable(this, stop,dir));
            BusDatabaseQuery.search(this, stop,dest));
        lv.setAdapter(arrayAdapter); 
  }

  /**
   * Set up the {@link android.app.ActionBar}, if the API is available.
   */
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  private void setupActionBar() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      getActionBar().setDisplayHomeAsUpEnabled(true);
    }
  }


  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
      NavUtils.navigateUpFromSameTask(this);
      return true;
    }
    return super.onOptionsItemSelected(item);
  }

}




Java Source Code List

org.cuju.buscompiegne.BusDatabaseQuery.java
org.cuju.buscompiegne.SearchActivity.java
org.cuju.buscompiegne.SearchResultActivity.java