Commit b579c845 authored by Timothé KOBAK's avatar Timothé KOBAK

Call Button

parent 1bbccef5
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import com.example.elbuenopeso.R
......@@ -34,6 +38,16 @@ class AdAdapter(private val context: Context, private val adModelArrayList: List
addressTV.text = ad.address
prixTV.text = "${usingJavaStringFormat(ad.prix, 2)} €"
val bouton: Button =convertView.findViewById(R.id.callButton)
bouton.setOnClickListener {
Log.d("TAG", "TEST")
val callIntent = Intent(Intent.ACTION_DIAL)
callIntent.data = Uri.parse("tel:${ad.num}")
context.startActivity(callIntent)
}
return convertView
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment