Created
September 26, 2018 07:49
-
-
Save isfaaghyth/4c41dfa1954593ba2e7fabbabd875268 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
1. buat layout untuk notif error (contoh: error.xml): | |
<LinearLayout | |
android:id="@+id/layoutError" | |
...> | |
<TextView | |
... | |
android:id="@+id/txtErr" | |
android:text="error!"/> | |
</LinearLayout> | |
2. include kedalam activity_main, misal: | |
<RelativeLayout | |
...> | |
<include layout="@layout/error"/> | |
</RelativeLayout> | |
3. pada baseActivity, lakukan seperti ini, | |
class BaseActivity { | |
protected void onError(String message) { | |
if (layoutError == null) return; | |
layoutError.setVisibility(View.VISIBLE); | |
txtErr.setText(message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment