سلام اقا شهاب یعنی خدایی گل کاشتی
ولی برا من کار نمیکنه(داخل نمایش متن)
این کدهام
activity main
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("list")
If File.Exists(File.DirInternal,"db.db") = False Then
File.Copy(File.DirAssets,"db.db",File.DirInternal,"db.db")
End If
If sql.IsInitialized = False Then
sql.Initialize(File.DirInternal,"db.db",True)
End If
cur = sql.ExecQuery("SELECT * FROM mytbl")
For i = 0 To cur.RowCount - 1
cur.Position = i
ListView1.AddSingleLine(cur.GetString("title"))
Next
If ListView1.Size = 0 Then
Msgbox("اطلاعاتی برای نمایش وجود ندارد.","سلام.توجه!!!")
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
If EditText1.Text = "" Or EditText2.Text = "" Then
ToastMessageShow("متنی وارد نشده است",False)
Else
Dim a As Int
a = Msgbox2("از اضافه کردن اطلاعات مطمئن هستید؟؟؟???","توجه!!","بله","","خیر",Null)
If a = DialogResponse.POSITIVE Then
sql.ExecNonQuery("INSERT INTO mytbl (id,title,content) VALUES (null,'"& EditText1.Text &"','"& EditText2.text &"')")
ToastMessageShow("ثبت شد",False)
ListView1.Clear
cur = sql.ExecQuery("SELECT * FROM mytbl")
For i = 0 To cur.RowCount - 1
cur.Position = i
ListView1.AddSingleLine(cur.GetString("title"))
Next
End If
End If
End Sub
Sub ListView1_ItemClick (Position As Int, Value As Object)
meghdar = Value
StartActivity(content)
End Sub
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
Dim a As Int
a = Msgbox2("از حذف اطلاعات مطمئن هستید؟؟؟؟","توجه","بله","","خیر",Null)
If a = DialogResponse.POSITIVE Then
sql.ExecNonQuery("DELETE FROM mytbl WHERE id = '"& Value &"'")
ToastMessageShow("حذف شد.",False)
ListView1.Clear
cur = sql.ExecQuery("SELECT * FROM mytbl")
For i = 0 To cur.RowCount - 1
cur.Position = i
ListView1.AddSingleLine(cur.GetString("title"))
Next
End If
End Sub
activity content
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim id As Int
Private Label1 As Label
Private EditText1 As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("label")
id = Main.meghdar
Main.cur = Main.sql.ExecQuery("SELECT * FROM mytbl WHERE id = " & id)
Main.cur.Position = 0
EditText1.Text = Main.cur.GetString("content")
End Sub