رفتن به مطلب

خطا موقع اجرا


011198

ارسال‌های توصیه شده

سلام دوستان بعد چقدر سرو کله زدن با کتابخونه ها  و جور کردن و درست کردن کتابخونه ها مشکل حل شد و کامپایل انجام شد اما برنامه که اجرا میشه این خطا میده. مشکلش چیه ؟
 انگار گفته ایمیج باید initialized بشه اما نمیدونم کدوم ایمیج! 

 

Screenshot_93_.png

 

اینم خطال اجرا شدن داخل موبایل یا همون شبیه ساز :

 

Screenshot_94_.png

 

متن خطای  لاگ:

main_activity_create (java line: 356)
java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (ImageView).
	at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
	at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
	at ir.jetlearn.pzllu.main._activity_create(main.java:356)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
	at ir.jetlearn.pzllu.main.afterFirstLayout(main.java:104)
	at ir.jetlearn.pzllu.main.access$000(main.java:17)
	at ir.jetlearn.pzllu.main$WaitForLayout.run(main.java:82)
	at android.os.Handler.handleCallback(Handler.java:733)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:136)
	at android.app.ActivityThread.main(ActivityThread.java:5021)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
	at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Object should first be initialized (ImageView).
	at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
	at anywheresoftware.b4a.objects.ViewWrapper.innerInitialize(ViewWrapper.java:73)
	at anywheresoftware.b4a.objects.ImageViewWrapper.innerInitialize(ImageViewWrapper.java:36)
	at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:435)
	at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:454)
	at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:148)
	... 17 more
java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (ImageView).

 

 

لینک ارسال
به اشتراک گذاری در سایت های دیگر

متن خطا که مشخصه هموطن.

یه ایمیج ویو استفاده کردین که جایی اینشیالایز نشده و null هست.

کدهای اکتیویتی رو بزارید

لینک ارسال
به اشتراک گذاری در سایت های دیگر

در 12 دقیقه قبل، محمدرضا شاهپیری گفته است :

متن خطا که مشخصه هموطن.

یه ایمیج ویو استفاده کردین که جایی اینشیالایز نشده و null هست.

کدهای اکتیویتی رو بزارید

این اکتیویتی home:


Sub Process_Globals
	Dim st As String
End Sub

Sub Globals

	Private ToolBar As ACToolBarLight
	Private pContent As Panel
	Private xml As XmlLayoutBuilder
	Private sv As ACSearchView
	

	Private pContent As Panel
	Dim xml As XmlLayoutBuilder
	Dim sv As ACSearchView
		
	Private cate As Button
	
	Dim f As Typeface
	f = Typeface.LoadFromAssets("iransans.ttf")
	Private scroll_page As ScrollView
	
	

	Private Label1 As Label
	Private Label2 As Label
	
	
	
	
	
	Dim top As Int = 2%y
	Dim job1 As HttpJob
	Dim json As JSONParser
	
	Private ImageView1 As ImageView
	Private Label3 As Label
	Private Label4 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)

	Activity.LoadLayout("main")
	ToolBar.SetAsActionBar
	ToolBar.InitMenuListener
	pContent.LoadLayout("content")


	sv.Initialize("search")
	ToolBar.Title = "چارا"
	ToolBar.SubTitle="آموزش های نوین آنلاین"
	'ToolBar.LogoBitmap = LoadBitmap(File.DirAssets,"chapket-web-logo.png")
	sv.Initialize("Search")
	sv.IconifiedByDefault = True
	Dim PRTL As ParsRTLToolbar
	PRTL.InitACSearchViewLight(ToolBar,sv,13,Typeface.LoadFromAssets("iransans.ttf"),Colors.White)
	PRTL.TitleACToolBarLight(ToolBar,12,Typeface.LoadFromAssets("iransans.ttf"),Colors.White)	
	Dim marign As Panel
	marign.Initialize("")
	ToolBar.AddView(marign,8dip,24dip,Gravity.RIGHT)
	Dim imgabshare As ImageView
	imgabshare.Initialize("csmenu")
	imgabshare.Background=xml.GetDrawable("ic_icon")
	ToolBar.AddView(imgabshare,24dip,24dip,Gravity.RIGHT)
	ToolBar.NavigationIconDrawable=xml.GetDrawable("ic_menu_white_24dp")
	
	
	'scroll_page.Panel.LoadLayout("home")
	

	
	
	job1.Initialize("job1",Me)
	job1.PostString("http://sedayeomidshz.ir/?json=1","")
	ProgressDialogShow2(setFont(13,"در حال دریافت اطلاعات"),False)
	
	
	
End Sub



Private Sub setFont(TextSize As String,Text As String)As CSBuilder
	Dim CS As CSBuilder
	Return CS.Initialize.Typeface(Typeface.LoadFromAssets("iransans.ttf")).Size(TextSize).Append(Text).PopAll
End Sub




Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub jobdone(job As HttpJob)
	If job.Success Then
		ProgressDialogHide
		Log("Success")
		Try
			json.Initialize(job1.GetString)
		Catch
			Log(LastException)
		End Try
		Dim m As Map
		m.Initialize
		m = json.NextObject
		Dim postcount As Int = m.Get("count")

		Dim list2 As List
		list2.Initialize
		list2 = m.Get("posts")
		For i = 0 To postcount - 1
		
		
			Dim p As Panel
			p.Initialize("")
			p.Color = Colors.Gray
			scroll_page.Panel.AddView(p,0,top,100%x,100%y)
			top = top + 100%x
			p.LoadLayout("post_panel")
			
			
			Dim Post As Map
			Post.Initialize
			Post = list2.Get(i)
			
			
			Dim s As SmartString
			Label1.Text = Post.Get("title")
			s.Ellipsize(Label1,"END",-1)

						
			Label1.Typeface = f
			
			
			
			Label2.Text = Post.Get("date")
			Label2.Typeface = f

			Label4.Text = Post.Get("id")
			
			
			Dim cat As List
			cat.Initialize
			Dim allcat As String
			If Post.Get("categories") <> "" Then
				cat = Post.Get("categories")
				For i2 = 0 To cat.Size - 1
					If i2 = cat.Size - 1 Then
						Dim json2 As Map
						json2 = cat.Get(i2)
						allcat = allcat & json2.Get("title")
					Else
						Dim json2 As Map
						json2 = cat.Get(i2)
						allcat = allcat & json2.Get("title") & ","
					End If
				Next
			End If
			
			Label3.Text = allcat
			Label3.Typeface = f
	

			Label3.Typeface = f

	
			Dim pi As Picasso
			pi.Initialize
			Dim jsonimg As Map
			jsonimg.Initialize
			jsonimg = Post.Get("thumbnail_images")
			Dim jsonfull As Map
			jsonfull.Initialize
			jsonfull = jsonimg.Get("full")
			pi.LoadUrl(jsonfull.Get("url")).Resize(ImageView1.Width,ImageView1.Height).IntoImageView(ImageView1)
			
			
			Dim transpanel As Panel
			transpanel.Initialize("transpanel")
			p.AddView(transpanel,0,0,100%x,100%y)
			transpanel.Color = Colors.Transparent
			transpanel.Tag = Label4.Text
			
			
		Next
		scroll_page.Panel.Height = top
	Else
	
		ProgressDialogHide
		ToastMessageShow("خطا در اتصال",False)
		
	End If
End Sub



Sub transpanel_Click
	Dim p As Panel
	p = Sender
	Log("Click : "&p.Tag)
	st = p.Tag
	StartActivity(showpost)
End Sub


 

اینم اکتیویتی showpost:


Sub Process_Globals
	
	
	Dim cmst As String

End Sub

Sub Globals
	Dim sd As AssistantLib
	Private Panel1 As Panel
		Dim job1,job2 As HttpJob
	Dim json As JSONParser
	Dim top As Int = 0%y
	Private EditText1 As EditText
	Private Button1 As Button
	Dim tp As TP_HTMLEditor
	Private Button2 As Button
	Dim str As String
	
	Dim lbltext As Label
	
	Dim f As Typeface
	f = Typeface.LoadFromAssets("iransans.ttf")
	
	Private ToolBar As ACToolBarLight
	Private pContent As Panel
	Private xml As XmlLayoutBuilder
	Private sv As ACSearchView
	

	Private pContent As Panel
	Dim xml As XmlLayoutBuilder
	Dim sv As ACSearchView
	
	Private post_scroll As ScrollView
	Private lb_titel As Label
	Private Label1 As Label
	Private Label2 As Label
	Private lbname As Label
	Private lbdate As Label
	Private lbcm As Label
	Private cm As Button
	Private cm_btn As Button
	Private cm_cm As EditText
	Private lbl_cm_cm As Label
	Private mail_cm As EditText
	Private name_cm As EditText
	Private pn As Panel
	Private send_cm As Button
	Private close As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
	'Activity.LoadLayout("2")
	
	Activity.LoadLayout("main")
	ToolBar.SetAsActionBar
	ToolBar.InitMenuListener
	pContent.LoadLayout("postcont")
	
	ToolBar.Title = "چارا"
	'ToolBar.SubTitle= json2.Get("title")
	sv.Initialize("Search")
	sv.IconifiedByDefault = True
	Dim PRTL As ParsRTLToolbar
	PRTL.InitACSearchViewLight(ToolBar,sv,13,Typeface.LoadFromAssets("iransans.ttf"),Colors.White)
	PRTL.TitleACToolBarLight(ToolBar,12,Typeface.LoadFromAssets("iransans.ttf"),Colors.White)
	Dim marign As Panel
	marign.Initialize("")
	ToolBar.AddView(marign,8dip,24dip,Gravity.RIGHT)
	'Dim imgabshare As ImageView
	'imgabshare.Initialize("csmenu")
	'imgabshare.Background=xml.GetDrawable("ic_icon")
	'ToolBar.AddView(imgabshare,24dip,24dip,Gravity.RIGHT)
	'ToolBar.NavigationIconDrawable=xml.GetDrawable("ic_menu_white_24dp")
	
	Dim imgabshare As ImageView
	imgabshare.Initialize("csmenu")
	imgabshare.Background=xml.GetDrawable("ic_arrow_forward_white_24dp")
	ToolBar.AddView(imgabshare,24dip,24dip,Gravity.RIGHT)
	Dim imageview1 As ImageView
	imageview1.Initialize("imageView1")
	job1.Initialize("job1",Me)
	job2.Initialize("job2",Me)
	job1.PostString("http://sedayeomidshz.ir/?p="&home.st&"&json=1","")
	ProgressDialogShow2(setFont(13,"در حال دریافت اطلاعات"),False)
	
	
	lbl_cm_cm.Typeface = f
	name_cm.Typeface = f
	cm_cm.Typeface = f
	mail_cm.Typeface = f
	send_cm.Typeface = f
	
	
End Sub

Private Sub setFont(TextSize As String,Text As String)As CSBuilder
	Dim CS As CSBuilder
	Return CS.Initialize.Typeface(Typeface.LoadFromAssets("iransans.ttf")).Size(TextSize).Append(Text).PopAll
End Sub

Sub csmenu_Click
	Activity.Finish
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub jobdone (job As HttpJob)
	If job.Success Then
		If job.JobName = "job1" Then
			top = 0
			post_scroll.Panel.RemoveAllViews
			json.Initialize(job1.GetString)
			Dim json1,json2 As Map
			json1 = json.NextObject
			json2 = json1.Get("post")
			Dim img As ImageView
			img.Initialize("")
			post_scroll.Panel.AddView(img,0,top,100%x,40%y)
			top = top + 62%y
			Dim pi As Picasso
			pi.Initialize
			Dim jsonimg As Map
			jsonimg.Initialize
			jsonimg = json2.Get("thumbnail_images")
			Dim jsonfull As Map
			jsonfull.Initialize
			jsonfull = jsonimg.Get("full")
			pi.LoadUrl(jsonfull.Get("url")).Resize(img.Width,img.Height).IntoImageView(img)
			
			Dim lbltitle As Label
			lbltitle.Initialize("")
			lbltitle.TextColor = Colors.Blue
			lbltitle.TextSize = 14
			lbltitle.Gravity = Gravity.CENTER
			lbltitle.Typeface = f
			lbltitle.Text = json2.Get("title")
			post_scroll.panel.AddView(lbltitle,2%x,73%x,96%x,8%y)


			ToolBar.Title = json2.Get("title")
					
		

			top = top + 9%y
			Dim li As List
			li.Initialize
			'Log(json2.Get("content"))
			li = tp.Initialize(json2.Get("content"),False)
			If li.Size <> 0 Then
				For i = 0 To li.Size -1
					If tp.IsText(li.Get(i)) = True Then
					
						lbltext.Initialize("")
						lbltext.TextColor = Colors.Black
						lbltext.Gravity = Gravity.RIGHT
						lbltext.Typeface = f
						lbltext.TextSize = 12
						lbltext.Text = li.Get(i)
						post_scroll.panel.AddView(lbltext,2%x,88%x,96%x,8%y)
					
						Dim stringulits As StringUtils
						lbltext.Height = stringulits.MeasureMultilineTextHeight(lbltext,lbltext.Text)
						top = lbltext.Top + lbltext.Height + 2%y
						
						Dim msg As String
	
						msg = lbltext.text
						msg = msg.Replace("<p>","")
						msg = msg.Replace("</p>","")
						msg = msg.Replace("</h1>","")
						msg = msg.Replace("<h1>","")
						msg = msg.Replace("<h2>","")
						msg = msg.Replace("</h2>","")
						msg = msg.Replace("&nbsp;","")
						
						lbltext.Text = msg
			
					Else
						Dim img2 As ImageView
						img2.Initialize("img2")
						post_scroll.panel.AddView(img2,20%x,top,60%x,20%y)
						Dim pi2 As Picasso
						pi2.Initialize
						pi2.LoadUrl(tp.ConvertTextToLink(li.Get(i))).Resize(img2.Width,img2.Height).IntoImageView(img2)
						top = img2.Top + img2.Height + 2%y
					End If
				Next
			Else
				Log("Li Empty")
			End If
		
			Dim comments As List
			comments.Initialize
			comments = json2.Get("comments")
			If comments.Size <> 0 Then
				For i2 = 0 To comments.Size - 1
						
					Dim cmpnl As Panel
					cmpnl.Initialize("")
					cmpnl.Color = Colors.rgb(39,174,96)
					cmpnl.Elevation = 3
					
					
					post_scroll.Panel.AddView(cmpnl,2%x,top,96%x,10%y)
					
					Dim details As Map
					details.Initialize
					details = comments.Get(i2)
					
					
					Dim lblcmname As Label
					lblcmname.Initialize("")
					lblcmname.TextColor = Colors.rgb(52,73,94)
					lblcmname.Gravity = Gravity.RIGHT
					lblcmname.Typeface = f
					lblcmname.TextSize = 12
					lblcmname.Text = details.Get("name") & " میگه که :"
					cmpnl.AddView(lblcmname,7%x,2%x,85%x,8%y)
					
					
					Dim lblcmtext As Label
					lblcmtext.Initialize("")
					lblcmtext.TextColor = Colors.White
					lblcmtext.Typeface = f
					lblcmtext.TextSize = 12
					lblcmtext.Gravity = Gravity.RIGHT
				
					
					
					Dim cmli As List
					cmli.Initialize
					cmli = tp.Initialize(details.Get("content"),False)
					Dim cmall As String
					For i3 = 0 To cmli.Size - 1
						cmall = cmall & cmli.Get(i3)
					Next
					lblcmtext.Text = cmall
					cmpnl.AddView(lblcmtext,2%x,5%y,90%x,8%y)
					Dim top2 As Int = stringulits.MeasureMultilineTextHeight(lblcmtext,lblcmtext.Text)
					lblcmtext.Height = top2
					cmpnl.Height = top2 + 5%y
					
					Dim msgg As String
	
					msgg = lblcmtext.text
					msgg = msgg.Replace("<p>","")
					msgg = msgg.Replace("<br>","")
					msgg = msgg.Replace("<br","")
					msgg = msgg.Replace("br>","")
					msgg = msgg.Replace("</p>","")
					msgg = msgg.Replace("</br>","")
					msgg = msgg.Replace("&nbsp;","")
						
					lblcmtext.Text = msgg
					
					
					
'					Dim lblcmdate As Label
'					lblcmdate.Initialize("")
'					lblcmdate.TextColor = Colors.Black
'					lblcmdate.Gravity = Gravity.RIGHT
'					lblcmdate.Text = details.Get("date")
					
					
					top = lblcmtext.Top + lblcmtext.Height + 1%y
'					cmpnl.AddView(lblcmdate,64%x,top,30%x,8%y)
					top = cmpnl.Top + cmpnl.Height + 2%y
				
				Next
			End If
		
		

		
			post_scroll.Panel.Height = top
			ProgressDialogHide
		else if job.JobName = "job2" Then
			cm_cm.Text = ""
			Log("Comment Log : "&job2.GetString)
			ProgressDialogHide
			ToastMessageShow("کامنت شما ارسال شد",False)
		End If
	Else
		ProgressDialogHide
		ToastMessageShow("خطا : ایمیل صحیح وارد نمایید",False)

	End If
End Sub

Sub Button1_Click

End Sub

Sub Button2_Click
	job1.PostString("http://sedayeomidshz.ir/?p="&home.st&"&json=1","")
	ProgressDialogShow2("در حال دریافت اطلاعات",False)
End Sub

'Sub cm_Click
'	
'	Dim b As Button
'	b = Sender
'	Log("Click : "&b.Tag)
'	cmst = b.Tag
'	StartActivity(cm_act)
'	
'End Sub


Sub cm_btn_Click
	pn.Visible = True
End Sub

Sub pn_Touch (Action As Int, X As Float, Y As Float)
	
End Sub

Sub close_Click
	pn.Visible = False
End Sub

Sub send_cm_Click
	If cm_cm.Text <> "" Then
		ProgressDialogShow2(setFont(13,"در حال ارسال کامنت"),False)
		Dim stringutils As StringUtils
		job2.PostString("http://sedayeomidshz.ir/?json=respond.submit_comment&post_id="&home.st&"&name="&name_cm.Text&"&panding=false&email="&mail_cm.text&"&content="&stringutils.EncodeUrl(cm_cm.Text,"UTF8"),"")
	Else
		ToastMessageShow("کامنت را وارد کنید",False)
	End If
End Sub

 

لینک ارسال
به اشتراک گذاری در سایت های دیگر

احتمالاً هیچ عکسی برای ایمیج ویو توی دیزاینر قرار ندادی
و یا اگه قرار دادی حذف شده حتماً دیزاینر رو چک کن

لینک ارسال
به اشتراک گذاری در سایت های دیگر

بایگانی شده

این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.

  • کاربران آنلاین در این صفحه   0 کاربر

    • هیچ کاربر عضوی،در حال مشاهده این صفحه نیست.
×
×
  • اضافه کردن...