This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package course.examples.Sensors.ShowValues; | |
| import android.app.Activity; | |
| import android.hardware.Sensor; | |
| import android.hardware.SensorEvent; | |
| import android.hardware.SensorEventListener; | |
| import android.hardware.SensorManager; | |
| import android.os.Bundle; | |
| import android.widget.TextView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package course.examples.Location.GetLocation; | |
| import java.text.SimpleDateFormat; | |
| import java.util.Date; | |
| import java.util.List; | |
| import java.util.Locale; | |
| import java.util.concurrent.Executors; | |
| import java.util.concurrent.TimeUnit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mAdapter = new PlaceViewAdapter (getApplicationContext()); | |
| ListView listview = getListView(); | |
| listview.setAdapter(mAdapter); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TextView footer = (TextView) getLayoutInflater().inflate(R.layout.footer_view, null); | |
| listView.addFooterView(footer); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ***basic onCreate | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.main); | |
| *** | |
| //onCreate, with adapters and adding view |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Use the Extends keyword to extend from superclass. | |
| class MountainBike extends Bicycle { | |
| // new fields and methods defining | |
| // a mountain bike would go here | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface Bicycle { | |
| // wheel revolutions per minute | |
| void changeCadence(int newValue); | |
| void changeGear(int newValue); | |
| void speedUp(int increment); | |
| void applyBrakes(int decrement); | |
| } | |
| class ACMEBicycle implements Bicycle { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Import util random class | |
| import java.util.Random; | |
| //Sample method for a buttons on click listener. | |
| @Override | |
| public void onClick(View v) { | |
| //Create a new instance of a Random Object | |
| Random r = new Random(); | |
| //Create a var 'val' to hold the new random number |