解決策: null がないことを確認してください。
NullPointerException をスローする ListView があり、何が間違っているのかわかりません。
ListView の一番下までスクロールするとエラーが発生します
私のコードは次のとおりです: BluetoothChat.java
関連する部分(アダプターをいじる場所):
songs = cmd.songs;
mAdapter = new ArrayAdapter(
this,
android.R.layout.simple_list_item_1,
songs);
mAdapter.notifyDataSetChanged();
library.setAdapter(mAdapter);
ログキャット:
E/BluetoothChat(11304): +++ ON CREATE +++
E/BluetoothChat(11304): ++ ON START ++
E/BluetoothChat(11304): + ON RESUME +
E/BluetoothChat(11304): - ON PAUSE -
E/BluetoothService.cpp( 229): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
E/BluetoothChat(11304): + ON RESUME +
E/BluetoothService.cpp( 229): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
E/BluetoothEventLoop.cpp( 229): onCreateDeviceResult: D-Bus error: org.bluez.Error.AlreadyExists (Already Exists)
E/BluetoothService.cpp( 229): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
E/BluetoothChatService(11304): accept() failed
E/BluetoothChatService(11304): java.io.IOException: Operation Canceled
E/BluetoothChatService(11304): at android.bluetooth.BluetoothSocket.acceptNative(Native Method)
E/BluetoothChatService(11304): at android.bluetooth.BluetoothSocket.accept(BluetoothSocket.java:311)
E/BluetoothChatService(11304): at android.bluetooth.BluetoothServerSocket.accept(BluetoothServerSocket.java:113)
E/BluetoothChatService(11304): at android.bluetooth.BluetoothServerSocket.accept(BluetoothServerSocket.java:99)
E/BluetoothChatService(11304): at com.winograd.mp3remote.BluetoothChatService$AcceptThread.run(BluetoothChatService.java:257)
W/dalvikvm(11304): threadid=1: thread exiting with uncaught exception (group=0x40a391f8)
E/AndroidRuntime(11304): FATAL EXCEPTION: main
E/AndroidRuntime(11304): java.lang.NullPointerException
E/AndroidRuntime(11304): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:394)
E/AndroidRuntime(11304): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
E/AndroidRuntime(11304): at android.widget.AbsListView.obtainView(AbsListView.java:2037)
E/AndroidRuntime(11304): at android.widget.ListView.makeAndAddView(ListView.java:1772)
E/AndroidRuntime(11304): at android.widget.ListView.fillDown(ListView.java:672)
E/AndroidRuntime(11304): at android.widget.ListView.fillGap(ListView.java:636)
E/AndroidRuntime(11304): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:4581)
E/AndroidRuntime(11304): at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:2877)
E/AndroidRuntime(11304): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3131)
E/AndroidRuntime(11304): at android.view.View.dispatchTouchEvent(View.java:5541)
E/AndroidRuntime(11304): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1951)
E/AndroidRuntime(11304): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1712)
E/AndroidRuntime(11304): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
E/AndroidRuntime(11304): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
E/AndroidRuntime(11304): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
E/AndroidRuntime(11304): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
E/AndroidRuntime(11304): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
E/AndroidRuntime(11304): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
E/AndroidRuntime(11304): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
E/AndroidRuntime(11304): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
E/AndroidRuntime(11304): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
E/AndroidRuntime(11304): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
E/AndroidRuntime(11304): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1912)
E/AndroidRuntime(11304): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1371)
E/AndroidRuntime(11304): at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
E/AndroidRuntime(11304): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1860)
E/AndroidRuntime(11304): at android.view.View.dispatchPointerEvent(View.java:5721)
E/AndroidRuntime(11304): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2890)
E/AndroidRuntime(11304): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2466)
E/AndroidRuntime(11304): at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:845)
E/AndroidRuntime(11304): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2475)
E/AndroidRuntime(11304): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(11304): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(11304): at android.app.ActivityThread.main(ActivityThread.java:4575)
E/AndroidRuntime(11304): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(11304): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(11304): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime(11304): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(11304): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 229): Force finishing activity com.winograd.mp3remote/.BluetoothChat
W/ActivityManager( 229): Activity pause timeout for ActivityRecord{4188fd40 com.winograd.mp3remote/.BluetoothChat}
E/LockScreen( 229): NameNotFoundException: [**null**]
W/InputManagerService( 229): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@474adcd0
E/LockScreen( 229): NameNotFoundException: [**null**]
W/IInputConnectionWrapper( 9205): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper( 9205): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper( 9205): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 9205): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 9205): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper( 9205): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 9205): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 9205): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 9205): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 9205): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper( 9205): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 9205): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 9205): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 9205): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 9205): getExtractedText on inactive InputConnection
W/ActivityManager( 229): Activity destroy timeout for ActivityRecord{4188fd40 com.winograd.mp3remote/.BluetoothChat}
E/LockScreen( 229): NameNotFoundException: [**null**]
E/LockScreen( 229): NameNotFoundException: [**null**]
W/InputManagerService( 229): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@461df6d0
E/BluetoothChat(11327): +++ ON CREATE +++
E/BluetoothChat(11327): ++ ON START ++
E/BluetoothChat(11327): + ON RESUME +
E/BluetoothChat(11327): - ON PAUSE -
E/BluetoothService.cpp( 229): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
E/BluetoothChat(11327): + ON RESUME +
E/BluetoothService.cpp( 229): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
E/BluetoothEventLoop.cpp( 229): onCreateDeviceResult: D-Bus error: org.bluez.Error.AlreadyExists (Already Exists)
E/BluetoothService.cpp( 229): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
E/BluetoothChatService(11327): accept() failed
E/BluetoothChatService(11327): java.io.IOException: Operation Canceled
E/BluetoothChatService(11327): at android.bluetooth.BluetoothSocket.acceptNative(Native Method)
E/BluetoothChatService(11327): at android.bluetooth.BluetoothSocket.accept(BluetoothSocket.java:311)
E/BluetoothChatService(11327): at android.bluetooth.BluetoothServerSocket.accept(BluetoothServerSocket.java:113)
E/BluetoothChatService(11327): at android.bluetooth.BluetoothServerSocket.accept(BluetoothServerSocket.java:99)
E/BluetoothChatService(11327): at com.winograd.mp3remote.BluetoothChatService$AcceptThread.run(BluetoothChatService.java:257)
W/dalvikvm(11327): threadid=1: thread exiting with uncaught exception (group=0x40a391f8)
E/AndroidRuntime(11327): FATAL EXCEPTION: main
E/AndroidRuntime(11327): java.lang.NullPointerException
E/AndroidRuntime(11327): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:394)
E/AndroidRuntime(11327): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
E/AndroidRuntime(11327): at android.widget.AbsListView.obtainView(AbsListView.java:2037)
E/AndroidRuntime(11327): at android.widget.ListView.makeAndAddView(ListView.java:1772)
E/AndroidRuntime(11327): at android.widget.ListView.fillDown(ListView.java:672)
E/AndroidRuntime(11327): at android.widget.ListView.fillGap(ListView.java:636)
E/AndroidRuntime(11327): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:4581)
E/AndroidRuntime(11327): at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:3848)
E/AndroidRuntime(11327): at android.os.Handler.handleCallback(Handler.java:605)
E/AndroidRuntime(11327): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(11327): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(11327): at android.app.ActivityThread.main(ActivityThread.java:4575)
E/AndroidRuntime(11327): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(11327): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(11327): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime(11327): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(11327): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 229): Force finishing activity com.winograd.mp3remote/.BluetoothChat
W/ActivityManager( 229): Activity pause timeout for ActivityRecord{473f2238 com.winograd.mp3remote/.BluetoothChat}
W/ResourceType( 229): Invalid package identifier when getting bag for resource number 0x7f0c0009
W/InputManagerService( 229): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43c28e60
W/ActivityManager( 229): Activity destroy timeout for ActivityRecord{473f2238 com.winograd.mp3remote/.BluetoothChat}
ヘルプ/ヒントは大歓迎です!