I have a news application on Titanium that was working fine on SDK 6.
Since the update to SDK 7.0.1, I am facing a NullPointerException on Android.
The application works as follows. At launch, a list of news is displayed (TableView). When I click on an item, a new windows is opened to display the news details.
When I go back, the list is displayed. Now as soon as I try to scroll the screen, the application crashes.
Bellow are the logs I have on booth Genymotion and real devices running Android 6 or 7.
09:38:48 E TiApplication : (main) [6538,99229] Sending event: exception on thread: main msg:java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View org.appcelerator.titanium.view.TiUIView.getOuterView()' on a null object reference; Titanium 7.0.1,2017/12/18 10:42,undefined
09:38:48 E TiApplication : java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View org.appcelerator.titanium.view.TiUIView.getOuterView()' on a null object reference
09:38:48 E TiApplication : at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.createControls(TiTableViewRowProxyItem.java:244)
09:38:48 E TiApplication : at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:423)
09:38:48 E TiApplication : at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:86)
09:38:48 E TiApplication : at ti.modules.titanium.ui.widget.tableview.TiTableView$TTVListAdapter.getView(TiTableView.java:254)
09:38:48 E TiApplication : at android.widget.AbsListView.obtainView(AbsListView.java:2372)
09:38:48 E TiApplication : at android.widget.ListView.makeAndAddView(ListView.java:2052)
09:38:48 E TiApplication : at android.widget.ListView.fillDown(ListView.java:786)
09:38:48 E TiApplication : at android.widget.ListView.fillGap(ListView.java:750)
09:38:48 E TiApplication : at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5232)
09:38:48 E TiApplication : at android.widget.ListView.trackMotionScroll(ListView.java:1971)
09:38:48 E TiApplication : at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:3581)
09:38:48 E TiApplication : at android.widget.AbsListView.onTouchMove(AbsListView.java:3990)
09:38:48 E TiApplication : at android.widget.AbsListView.onTouchEvent(AbsListView.java:3815)
09:38:48 E TiApplication : at ti.modules.titanium.ui.widget.listview.TiNestedListView.onTouchEvent(TiNestedListView.java:127)
09:38:48 E TiApplication : at android.view.View.dispatchTouchEvent(View.java:11721)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2955)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2636)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
09:38:48 E TiApplication : at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
09:38:48 E TiApplication : at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:445)
09:38:48 E TiApplication : at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1828)
09:38:48 E TiApplication : at android.app.Activity.dispatchTouchEvent(Activity.java:3292)
09:38:48 E TiApplication : at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68)
09:38:48 E TiApplication : at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:407)
09:38:48 E TiApplication : at android.view.View.dispatchPointerEvent(View.java:11960)
09:38:48 E TiApplication : at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4776)
09:38:48 E TiApplication : at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4590)
09:38:48 E TiApplication : at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4128)
09:38:48 E TiApplication : at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4181)
09:38:48 E TiApplication : at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4147)
09:38:48 E TiApplication : at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4274)
09:38:48 E TiApplication : at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4155)
09:38:48 E TiApplication : at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4331)
09:38:48 E TiApplication : at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4128)
09:38:48 E TiApplication : at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4181)
09:38:48 E TiApplication : at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4147)
09:38:48 E TiApplication : at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4155)
09:38:48 E TiApplication : at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4128)
09:38:48 E TiApplication : at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6642)
09:38:48 E TiApplication : at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6616)
09:38:48 E TiApplication : at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6577)
09:38:48 E TiApplication : at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6745)
09:38:48 E TiApplication : at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
09:38:48 E TiApplication : at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
09:38:48 E TiApplication : at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
09:38:48 E TiApplication : at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6716)
09:38:48 E TiApplication : at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6768)
09:38:48 E TiApplication : at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
09:38:48 E TiApplication : at android.view.Choreographer.doCallbacks(Choreographer.java:723)
09:38:48 E TiApplication : at android.view.Choreographer.doFrame(Choreographer.java:652)
09:38:48 E TiApplication : at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
09:38:48 E TiApplication : at android.os.Handler.handleCallback(Handler.java:789)
09:38:48 E TiApplication : at android.os.Handler.dispatchMessage(Handler.java:98)
09:38:48 E TiApplication : at android.os.Looper.loop(Looper.java:164)
09:38:48 E TiApplication : at android.app.ActivityThread.main(ActivityThread.java:6541)
09:38:48 E TiApplication : at java.lang.reflect.Method.invoke(Native Method)
09:38:48 E TiApplication : at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
09:38:48 E TiApplication : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Related
Here is my code :
I have the form load function :
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
AddHandler KeyDown, AddressOf Form1_KeyDown
RaiseEvent KeyDown(Me, e)
End Sub
I have the event declaration :
Event KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
And the function which should open MsgBox When control key is pressed :
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
If e.KeyCode = Keys.Control Then
MsgBox("test")
End If
End Sub
But I have this error :
System.InvalidCastException : 'Impossible d'effectuer un cast d'un objet de type 'System.EventArgs' en type 'System.Windows.Forms.KeyEventArgs'.'
That is the complete error message
So I do not know what should I do
Set Form.KeyPreview = True
Also, your Keys.Control is the control modifier, you may be looking for Keys.ControlKey
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.KeyPreview = True
AddHandler Me.KeyDown, AddressOf Form1_KeyDown
End Sub
Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs)
If e.KeyCode = Keys.ControlKey Then MsgBox("test")
End Sub
I have a situation on visual studio 2015 .. i have the next code :
Private Sub TBwe.Text
Changed;(ByVal sender As System.Object, ByVal e As System.System.EventArgs) Handles TBWe.TextChanged
if Strings.Len(TBWe.Text) = 6 then
TBEt.Focus();
End Sub
i have invalid token in class , struct , or interface
Can any body help me ?
This should work:
Private Sub TBwe_TextChanged(sender As Object, e As EventArgs) Handles TBWe.TextChanged
If Strings.Len(TBWe.Text) = 6 Then
TBEt.Focus()
End If
End Sub
I'm trying to implement a simple web browser in Visual Studio 2013 using VB.Net. However, when I run the application, only the GO button works, and none of the other functions are firing, except for the Form1_Load function. Please help me.
Here is my code:
Public Class Form1
Dim int As Integer = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("www.google.com")
End Sub
Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs)
If e.KeyCode = Keys.Enter Then
WebBrowser1.Navigate(TextBox1.Text)
End If
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
WebBrowser1.ShowPropertiesDialog()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
WebBrowser1.GoBack()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
WebBrowser1.GoForward()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
WebBrowser1.Refresh()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
WebBrowser1.Stop()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
WebBrowser1.Navigate("www.google.com")
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
End Sub
End Class
You need to add the Handles Button1.Click, Handles Button2.Click, etc to each sub
I'm using Visual Basic 2008. I went to publish my project, and I got two "Expression expected" errors. I am very new to Visual Basic - I just started last night. The code:
Public Class Form1
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
WebBrowser1.Navigate("www.zudostudios.com")
End Sub
Private Sub GoBtn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(addressTxt.Text)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addressTxt.TextChanged
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addressTxt.TextChanged
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
WebBrowser1.Navigate("www.zudostudios.com")
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
End Class
It's a copy paste mistake.
You have implemented the following code.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addressTxt.TextChanged
End Sub
But when calling to a method TextBox1_TextChanged the Handles addressTxt.TextChanged is useless.
Correct code should be:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1_TextChanged(sender, e)
End Sub
I am trying to access a few component using a thread. My form looks like this:
my source looks like this:
Private Sub btnGO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGO.Click
pbAction.Value = 0
bgwProcess.RunWorkerAsync()
Me.Cursor = Cursors.WaitCursor
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Application.Exit()
End Sub
Private Sub bgwProcess_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgwProcess.DoWork
'a job consists in retrieving data, populating a listview and update the progressbar
'start job 1.1
'do job 1.1 -> ProgressBar1.value+=1
'do job 1.2 -> ProgressBar1.value+=1
'do job 1.3 -> ProgressBar1.value+=1
'start job 2.1 ProgressBar1.value=1
'do job 2.1 -> ProgressBar2.value+=1
'do job 2.2 -> ProgressBar1.value+=1
End Sub
Private Sub bgwProcess_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bgwProcess.RunWorkerCompleted
Me.Cursor = Cursors.Default
End Sub
Can anyone help me out?
I have created a class that in the _doWork is populated, and i send it to the _ProgressChanged procedure, where I cand do whatever I want to the component on the form:
Public Class myObj
Public action As String
Public msg As String
Public pbAction As Integer
Public pbMsg As Integer
End Class
...
Private Sub btnGO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGO.Click
bgwProcess.RunWorkerAsync()
Me.Cursor = Cursors.WaitCursor
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Application.Exit()
End Sub
Private Sub bgwProcess_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgwProcess.DoWork
Dim op As New myObj
op.action = "my action"
op.msg = "My result: Done"
op.pbAction = 1
op.pbMsg = 1
bgwProcess.ReportProgress(0, op)
End Sub
Private Sub bgwProcess_ProgressChanged(ByVal sender As System.Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles bgwProcess.ProgressChanged
Dim obj As New myObj
obj = DirectCast(e.UserState, myObj)
myListView.BeginUpdate()
Dim li As New ListViewItem(obj.action, 0)
li.SubItems.Add(obj.msg)
myListView.Items.AddRange(New ListViewItem() {li})
myListView.EndUpdate()
myListView.EnsureVisible(myListView.Items.Count - 1)
myListView.Refresh()
pbAction.Value = obj.pbAction
pbTotal.Value = obj.pbMsg
End Sub
Private Sub bgwProcess_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bgwProcess.RunWorkerCompleted
Me.Cursor = Cursors.Default
End Sub