Ist es möglich den String 1234567890 automatisch auszutauschen?
Vereinfacht gefragt, ist es möglich eine Telefonnummer aus einer Appinternen Datenbank anzurufen?
Folgende Listview habe ich mir aus einem Beispiel geliehen. Dort wird durch Msgbox(Value,"Nummer anrufen") die korrekt Telefonnummer ausgegeben. diese müsst nun auch angerufen werden. Ist das möglich?
Vereinfacht gefragt, ist es möglich eine Telefonnummer aus einer Appinternen Datenbank anzurufen?
B4X:
Call (PhoneNumber As String) As android.content.Intent
Creates an intent that will call a phone number.
Example:
Dim p As PhoneCalls
StartActivity(p.Call("1234567890"))
Folgende Listview habe ich mir aus einem Beispiel geliehen. Dort wird durch Msgbox(Value,"Nummer anrufen") die korrekt Telefonnummer ausgegeben. diese müsst nun auch angerufen werden. Ist das möglich?
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim SQL1 As SQL
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Begin - Change for Database>>>>>>>>>>>>>>>>>>>>>>>>>>
Dim DBFileName As String : DBFileName = "tectum.db"
Dim DBTableName As String : DBTableName = "Tectum1"
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<End - Change for Database>>>>>>>>>>>>>>>>>>>>>>>>>>
' Dim DBFileDir As String : DBFileDir = File.DirInternal
Dim DBFileDir As String : DBFileDir = File.DirRootExternal
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
' Dim btnSearch As Button
Dim ListView1 As ListView
' Dim txtSearch As EditText
Dim ItemSelected As String
Dim btnTelbuch As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
Dim TargetDir As String
If File.ExternalWritable Then TargetDir = File.DirRootExternal Else TargetDir = File.DirInternal
If File.Exists(TargetDir, DBFileName) = False Then
File.Copy(File.DirAssets, DBFileName, TargetDir, DBFileName)
End If
End If
SQL1.Initialize(DBFileDir, DBFileName, True)
Activity.LoadLayout("listviewbb")
Activity.Title = "Listview with Two Columns"
ListViewInit
ListViewFill
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ListViewInit
ListView1.TwoLinesLayout.ItemHeight = 40dip
ListView1.TwoLinesLayout.Label.Left = 0
ListView1.TwoLinesLayout.Label.Width = 50%x
ListView1.TwoLinesLayout.Label.Height = 40dip
ListView1.TwoLinesLayout.Label.Gravity = Gravity.CENTER_VERTICAL + Gravity.CENTER
ListView1.TwoLinesLayout.Label.Color = Colors.Black
ListView1.TwoLinesLayout.Label.TextColor = Colors.White
ListView1.TwoLinesLayout.Label.TextSize = 15
ListView1.TwoLinesLayout.SecondLabel.Top = 0
ListView1.TwoLinesLayout.SecondLabel.Left = 50%x
ListView1.TwoLinesLayout.SecondLabel.Width = 50%x
ListView1.TwoLinesLayout.SecondLabel.Height = 40dip
ListView1.TwoLinesLayout.SecondLabel.Gravity = Gravity.CENTER_VERTICAL + Gravity.CENTER
ListView1.TwoLinesLayout.SecondLabel.Color = Colors.Black
ListView1.TwoLinesLayout.SecondLabel.TextColor = Colors.White
ListView1.TwoLinesLayout.SecondLabel.TextSize = 15
ListView1.FastScrollEnabled = True
End Sub
Sub ListViewFill
Dim txt As String
Dim cur As Cursor
txt = "SELECT Telefon, Name FROM Tectum1 ORDER by Telefon"
ListView1.Clear
cur = SQL1.ExecQuery(txt)
For i = 0 To cur.RowCount - 1
cur.Position = i
ListView1.AddTwoLines(cur.GetString("Telefon"),cur.GetString("Name"))
Next
' cur.Close
End Sub
Sub ListView1_ItemClick (Position As Int, Value As String)
' ItemSelected = Value
Msgbox(Value,"Nummer anrufen")
End Sub
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
End Sub
Sub btnTelbuch_Click
StartActivity(TectumDB)
End Sub
Last edited: