Android: Making a phone call from home screen widget

前端 未结 2 778
感情败类
感情败类 2020-12-10 09:15

I have a widget and I want it to make a phonecall to a particular number when the user clicks on the widget. How do i do this? Please help.

2条回答
  •  盖世英雄少女心
    2020-12-10 09:37

        public static Intent newPhoneCallIntent(String phoneNumber){
         Intent callintent = new Intent(Intent.ACTION_DIAL);
         callintent.setData(Uri.parse("tel:"+phoneNumber));
         return callintent;
        }
        startActivity(newPhoneCallIntent("5555555555"));
    

提交回复
热议问题