Created
January 31, 2019 10:43
-
-
Save m7mdra/904989822d634a14cbee7dfebb513db4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseActivity extends AppCompatActivity { | |
private ProgressDialog progressDialog; | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
progressDialog = new ProgressDialog(this); | |
progressDialog.setTitle("Title here"); | |
progressDialog.setMessage("Message here"); | |
} | |
protected void showLoadingDialog() { | |
hideLoadingDialog(); | |
progressDialog.show(); | |
} | |
protected void hideLoadingDialog() { | |
if (progressDialog != null && progressDialog.isShowing()) | |
progressDialog.dismiss(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestActivity extends BaseActivity { | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
showLoadingDialog(); | |
} | |
@Override | |
protected void onStop() { | |
super.onStop(); | |
hideLoadingDialog(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment