Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App stops responding when Search is don #1

Open
ghost opened this issue Mar 20, 2017 · 14 comments
Open

App stops responding when Search is don #1

ghost opened this issue Mar 20, 2017 · 14 comments

Comments

@ghost
Copy link

ghost commented Mar 20, 2017

When the application comes up, the list is blank. When you tap on the search icon, the app stops and closes.

NullPointerException: Attempt to invoke virtual method 'android.widget.Filter com.learn2crack.recyclerviewsearch.DataAdapter.getFilter()' on a null object reference
at com.learn2crack.recyclerviewsearch.MainActivity$2.onQueryTextChange(MainActivity.java:101)

@rajamalw
Copy link
Member

Can you check the Internet connection? I can replicate the issue by using the device on Airplane mode.

@rajamalw
Copy link
Member

Fix for the crash
8798023

@ghost
Copy link
Author

ghost commented Mar 20, 2017

I have checked the internet connection. Tried both wifi and network. I did notice in the log cat that the "handshake" failed.

@rajamalw
Copy link
Member

Can you post the complete logcat

@ghost
Copy link
Author

ghost commented Mar 21, 2017

W/System: ClassLoader referenced unknown path: /data/app/com.learn2crack.recyclerviewsearch-1/lib/arm64 D/ContextRelationMgrBrdg: loadKlass() : caller=com.samsung.android.bridge.multiscreen.common.ContextRelationManagerBridge.<clinit>:28 com.samsung.android.bridge.multiscreen.common.ContextRelationManagerBridge.getInstance:-1 W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable D/NetworkSecurityConfig: No Network Security Config specified, using platform default D/InputTransport: Input channel constructed: fd=67 D/ViewRootImpl@9f11358[MainActivity]: setView = DecorView@b0ff596[MainActivity] touchMode=true I/Adreno: QUALCOMM build : b3bdf5a, I86b60582e4 Build Date : 12/02/16 OpenGL ES Shader Compiler Version: XE031.09.00.03 Local Branch : Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.5.5.R1.07.00.00.269.013 Remote Branch : NONE Reconstruct Branch : NOTHING I/OpenGLRenderer: Initialized EGL, version 1.4 D/OpenGLRenderer: Swap behavior 1 D/libGLESv1: STS_GLApi : DTS is not allowed for Package : com.learn2crack.recyclerviewsearch E/RecyclerView: No adapter attached; skipping layout D/ViewRootImpl@9f11358[MainActivity]: MSG_RESIZED_REPORT: ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1 D/ViewRootImpl@9f11358[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@2ed5cd8 nm : com.learn2crack.recyclerviewsearch ic=null I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport: Input channel constructed: fd=76 V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@6476e84 nm : com.learn2crack.recyclerviewsearch ic=null D/Error: Handshake failed D/ViewRootImpl@9f11358[MainActivity]: ViewPostImeInputStage processPointer 0 V/BoostFramework: mAcquireFunc method = public int com.qualcomm.qti.Performance.perfLockAcquire(int,int[]) V/BoostFramework: mReleaseFunc method = public int com.qualcomm.qti.Performance.perfLockRelease() V/BoostFramework: mAcquireTouchFunc method = public int com.qualcomm.qti.Performance.perfLockAcquireTouch(android.view.MotionEvent,android.util.DisplayMetrics,int,int[]) V/BoostFramework: mIOPStart method = public int com.qualcomm.qti.Performance.perfIOPrefetchStart(int,java.lang.String) V/BoostFramework: mIOPStop method = public int com.qualcomm.qti.Performance.perfIOPrefetchStop() V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@84bf311 D/ViewRootImpl@9f11358[MainActivity]: ViewPostImeInputStage processPointer 1 I/art: Do partial code cache collection, code=27KB, data=29KB I/art: After code cache collection, code=27KB, data=29KB I/art: Increasing code cache capacity to 128KB D/AndroidRuntime: Shutting down VM E/AndroidRuntime: FATAL EXCEPTION: main Process: com.learn2crack.recyclerviewsearch, PID: 18073 java.lang.NullPointerException: Attempt to invoke virtual method 'android.widget.Filter com.learn2crack.recyclerviewsearch.DataAdapter.getFilter()' on a null object reference at com.learn2crack.recyclerviewsearch.MainActivity$2.onQueryTextChange(MainActivity.java:101) at android.support.v7.widget.SearchView.onTextChanged(SearchView.java:1233) at android.support.v7.widget.SearchView$12.onTextChanged(SearchView.java:1763) at android.widget.TextView.sendOnTextChanged(TextView.java:9404) at android.widget.TextView.setText(TextView.java:5080) at android.widget.TextView.setText(TextView.java:4902) at android.widget.EditText.setText(EditText.java:128) at android.widget.TextView.setText(TextView.java:4877) at android.support.v7.widget.SearchView.onActionViewExpanded(SearchView.java:1347) at android.support.v7.widget.Toolbar$ExpandedActionViewMenuPresenter.expandItemActionView(Toolbar.java:2377) at android.support.v7.view.menu.MenuBuilder.expandItemActionView(MenuBuilder.java:1344) at android.support.v7.view.menu.MenuItemImpl.expandActionView(MenuItemImpl.java:690) at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:974) at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:959) at android.support.v7.widget.ActionMenuView.invokeItem(ActionMenuView.java:623) at android.support.v7.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:154) at android.view.View.performClick(View.java:6207) at android.widget.TextView.performClick(TextView.java:11094) at android.view.View$PerformClick.run(View.java:23639) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6688) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358) Disconnected from the target VM, address: 'localhost:8660', transport: 'socket'

@rajamalw
Copy link
Member

Can you provide me the following details

Device
Android Version

@ghost
Copy link
Author

ghost commented Mar 21, 2017

Sure,
Samsung Galaxy S7 SM-G930T
Android 7.0

@rajamalw
Copy link
Member

I tried with Galaxy S6 Android 6.0.1 works fine and other Android 7.1 devices which work fine.
Can you try the same in Android Emulator?

@ghost
Copy link
Author

ghost commented Mar 23, 2017

Hello, I ran the app in the emulator with all my virtual devices and it displayed a list from json. But running it again on a real device the list does not display.

@ghost
Copy link
Author

ghost commented Mar 23, 2017

Just a side note, I have an application that uses json to populate a listview and it returns the list.

@rajamalw
Copy link
Member

Have you modified any code?

I will try to check on a Galaxy S7 if possible

@ghost
Copy link
Author

ghost commented Mar 27, 2017 via email

@alwarren
Copy link

alwarren commented Aug 20, 2017

I just ran across this when lazy loading items. For example, when using background operations. The adapter is first created with an empty list. Then when background operations complete, data is sent to the adapter.

On first run through the adapter, the list is empty so there is a null pointer exception in onBindViewHolder. Method calls there (and possible elsewhere) should do null checks.

Perhaps the search method is firing before the adapter is initialized or loaded with data.

@lovingnirav
Copy link

Any solution for this. Me too facing same problem.
Device : Moto G5 plus
Android : 7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants