확인 버튼을 클릭하면 전화를 걸고 싶습니다. 지금은 오류가 점점 오전android fragment class에서 전화를 거는 방법?
오류 메시지가 여기에
12-23 17:19:39.547: E/AndroidRuntime(4095): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.CALL dat=91 90-37-300100 flg=0x10000000 }
내 코드
public class ContactFragment extends Fragment {
private View parentView;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//return inflater.inflate(R.layout.contact, container, false);
parentView = inflater.inflate(R.layout.contact, container, false);
setUpViews();
return parentView;
}
private void setUpViews() {
parentView.findViewById(R.id.contact_phone).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
// Creating alert Dialog with two Buttons
AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
// Setting Dialog Title
alertDialog.setTitle("Do you want to call?");
// Setting Dialog Message
alertDialog.setMessage("+91 XXXXXXXXXX");
// Setting Icon to Dialog
//alertDialog.setIcon(R.drawable.warning);
// Setting Negative "NO" Button
alertDialog.setNegativeButton("No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
// Write your code here to execute after dialog
dialog.cancel();
}
});
// Setting Positive "Yes" Button
alertDialog.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
// Write your code here to execute after dialog
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("91 XXXXXXXXXX"));
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(callIntent);
}
});
// Showing Alert Message
alertDialog.show();
}
});
} }
감사합니다. –