I am working on an Android app, that needs to be connected to the internet in order to work(to populate a listView). So obviously, when i enter in it, i check to see if there is a connection (this linked helped me in that way : Display an alert when internet connection not available in android application).
If there isn't a connection, an alertDialog appears, telling the user to either quit the app, or to go to settings and enable network access. So after the user enables that and comes back, i would basically need to run the code that needed the access... My question is...where should I put the code from the if clause from below ? In onResume() or in onRestart ?
This is the code that i have until now:
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (checkNetworkStatus()){
            System.out.println("i have internet !!!!!!!!");
        overridePendingTransition(R.anim.slide_left,R.anim.fade);
        setContentView(R.layout.activity_start);
        handler = new Handler();
        Button newOrderButton = (Button) findViewById(R.id.new_order_button);
        newOrderButton.setOnClickListener(newOrderListener);
        Button previousOrderButton = (Button) findViewById(R.id.previous_orders_button);
        previousOrderButton.setOnClickListener(previousOrderListener);
    } else {
        System.out.println("I don't have internet !!!!!!!!");
            AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(Start.this);
            .........
   }
 
     
    