سلام دوستان این کد من هست که از قسمت اینیشیالایز کردن پرداختم ایراد "java.lang.nullpointerexception" میگیره
#Region Activity Attributes
#FullScreen: true
#IncludeTitle: false
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
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 pardakht As BillingManager_b4a_org
Dim key As String = "rsa کلید"
Private Label2 As Label
Private Panel1 As Panel
Private spinner1 As Spinner
Private listview1 As ListView
Private id1 As Label
Dim sql2 As SQL
Dim cur2 As Cursor
Dim paye(5) As String
Dim gr As String
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("Lbiling")
pardakht.Initialize("pardakht" , key)
paye(0) = "کاردانی پیوسته"
paye(1) = "کاردانی ناپیوسته"
paye(2) = "کارشناسی پیوسته"
paye(3) = "کارشناسی ناپیوسته"
paye(4) = "کارشناسی ارشد"
spinner1.AddAll(paye)
If File.Exists(File.DirInternal , "biling.db") = False Then
File.Copy(File.DirAssets ,"biling.db" , File.DirInternal , "biling.db")
End If
sql2.Initialize(File.DirInternal ,"biling.db" , True)
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If ( KeyCode = KeyCodes.KEYCODE_BACK) Then
Dim msgres As Int
msgres = Msgbox2("چه عملی انجام شود؟" , "" , "صفحه قبل" , "منوی اصلی" , "" , Null)
If msgres = DialogResponse.POSITIVE Then
Activity.Finish
StartActivity(Lgrade)
Else
Activity.Finish
StartActivity(Main)
End If
End If
End Sub
Sub spinner1_ItemClick (Position As Int, Value As Object)
Dim b As Int
listview1.SingleLineLayout.Label.Typeface = Typeface.LoadFromAssets("mak.ttf")
listview1.SingleLineLayout.Label.TextColor = Colors.White
listview1.SingleLineLayout.Label.Gravity = Gravity.CENTER
Select Case Value
Case "کاردانی پیوسته"
gr = "کاردانی پیوسته"
listview1.Clear
cur2 = sql2.ExecQuery("Select * from bil where grade ='kardani'")
For i = 0 To cur2.RowCount - 1
cur2.Position = i
b = b + 1
listview1.AddSingleLine2(cur2.GetString("esm") , b)
Next
Case "کاردانی ناپیوسته"
gr = "کاردانی ناپیوسته"
listview1.Clear
cur2 = sql2.ExecQuery("Select * from bil where grade = 'nkardani'")
For i = 0 To cur2.RowCount - 1
cur2.Position = i
b = b + 1
listview1.AddSingleLine2(cur2.GetString("esm") , b)
Next
Case "کارشناسی پیوسته"
gr = "کارشناسی پیوسته"
listview1.Clear
cur2 = sql2.ExecQuery("Select * from bil where grade = 'karshenasi'")
For i = 0 To cur2.RowCount - 1
cur2.Position = i
b = b + 1
listview1.AddSingleLine2(cur2.GetString("esm") , b)
Next
Case "کارشناسی ناپیوسته"
gr = "کارشناسی ناپیوسته"
listview1.Clear
cur2 = sql2.ExecQuery("Select * from bil where grade = 'nkarshenasi'")
For i = 0 To cur2.RowCount - 1
cur2.Position = i
b = b + 1
listview1.AddSingleLine2(cur2.GetString("esm") , b)
Next
Case "کارشناسی ارشد"
gr = "کارشناسی ارشد"
listview1.Clear
cur2 = sql2.ExecQuery("Select * from bil where grade = 'arshad'")
For i = 0 To cur2.RowCount - 1
cur2.Position = i
b = b + 1
listview1.AddSingleLine2(cur2.GetString("esm") , b)
Next
End Select
End Sub
Sub listview1_ItemClick (Position As Int, Value As Object)
cur2.Position = Value - 1
Panel1.Visible = True
Label2.Text = gr& " " & cur2.GetString("esm")
id1.Text = cur2.GetInt("id")
listview1.Enabled = False
spinner1.Enabled = False
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
pardakht.RequestPayment("inappbuy" , "inapp" , "pardakht1")
End Sub
Sub pardakht_PurchaseCompleted (Success As Boolean, Product As Purchase)
If Success = True Then
sql2.ExecNonQuery("update bil set khardieh = 'yes' where id ='"&id1.Text&"'")
ToastMessageShow("پرداخت انجام شد" , True)
Else
ToastMessageShow("پرداخت انجام نشد!!!" , True)
End If
End Sub
سوال
mosio02 0
سلام دوستان این کد من هست که از قسمت اینیشیالایز کردن پرداختم ایراد "java.lang.nullpointerexception" میگیره
#Region Activity Attributes #FullScreen: true #IncludeTitle: false #End Region Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. 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 pardakht As BillingManager_b4a_org Dim key As String = "rsa کلید" Private Label2 As Label Private Panel1 As Panel Private spinner1 As Spinner Private listview1 As ListView Private id1 As Label Dim sql2 As SQL Dim cur2 As Cursor Dim paye(5) As String Dim gr As String 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("Lbiling") pardakht.Initialize("pardakht" , key) paye(0) = "کاردانی پیوسته" paye(1) = "کاردانی ناپیوسته" paye(2) = "کارشناسی پیوسته" paye(3) = "کارشناسی ناپیوسته" paye(4) = "کارشناسی ارشد" spinner1.AddAll(paye) If File.Exists(File.DirInternal , "biling.db") = False Then File.Copy(File.DirAssets ,"biling.db" , File.DirInternal , "biling.db") End If sql2.Initialize(File.DirInternal ,"biling.db" , True) End Sub Sub Activity_KeyPress (KeyCode As Int) As Boolean If ( KeyCode = KeyCodes.KEYCODE_BACK) Then Dim msgres As Int msgres = Msgbox2("چه عملی انجام شود؟" , "" , "صفحه قبل" , "منوی اصلی" , "" , Null) If msgres = DialogResponse.POSITIVE Then Activity.Finish StartActivity(Lgrade) Else Activity.Finish StartActivity(Main) End If End If End Sub Sub spinner1_ItemClick (Position As Int, Value As Object) Dim b As Int listview1.SingleLineLayout.Label.Typeface = Typeface.LoadFromAssets("mak.ttf") listview1.SingleLineLayout.Label.TextColor = Colors.White listview1.SingleLineLayout.Label.Gravity = Gravity.CENTER Select Case Value Case "کاردانی پیوسته" gr = "کاردانی پیوسته" listview1.Clear cur2 = sql2.ExecQuery("Select * from bil where grade ='kardani'") For i = 0 To cur2.RowCount - 1 cur2.Position = i b = b + 1 listview1.AddSingleLine2(cur2.GetString("esm") , b) Next Case "کاردانی ناپیوسته" gr = "کاردانی ناپیوسته" listview1.Clear cur2 = sql2.ExecQuery("Select * from bil where grade = 'nkardani'") For i = 0 To cur2.RowCount - 1 cur2.Position = i b = b + 1 listview1.AddSingleLine2(cur2.GetString("esm") , b) Next Case "کارشناسی پیوسته" gr = "کارشناسی پیوسته" listview1.Clear cur2 = sql2.ExecQuery("Select * from bil where grade = 'karshenasi'") For i = 0 To cur2.RowCount - 1 cur2.Position = i b = b + 1 listview1.AddSingleLine2(cur2.GetString("esm") , b) Next Case "کارشناسی ناپیوسته" gr = "کارشناسی ناپیوسته" listview1.Clear cur2 = sql2.ExecQuery("Select * from bil where grade = 'nkarshenasi'") For i = 0 To cur2.RowCount - 1 cur2.Position = i b = b + 1 listview1.AddSingleLine2(cur2.GetString("esm") , b) Next Case "کارشناسی ارشد" gr = "کارشناسی ارشد" listview1.Clear cur2 = sql2.ExecQuery("Select * from bil where grade = 'arshad'") For i = 0 To cur2.RowCount - 1 cur2.Position = i b = b + 1 listview1.AddSingleLine2(cur2.GetString("esm") , b) Next End Select End Sub Sub listview1_ItemClick (Position As Int, Value As Object) cur2.Position = Value - 1 Panel1.Visible = True Label2.Text = gr& " " & cur2.GetString("esm") id1.Text = cur2.GetInt("id") listview1.Enabled = False spinner1.Enabled = False End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Sub Button1_Click pardakht.RequestPayment("inappbuy" , "inapp" , "pardakht1") End Sub Sub pardakht_PurchaseCompleted (Success As Boolean, Product As Purchase) If Success = True Then sql2.ExecNonQuery("update bil set khardieh = 'yes' where id ='"&id1.Text&"'") ToastMessageShow("پرداخت انجام شد" , True) Else ToastMessageShow("پرداخت انجام نشد!!!" , True) End If End Subلینک ارسال
به اشتراک گذاری در سایت های دیگر
10 پاسخ به این سوال تاکنون داده شده است
ارسالهای توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.