1
我跟着這個線索找到的代碼,How to make a phone call in android and come back to my activity when the call is done?爲什麼我的應用程序不能打電話?
我的代碼如下:
當按下按鈕:
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("1337"));
我還添加了
android:name="android.permission.CALL_PHONE"> to user permissions
但沒有任何反應當我按下按鈕時。
沒有不行。我查了一些其他線程,並在他們中,他們必須開始活動和東西..我需要這樣做嗎?我挑剔這個代碼,因爲它是最短的,但它不起作用。 – jojo 2014-10-12 12:28:40
這是我現在的按鈕代碼:button.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse(「 telnet「+5554」));} }); – jojo 2014-10-12 12:30:09
當然,你必須通過intent來啓動「Call Activity」,否則你不會準備一個intent,你會錯過像'getApplicationContext()。startActivity(intent) ;'不要忘記** tel **和你的號碼 – 2014-10-12 12:30:24