Life and Times
- While it is running, click the green phone button on the emulator
(lower-left corner of the "phone"). This will bring up the call log
activity and, as a result, pause our LunchList activity.
- After a while, click the BACK button – you should see the LunchList
resuming the background work from the point where it left off.
Here is the full LunchList implementation, including the changes shown
above:
package apt.tutorial;
import android.app.TabActivity;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.LayoutInflater;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RadioGroup;
import android.widget.TabHost;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
public class LunchList extends TabActivity {
List<Restaurant> model=new ArrayList<Restaurant>();
RestaurantAdapter adapter=null;
EditText name=null;
EditText address=null;
EditText notes=null;
RadioGroup types=null;
Restaurant current=null;
AtomicBoolean isActive=new AtomicBoolean(true);
int progress= 0 ;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_PROGRESS);