Commit d7ce9e22 authored by Alutulu's avatar Alutulu

add num to dbapdapter

parent 4cd4994f
...@@ -33,6 +33,7 @@ class DbAdapter(context: Context, c: Cursor, layout: Int): CursorAdapter(context ...@@ -33,6 +33,7 @@ class DbAdapter(context: Context, c: Cursor, layout: Int): CursorAdapter(context
val address: String = cursor.getString(cursor.getColumnIndexOrThrow(DBHelper.ADDRESS)) val address: String = cursor.getString(cursor.getColumnIndexOrThrow(DBHelper.ADDRESS))
val prix: Double = cursor.getDouble(cursor.getColumnIndexOrThrow(DBHelper.PRIX)) val prix: Double = cursor.getDouble(cursor.getColumnIndexOrThrow(DBHelper.PRIX))
val image: String = cursor.getString(cursor.getColumnIndexOrThrow(DBHelper.IMAGE)) val image: String = cursor.getString(cursor.getColumnIndexOrThrow(DBHelper.IMAGE))
val num: String = cursor.getString(cursor.getColumnIndexOrThrow(DBHelper.NUM))
titleTextView.text = title titleTextView.text = title
addressTextView.text = address addressTextView.text = address
...@@ -44,7 +45,7 @@ class DbAdapter(context: Context, c: Cursor, layout: Int): CursorAdapter(context ...@@ -44,7 +45,7 @@ class DbAdapter(context: Context, c: Cursor, layout: Int): CursorAdapter(context
Bouton.setOnClickListener { Bouton.setOnClickListener {
Log.d("TAG", "TEST") Log.d("TAG", "TEST")
val callIntent = Intent(Intent.ACTION_DIAL) val callIntent = Intent(Intent.ACTION_DIAL)
callIntent.data = Uri.parse("tel:${Cursor.num}") callIntent.data = Uri.parse("tel:$num")
context.startActivity(callIntent) context.startActivity(callIntent)
} }
} }
......
...@@ -14,6 +14,7 @@ class DBHelper(context: Context) : SQLiteOpenHelper(context, DB_NAME, null, DB_V ...@@ -14,6 +14,7 @@ class DBHelper(context: Context) : SQLiteOpenHelper(context, DB_NAME, null, DB_V
const val ADDRESS = "address" const val ADDRESS = "address"
const val IMAGE = "image_url" const val IMAGE = "image_url"
const val PRIX = "price" const val PRIX = "price"
const val NUM = "123456789"
private const val DB_NAME = "LEBONCOIN.DB" private const val DB_NAME = "LEBONCOIN.DB"
private const val DB_VERSION = 1 private const val DB_VERSION = 1
......
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