Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Dialog alertDialog;
- alertDialog = incomingCallDialog(VoiceActivity.this, activeCallInvite, answerCall(), cancelCall());
- alertDialog.show();
- public Dialog incomingCallDialog(final Context context, CallInvite callInvite, View.OnClickListener answerCall, View.OnClickListener cancelCall) {
- final Dialog dialog = new Dialog(context, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
- dialog.setContentView(R.layout.custom_dailog);
- TextView tv_from = (TextView) dialog.findViewById(R.id.tv_from);
- FloatingActionButton accept = (FloatingActionButton) dialog.findViewById(R.id.btn_accept);
- FloatingActionButton reject = (FloatingActionButton) dialog.findViewById(R.id.btn_reject);
- tv_from.setText("Your Custom Text");
- accept.setOnClickListener(answerCall);
- reject.setOnClickListener(cancelCall);
- return dialog;
- }
- private View.OnClickListener answerCall() {
- return new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- alertDialog.dismiss();
- // do your suff...
- }
- };
- }
- private View.OnClickListener cancelCall() {
- return new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- alertDialog.dismiss();
- // do your suff...
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement