Android Open Source - EarthquakeAPIViewer Display Earthquake Activity

From Project

Back to project page EarthquakeAPIViewer.


The source code is released under:

Apache License

If you think the Android project EarthquakeAPIViewer 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 com.example.earthquakeapiviewer;
//  w  ww  .java2 s.  c  o  m
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class DisplayEarthquakeActivity extends ActionBarActivity {

  protected void onCreate(Bundle savedInstanceState) {

    Earthquake eq = (Earthquake) getIntent().getSerializableExtra("Earthquake");
    TextView location_tv = (TextView)findViewById(;
    TextView date_tv = (TextView)findViewById(;
    TextView magnitude_tv = (TextView)findViewById(;
    TextView depth_tv = (TextView)findViewById(;
    depth_tv.setText(String.format("%sft", eq.depth));
    TextView source_tv = (TextView)findViewById(;

  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(, menu);
    return true;

  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();
    if (id == {
      return true;
    return super.onOptionsItemSelected(item);

Java Source Code List