java.lang.NullPointerException

Appcelerator JIRA | Neville Dastur | 2 years ago
  1. 0

    h4. Problem Description On Android searching with a SearchView attached to a listview that uses templates causes the app to crash. Works fine on iOS and interestingly on Genymotion S5 emulator. But crashes on device. The error log is below. Maybe related to this forum post [https://developer.appcelerator.com/question/173280/search-alloy-collection-in-listview-using-template] h4. Test Case 1. Create a new mobile project ( Classic Titanium ) 2. Copy this code into app.js {code} var win = Ti.UI.createWindow({backgroundColor: 'white'}); var myTemplate = { childTemplates: [ { type: 'Ti.UI.ImageView', bindId: 'pic', properties: { width: '50dp', height: '50dp', left: 0 } }, { type: 'Ti.UI.Label', bindId: 'info', properties: { color: 'black', font: { fontFamily:'Arial', fontSize: '20dp', fontWeight:'bold' }, left: '60dp', top: 0, } }, { type: 'Ti.UI.Label', bindId: 'es_info', properties: { color: 'gray', font: { fontFamily:'Arial', fontSize: '14dp' }, left: '60dp', top: '25dp', } } ] }; search = Ti.UI.Android.createSearchView({ hintText: "Table Search" }); var listView = Ti.UI.createListView({ templates: { 'template': myTemplate }, defaultItemTemplate: 'template', searchView:search }); var sections = []; var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits / Frutas'}); var fruitDataSet = [ { info: {text: 'Apple'}, es_info: {text: 'Manzana'}, pic: {image: 'apple.png'}}, { info: {text: 'Banana'}, es_info: {text: 'Banana'}, pic: {image: 'banana.png'}} ]; fruitSection.setItems(fruitDataSet); sections.push(fruitSection); var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables / Verduras'}); var vegDataSet = [ { info: {text: 'Carrot'}, es_info: {text: 'Zanahoria'}, pic: {image: 'carrot.png'}}, { info: {text: 'Potato'}, es_info: {text: 'Patata'}, pic: {image: 'potato.png'}} ]; vegSection.setItems(vegDataSet); sections.push(vegSection); var grainSection = Ti.UI.createListSection({ headerTitle: 'Grains / Granos'}); var grainDataSet = [ { info: {text: 'Corn'}, es_info: {text: 'Maiz'}, pic: {image: 'corn.png'}}, { info: {text: 'Rice'}, es_info: {text: 'Arroz'}, pic: {image: 'rice.png'}} ]; grainSection.setItems(grainDataSet); sections.push(grainSection); listView.setSections(sections); win.add(listView); win.open(); {code} 3. Run it on a device 4. Click on the search h4. Actual Results The app will crash h4. Expected results The app working fine. h4. Extra info {panel:title=Error log} [ERROR] TiApplication: (main) [2475,185914] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 3.3.0,2014/07/11 12:36,787cd39 [ERROR] TiApplication: java.lang.NullPointerException [ERROR] TiApplication: at ti.modules.titanium.ui.widget.listview.ListSectionProxy.applyFilter(ListSectionProxy.java:935) [ERROR] TiApplication: at ti.modules.titanium.ui.widget.listview.TiListView.reFilter(TiListView.java:543) [ERROR] TiApplication: at ti.modules.titanium.ui.widget.listview.TiListView.filterBy(TiListView.java:851) [ERROR] TiApplication: at ti.modules.titanium.ui.widget.searchview.TiUISearchView.onQueryTextChange(TiUISearchView.java:90) [ERROR] TiApplication: at android.support.v7.widget.SearchView.onTextChanged(SearchView.java:1118) [ERROR] TiApplication: at android.support.v7.widget.SearchView.access$2000(SearchView.java:103) [ERROR] TiApplication: at android.support.v7.widget.SearchView$12.onTextChanged(SearchView.java:1578) [ERROR] TiApplication: at android.widget.TextView.sendOnTextChanged(TextView.java:8905) [ERROR] TiApplication: at android.widget.TextView.handleTextChanged(TextView.java:8979) [ERROR] TiApplication: at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:11160) [ERROR] TiApplication: at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:964) [ERROR] TiApplication: at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:498) [ERROR] TiApplication: at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:437) [ERROR] TiApplication: at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30) [ERROR] TiApplication: at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:679) [ERROR] TiApplication: at android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java:437) [ERROR] TiApplication: at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:333) [ERROR] TiApplication: at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77) [ERROR] TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102) [ERROR] TiApplication: at android.os.Looper.loop(Looper.java:136) [ERROR] TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5579) [ERROR] TiApplication: at java.lang.reflect.Method.invokeNative(Native Method) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Method.java:515) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) [ERROR] TiApplication: at dalvik.system.NativeStart.main(Native Method) {panel}

    Appcelerator JIRA | 2 years ago | Neville Dastur
    java.lang.NullPointerException
  2. 0

    h4. Problem Description On Android searching with a SearchView attached to a listview that uses templates causes the app to crash. Works fine on iOS and interestingly on Genymotion S5 emulator. But crashes on device. The error log is below. Maybe related to this forum post [https://developer.appcelerator.com/question/173280/search-alloy-collection-in-listview-using-template] h4. Test Case 1. Create a new mobile project ( Classic Titanium ) 2. Copy this code into app.js {code} var win = Ti.UI.createWindow({backgroundColor: 'white'}); var myTemplate = { childTemplates: [ { type: 'Ti.UI.ImageView', bindId: 'pic', properties: { width: '50dp', height: '50dp', left: 0 } }, { type: 'Ti.UI.Label', bindId: 'info', properties: { color: 'black', font: { fontFamily:'Arial', fontSize: '20dp', fontWeight:'bold' }, left: '60dp', top: 0, } }, { type: 'Ti.UI.Label', bindId: 'es_info', properties: { color: 'gray', font: { fontFamily:'Arial', fontSize: '14dp' }, left: '60dp', top: '25dp', } } ] }; search = Ti.UI.Android.createSearchView({ hintText: "Table Search" }); var listView = Ti.UI.createListView({ templates: { 'template': myTemplate }, defaultItemTemplate: 'template', searchView:search }); var sections = []; var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits / Frutas'}); var fruitDataSet = [ { info: {text: 'Apple'}, es_info: {text: 'Manzana'}, pic: {image: 'apple.png'}}, { info: {text: 'Banana'}, es_info: {text: 'Banana'}, pic: {image: 'banana.png'}} ]; fruitSection.setItems(fruitDataSet); sections.push(fruitSection); var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables / Verduras'}); var vegDataSet = [ { info: {text: 'Carrot'}, es_info: {text: 'Zanahoria'}, pic: {image: 'carrot.png'}}, { info: {text: 'Potato'}, es_info: {text: 'Patata'}, pic: {image: 'potato.png'}} ]; vegSection.setItems(vegDataSet); sections.push(vegSection); var grainSection = Ti.UI.createListSection({ headerTitle: 'Grains / Granos'}); var grainDataSet = [ { info: {text: 'Corn'}, es_info: {text: 'Maiz'}, pic: {image: 'corn.png'}}, { info: {text: 'Rice'}, es_info: {text: 'Arroz'}, pic: {image: 'rice.png'}} ]; grainSection.setItems(grainDataSet); sections.push(grainSection); listView.setSections(sections); win.add(listView); win.open(); {code} 3. Run it on a device 4. Click on the search h4. Actual Results The app will crash h4. Expected results The app working fine. h4. Extra info {panel:title=Error log} [ERROR] TiApplication: (main) [2475,185914] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 3.3.0,2014/07/11 12:36,787cd39 [ERROR] TiApplication: java.lang.NullPointerException [ERROR] TiApplication: at ti.modules.titanium.ui.widget.listview.ListSectionProxy.applyFilter(ListSectionProxy.java:935) [ERROR] TiApplication: at ti.modules.titanium.ui.widget.listview.TiListView.reFilter(TiListView.java:543) [ERROR] TiApplication: at ti.modules.titanium.ui.widget.listview.TiListView.filterBy(TiListView.java:851) [ERROR] TiApplication: at ti.modules.titanium.ui.widget.searchview.TiUISearchView.onQueryTextChange(TiUISearchView.java:90) [ERROR] TiApplication: at android.support.v7.widget.SearchView.onTextChanged(SearchView.java:1118) [ERROR] TiApplication: at android.support.v7.widget.SearchView.access$2000(SearchView.java:103) [ERROR] TiApplication: at android.support.v7.widget.SearchView$12.onTextChanged(SearchView.java:1578) [ERROR] TiApplication: at android.widget.TextView.sendOnTextChanged(TextView.java:8905) [ERROR] TiApplication: at android.widget.TextView.handleTextChanged(TextView.java:8979) [ERROR] TiApplication: at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:11160) [ERROR] TiApplication: at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:964) [ERROR] TiApplication: at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:498) [ERROR] TiApplication: at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:437) [ERROR] TiApplication: at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30) [ERROR] TiApplication: at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:679) [ERROR] TiApplication: at android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java:437) [ERROR] TiApplication: at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:333) [ERROR] TiApplication: at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77) [ERROR] TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102) [ERROR] TiApplication: at android.os.Looper.loop(Looper.java:136) [ERROR] TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5579) [ERROR] TiApplication: at java.lang.reflect.Method.invokeNative(Native Method) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Method.java:515) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) [ERROR] TiApplication: at dalvik.system.NativeStart.main(Native Method) {panel}

    Appcelerator JIRA | 2 years ago | Neville Dastur
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at ti.modules.titanium.ui.widget.listview.ListSectionProxy.applyFilter()
    2. ti.modules.titanium
      TiUISearchView.onQueryTextChange
      1. ti.modules.titanium.ui.widget.listview.ListSectionProxy.applyFilter(ListSectionProxy.java:935)
      2. ti.modules.titanium.ui.widget.listview.TiListView.reFilter(TiListView.java:543)
      3. ti.modules.titanium.ui.widget.listview.TiListView.filterBy(TiListView.java:851)
      4. ti.modules.titanium.ui.widget.searchview.TiUISearchView.onQueryTextChange(TiUISearchView.java:90)
      4 frames
    3. Android v7
      SearchView$12.onTextChanged
      1. android.support.v7.widget.SearchView.onTextChanged(SearchView.java:1118)
      2. android.support.v7.widget.SearchView.access$2000(SearchView.java:103)
      3. android.support.v7.widget.SearchView$12.onTextChanged(SearchView.java:1578)
      3 frames
    4. Android Platform
      BaseInputConnection.setComposingText
      1. android.widget.TextView.sendOnTextChanged(TextView.java:8905)
      2. android.widget.TextView.handleTextChanged(TextView.java:8979)
      3. android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:11160)
      4. android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:964)
      5. android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:498)
      6. android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:437)
      7. android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30)
      8. android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:679)
      9. android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java:437)
      9 frames
    5. Android
      IInputConnectionWrapper$MyHandler.handleMessage
      1. com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:333)
      2. com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77)
      2 frames
    6. Android Platform
      ActivityThread.main
      1. android.os.Handler.dispatchMessage(Handler.java:102)
      2. android.os.Looper.loop(Looper.java:136)
      3. android.app.ActivityThread.main(ActivityThread.java:5579)
      3 frames
    7. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invokeNative(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:515)
      2 frames
    8. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
      2 frames
    9. Android Platform
      NativeStart.main
      1. dalvik.system.NativeStart.main(Native Method)
      1 frame