2013-04-08 3 views
2

우리는 안드로이드 응용 프로그램을 사용하여 평가자가 사이트에 도착하면 전화를 통해 사무실에 로그인해야합니다. 참조 번호가 있습니다. 전화가 걸려 왔을 때 전화 표시를 계속 유지하고 싶습니다.전화를 걸고 백그라운드로 전화 걸기

다이얼러 화면 상단의 번호를 나타내는 대화 상자가 완벽합니다.

나는이 작업을 시도했지만 다이얼로그를 넘기고 호출 화면을 보여줍니다. 다이얼러를 백그라운드로 밀고 대화 상자를 계속 보여줄 수 있습니까?

는 Heres는 지금까지 무엇을 :

public void makecall(View view){ 
    try { 
     Intent callIntent = new Intent(Intent.ACTION_CALL); 
     callIntent.setData(Uri.parse("tel:NUMBER")); 
     startActivity(callIntent); 
     Toast.makeText(getApplicationContext(), "TEST",Toast.LENGTH_LONG).show(); 
     AlertDialog.Builder adb = new AlertDialog.Builder(this); 
     adb.setTitle("Alert"); 
     adb.setMessage("Client Reference Blah Blah"); 
     adb.setPositiveButton("Ok", new DialogInterface.OnClickListener() { 
      public void onClick(DialogInterface dialog, int id) { 

      } 
     }); 
     adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { 
      public void onClick(DialogInterface dialog, int id) { 
       dialog.cancel(); 
      } 
     }); 
     adb.show();   
    } catch (ActivityNotFoundException activityException) { 
     Throwable e = null; 
     Log.e("helloandroid dialing example", "Callfailed", e); 
    } 
} 
+0

죄송합니다. 누군가 나를위한 편집에서 서식을 수정했습니다. – TMB87

답변

4

난 당신이 통화 화면에서의 정상에 뭔가를 보여주기 위해 활동을 사용할 필요가 있다고 생각합니다. 게시 한이 활동에서 대화를 표시하기 때문에 대화 상자가 작동하지 않지만 통화 활동을 시작하면이 활동이 더 이상 스택 위에 표시되지 않습니다. 당신이 비록 대화처럼 보이게하기 위해 (신규) 활동 스타일을 할 수있는 방법에 대한 Android - How to display a dialog over a native screen?

, 당신이 후하다 같은 시각 효과를 줄 것이다 :

여기에 답변을 참조하십시오.

당신이 그 질문에 표시된 매개 변수를 사용하여 새 작업을 만들 후에는 두 번째 또는 두 개를 만들 것으로 보인다하여 대화 startActivity를을 지연하는 것이 callIntent

public void makecall(View view){ 
    try { 
     Intent callIntent = new Intent(Intent.ACTION_CALL); 
     callIntent.setData(Uri.parse("tel:NUMBER")); 
     startActivity(callIntent); 
     Toast.makeText(this, "TEST",Toast.LENGTH_LONG).show(); 

     Runnable showDialogRun = new Runnable() { 
      public void run(){ 
       Intent showDialogIntent = new Intent(this, DialogActivity.class); 
       startActivity(showDialogIntent); 
      } 
     }; 
     Handler h = new Handler(); 
     h.postDelayed(showDialogRun, 2000); 
    } catch (ActivityNotFoundException activityException) { 
     Throwable e = null; 
     Log.e("helloandroid dialing example", "Callfailed", e); 
    } 
} 

시작한 후 당신은 startActivity를 함께 시작할 수 있습니다 실제로 전화 화면 상단에 튀는 것 같습니다.

+0

안녕하세요, 고마워요. 다른 위치에서 제안을 시도하고 위의 코드를 수행했지만 통화 화면 뒤에 대화 상자가로드 된 다음 통화가 끝나면 대화 상자가 표시됩니다 – TMB87

+0

삼성 은하 s3 – TMB87

+0

그게 내 행동이야. – TMB87

관련 문제