예제 #1
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_welcome);
   if (getIntent().getBooleanExtra("EXIT", false)) {
     finish();
   }
 }
예제 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    DatabaseHelper myDB = new DatabaseHelper(this);

    // Acquire a reference to the system Location Manager
    mLocationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);

    // Define a listener that responds to location updates
    LocationListener locationListener =
        new LocationListener() {
          public void onLocationChanged(Location location) {
            // Called when a new location is found by the network location provider.
            // makeUseOfNewLocation(location);
            mGPSLocation = location.toString();
          }

          public void onStatusChanged(String provider, int status, Bundle extras) {}

          public void onProviderEnabled(String provider) {}

          public void onProviderDisabled(String provider) {}
        };

    // Register the listener with the Location Manager to receive location updates
    mLocationManager.requestLocationUpdates(
        LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);

    final EditText phoneNumber = (EditText) findViewById(R.id.editText);
    final Button button = (Button) findViewById(R.id.button);
    button.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            plantMine(phoneNumber.getText().toString());
          }
        });
  }