Check out example codes for "Alerter for java". It will help you in understanding the concepts better.

Code Example 1

implementation 'com.tapadoo.android:alerter:2.0.4'
  
  Alerter.create(BaseActivity.this)
                .setTitle("Alert Title")
                .setText("Alert Text")
                .setIcon(R.drawable.ic_twotone_notifications_active_24)
                .setBackgroundColorRes(R.color.colorAccent)
                .setDuration(5000)
                .enableSwipeToDismiss() //seems to not work well with OnClickListener
                .enableProgress(true)
                .setProgressColorRes(R.color.colorPrimary)
                .show();

Learn ReactJs, React Native from akashmittal.com