Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stop executing a function without exiting the application

Tags:

android

Following is my code:

try 
{
    usrID=client.callString("VerifyUsrnameAndPswd", userName.getText().toString(), password.getText().toString());
}
catch (JSONRPCException e)
{
    Toast.makeText(this, "No internet connection", Toast.LENGTH_LONG).show();           
    Log.e("error", "client.callString exception: "+e.toString());
    e.printStackTrace();
// If this condition is true, then no need to go ahead
}
// some steps of remaining code

I do not want to execute the steps after the catch block, when there is no internet connection. But I don't even want to exit the application. Hence cannot use final().

Please suggest me some function to stop the further execution without exiting the application.

like image 682
Pallavi Avatar asked May 03 '26 14:05

Pallavi


1 Answers

You shoud use continue or break or return in catch block depending where that code is.

like image 66
Mikooos Avatar answered May 05 '26 03:05

Mikooos