private void loadTabsIfGPSAndInternetAvailable()
{
final Utils utils = new Utils(this);
final LocationClient locationClient = new LocationClient(this);
if (!utils.isConnected())
{
utils.generateNoConnectivityAlert();
}
else if (!locationClient.hasGPS())
{
utils.generateNoGPSAlert();
}
else
{
if (androidVersion >= Build.VERSION_CODES.M)
{
requestAllPermissions();
}
else
{
loadCameraAndForecastTabs();
}
} // ends else block for if internet and GPS are enabled
}
This is some code that loads tabs if the GPS and internet connectivity are available. I'm aware that at the moment this is very messy code, with lots of nested if statements, that is hard to read, and am not sure how to structure it better. Can people help me please?