我正在尝试从 DialogFragment 拨打电话,但 (packageManager) 不接受如何解决它?!
class ItemDetkFragment : DialogFragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
val v: View= inflater.inflate(R.layout.fragment_item_detk, container, false)
v.car_typee.text= car_item.type
v.item_typee.text= car_item.item_type
v.modele.text= car_item.modele
v.pricee.text= car_item.price+ " JD"
if (car_item.number> 0) {
v.numberr.text= "available"
v.numberr.setTextColor(Color.GREEN)
} else {
v.numberr.text= "Not available"
v.numberr.setTextColor(Color.RED)
}
Picasso.with(activity).load(car_item.picUrl).into(v.photo)
v.contactPhone.setOnClickListener {
val phoneNum = "855394839583"// the number for testing
val i = Intent(Intent.ACTION_DIAL)
i.data = Uri.parse("tel:$phoneNum")
if (i.resolveActivity(packageManager) …Run Code Online (Sandbox Code Playgroud)