전화를 사용하는 앱을 만들었지 만 버튼 클릭이 발생하지 않으면 데이터베이스에 번호가 저장되는 문제가 발생합니다. 당신이 공백을 추가하기 때문에데이터베이스에서 숫자
final TextView txt_alamat = (TextView) dialog.findViewById(R.id.textView_alamat);
txt_alamat.setText(listData.get(position).getno_telp());
nomor = String.format("tel :", txt_alamat.getText().toString().trim());
Button btn_call = (Button) dialog.findViewById(R.id.button_telpon);
btn_call.setText(listData.get(position).getno_telp());
btn_call.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent TelpIntent = new Intent(Intent.ACTION_CALL, Uri.parse(String.valueOf(Uri.parse("tel :"+nomor))));
TelpIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (ActivityCompat.checkSelfPermission(Telp_guru_Activity.this,
android.Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
return;
} else {
Log.e(TAG,"error");
}
startActivity(TelpIntent);
}
});
아직 오류가 있습니다. "tel"bur가 작동하지 않습니다. –