Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. public class callActivity extends AppCompatActivity {
  2.  
  3. Button acceptCall;
  4. Button delinceCall;
  5.  
  6. @Override
  7. protected void onCreate(Bundle savedInstanceState) {
  8. super.onCreate(savedInstanceState);
  9. setContentView(R.layout.activity_call);
  10.  
  11. Window window = getWindow();
  12. window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
  13. | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
  14. | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  15.  
  16. acceptCall = findViewById(R.id.answer_call_btn);
  17. delinceCall = findViewById(R.id.reject_call_btn);
  18. try {
  19. Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
  20. Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
  21. r.play();
  22. } catch (Exception e) {
  23. e.printStackTrace();
  24. }
  25. acceptCall.setOnClickListener(new View.OnClickListener() {
  26. @Override
  27. public void onClick(View view) {
  28. sendToVideoCall();
  29. }
  30. });
  31. }
  32.  
  33. private void sendToVideoCall() {
  34. Intent mainIntent = new Intent(callActivity.this, videoCallActivity.class);
  35. startActivity(mainIntent);
  36. finish();
  37. }
  38.  
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement