Note that there are some explanatory texts on larger screens.

plurals
  1. POAbout android lifecycle
    primarykey
    data
    text
    <p>I read about the android activity's life cycle from here <a href="http://developer.android.com/guide/components/activities.html" rel="nofollow">Dev guide</a>. Now i have confusions that which part of code resides in which method, like onCreate, onStart, onResume, onRestart, onPause, onResume, onStop and onDestroy. Can you help me to put them in right place. Also the tracking should continue even when the application is minimized. I have the following code.</p> <pre><code>public class MainActivity extends FragmentActivity implements LocationListener { //List of user defined variables @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /*for now i have kept everything in onCreate method * i have start and stop button to start the tracking and stop the tracking and show the distance of travel 1. Checking whether GPS is on or OFF 2. button = (ImageButton) findViewById(R.id.myButton); 3. Code to load the Google map 4. Now specified what start and stop button does. i. when i press start button it starts overlaying the path in the map and calculate distance travelled so far ii. when i press stop button it stops tracking and shows the details of final result in next activity. LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 2, this); */ } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } @Override public void onLocationChanged(Location arg0) { // TODO Auto-generated method stub //i hace code for tracking and overlaying here } @Override public void onProviderDisabled(String arg0) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String arg0) { // TODO Auto-generated method stub } @Override public void onStatusChanged(String arg0, int arg1, Bundle arg2) { // TODO Auto-generated method stub } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload