[英]Android: Why chat list view adapter doesn't work properly?
當我調用適配器並嘗試添加消息時,我正在編寫一個 android 聊天應用程序,它會關閉並且聊天活動被粉碎,然后我回到上一個活動。 這些是我的課程: OneMessage.java:
package com.mycompany.myapp;
public class OneMessage
{
public boolean left;
public String text;
public OneMessage(boolean left,String text) {
super();
this.left=left;
this.text=text;
}
}
& kada.java = 一個名為k 適配器的適配器:
package com.mycompany.myapp;
//imports here
public class kada extends ArrayAdapter<OneMessage>
{
private TextView tv;
private List<OneMessage> list=new ArrayList<OneMessage>();
private LinearLayout space;
public void add(OneMessage object) {
list.add(object);
super.add(object);
}
public kada(Context context,int textViewResourceId) {
super(context,textViewResourceId);
}
public int getCount() {
return this.list.size();
}
@Override
public OneMessage getItem(int position)
{
return this.list.get(position);
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
View row=convertView;
if (row==null) {
LayoutInflater li=(LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
li.inflate(R.layout.me,parent,false);
}
space=(LinearLayout) row.findViewById(R.id.space);
OneMessage om=getItem(position);
tv=(TextView) row.findViewById(R.id.textview);
tv.setText(om.text);
space.setGravity(om.left ? Gravity.LEFT : Gravity.RIGHT);
return row;
}
public Bitmap decodeToBitmap(byte[] db) {
return BitmapFactory.decodeByteArray(db,0,db.length);
}
}
這是我的日志:
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2596)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1638)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1892)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7292)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.Choreographer.doCallbacks(Choreographer.java:790)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.Choreographer.doFrame(Choreographer.java:721)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:967)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.os.Handler.handleCallback(Handler.java:808)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:101)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.os.Looper.loop(Looper.java:166)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:7529)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at java.lang.reflect.Method.invoke(Native Method)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
10-31 00:39:33.204 32160 32160 E AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
10-31 10:11:51.383 12826 12826 E AndroidRuntime FATAL EXCEPTION: main
10-31 10:11:51.383 12826 12826 E AndroidRuntime Process: com.mycompany.myapp, PID: 12826
10-31 10:11:51.383 12826 12826 E AndroidRuntime java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
10-31 10:11:51.383 12826 12826 E AndroidRuntime at com.mycompany.myapp.kada.getView(kada.java:36)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.AbsListView.obtainView(AbsListView.java:2428)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.ListView.measureHeightOfChildren(ListView.java:1420)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.ListView.onMeasure(ListView.java:1327)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:451)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at com.android.internal.policy.DecorView.onMeasure(DecorView.java:831)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2596)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1638)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1892)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7292)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.Choreographer.doCallbacks(Choreographer.java:790)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.Choreographer.doFrame(Choreographer.java:721)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:967)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.os.Handler.handleCallback(Handler.java:808)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:101)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.os.Looper.loop(Looper.java:166)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:7529)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at java.lang.reflect.Method.invoke(Native Method)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
10-31 10:11:51.383 12826 12826 E AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
10-31 11:17:37.975 27485 27485 E AndroidRuntime FATAL EXCEPTION: main
10-31 11:17:37.975 27485 27485 E AndroidRuntime Process: com.mycompany.myapp, PID: 27485
10-31 11:17:37.975 27485 27485 E AndroidRuntime java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
10-31 11:17:37.975 27485 27485 E AndroidRuntime at com.mycompany.myapp.kada.getView(kada.java:38)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.AbsListView.obtainView(AbsListView.java:2428)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.ListView.measureHeightOfChildren(ListView.java:1420)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.ListView.onMeasure(ListView.java:1327)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:451)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at com.android.internal.policy.DecorView.onMeasure(DecorView.java:831)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2596)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1638)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1892)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7292)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.Choreographer.doCallbacks(Choreographer.java:790)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.Choreographer.doFrame(Choreographer.java:721)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:967)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.os.Handler.handleCallback(Handler.java:808)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:101)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.os.Looper.loop(Looper.java:166)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:7529)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at java.lang.reflect.Method.invoke(Native Method)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
10-31 11:17:37.975 27485 27485 E AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
10-31 11:22:18.006 28004 28004 E AndroidRuntime FATAL EXCEPTION: main
10-31 11:22:18.006 28004 28004 E AndroidRuntime Process: com.mycompany.myapp, PID: 28004
10-31 11:22:18.006 28004 28004 E AndroidRuntime java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
10-31 11:22:18.006 28004 28004 E AndroidRuntime at com.mycompany.myapp.kada.getView(kada.java:38)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.AbsListView.obtainView(AbsListView.java:2428)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.ListView.measureHeightOfChildren(ListView.java:1420)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.ListView.onMeasure(ListView.java:1327)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:451)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at com.android.internal.policy.DecorView.onMeasure(DecorView.java:831)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.View.measure(View.java:22216)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2596)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1638)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1892)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7292)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.Choreographer.doCallbacks(Choreographer.java:790)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.Choreographer.doFrame(Choreographer.java:721)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:967)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.os.Handler.handleCallback(Handler.java:808)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:101)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.os.Looper.loop(Looper.java:166)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:7529)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at java.lang.reflect.Method.invoke(Native Method)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
10-31 11:22:18.006 28004 28004 E AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
10-31 14:21:40.206 12927 12927 I zygote64 Late-enabling -Xcheck:jni
10-31 14:21:40.313 12927 12927 D ActivityThread ActivityThread,attachApplication
10-31 14:21:40.421 12927 12942 I HwApiCacheMangerEx apicache mCurPackageName=com.mycompany.myapp uptimes=209549163
10-31 14:21:40.424 12927 12927 D HwFLClassLoader get used feature list :/feature/used-list failed!
10-31 14:21:40.424 12927 12927 D HwFLClassLoader USE_FEATURE_LIST had not init!
10-31 14:21:40.425 12927 12942 I HwApiCacheMangerEx apicache oUid null
10-31 14:21:40.428 12927 12942 I HwApiCacheMangerEx apicache volumes null
10-31 14:21:40.456 12927 12942 I HwApiCacheMangerEx apicache path=/storage/emulated/0 state=mounted key=com.mycompany.myapp#10773#256
10-31 14:21:40.478 12927 12942 I HwApiCacheMangerEx apicache oUid 10773
10-31 14:21:40.478 12927 12942 I HwApiCacheMangerEx apicache volumes null
10-31 14:21:40.480 12927 12942 I HwApiCacheMangerEx apicache path=/storage/emulated/0 state=mounted key=com.mycompany.myapp#10773#0
10-31 14:21:40.480 12927 12942 I HwApiCacheMangerEx apicache async read begin packageName=com.mycompany.myapp userid=0
10-31 14:21:40.480 12927 12942 I HwApiCacheMangerEx apicache pi null
10-31 14:21:40.484 12927 12942 I HwApiCacheMangerEx apicache pi null
10-31 14:21:40.485 12927 12942 I HwApiCacheMangerEx apicache pi null
10-31 14:21:40.486 12927 12942 I HwApiCacheMangerEx apicache oUid null
10-31 14:21:40.487 12927 12927 I HwApiCacheMangerEx apicache pi null
10-31 14:21:40.488 12927 12942 I HwApiCacheMangerEx apicache async read finished packageName=com.mycompany.myapp userid=0 totalus=7115
10-31 14:21:40.492 12927 12942 E MemoryLeakMonitorManager MemoryLeakMonitor.jar is not exist!
10-31 14:21:40.520 12927 12927 I HwCust Constructor found for class android.app.HwCustActivityImpl
10-31 14:21:40.520 12927 12927 D HwCust Create obj success use class android.app.HwCustActivityImpl
10-31 14:21:40.524 12927 12927 V HwPolicyFactory : success to get AllImpl object and return....
10-31 14:21:40.537 12927 12927 V HwWidgetFactory : successes to get AllImpl object and return....
10-31 14:21:40.542 12927 12927 V ActivityThread ActivityThread,callActivityOnCreate
10-31 14:21:40.574 12927 12927 D CubicBezierInterpolator CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97
10-31 14:21:40.576 12927 12927 D CubicBezierInterpolator CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0
10-31 14:21:40.577 12927 12927 D CubicBezierInterpolator CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97
10-31 14:21:40.578 12927 12927 D CubicBezierInterpolator CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0
10-31 14:21:40.611 12927 12927 D HwGalleryCacheManagerImpl mIsEffect:false
10-31 14:21:40.681 12927 12927 D HwWechatOptimizeImpl mIsEffect:false
10-31 14:21:40.733 12927 12927 D HwRTBlurUtils check blur style for HwPhoneWindow, themeResId : 0x7f050000, context : com.mycompany.myapp.MainActivity@a6a9eee, Nhwext : 0, get Blur : disable with , null
10-31 14:21:40.737 12927 12927 W WindowDecorActionBar should not do the transition or the transition anim is null or it is running or the mContainer view is null or mContainer view hasn't been drawn to screen
10-31 14:21:40.739 12927 12927 E HwResourcesImpl readDefaultConfig : FileNotFoundException
10-31 14:21:40.773 12927 12927 I HwCust Constructor found for class android.content.res.HwCustHwResourcesImpl
10-31 14:21:40.773 12927 12927 D HwCust Create obj success use class android.content.res.HwCustHwResourcesImpl
10-31 14:21:40.933 12927 12933 I zygote64 Do partial code cache collection, code=30KB, data=22KB
10-31 14:21:40.934 12927 12933 I zygote64 After code cache collection, code=30KB, data=22KB
10-31 14:21:40.934 12927 12933 I zygote64 Increasing code cache capacity to 128KB
10-31 14:21:40.969 12927 12927 D ActivityThread add activity client record, r= ActivityRecord{380ab03 token=android.os.BinderProxy@2acc333 {com.mycompany.myapp/com.mycompany.myapp.MainActivity}} token= android.os.BinderProxy@2acc333
10-31 14:21:40.984 12927 12927 I HwSecImmHelper mSecurityInputMethodService is null
10-31 14:21:40.998 12927 12927 D OpenGLRenderer HWUI Binary is disabled
10-31 14:21:41.080 12927 12965 D OpenGLRenderer HWUI GL Pipeline
10-31 14:21:41.102 12927 12927 I PressGestureDetector onAttached begin
10-31 14:21:41.103 12927 12927 I PressGestureDetector onAttached end
10-31 14:21:41.109 12927 12966 I PressGestureDetector HiTouch restricted: AboardArea.
10-31 14:21:41.157 12927 12965 I Adreno QUALCOMM build : 00d0768, Ie4790512f3
10-31 14:21:41.157 12927 12965 I Adreno Build Date : 06/25/18
10-31 14:21:41.157 12927 12965 I Adreno OpenGL ES Shader Compiler Version: EV031.20.00.04
10-31 14:21:41.157 12927 12965 I Adreno Local Branch :
10-31 14:21:41.157 12927 12965 I Adreno Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.6.5.R1.08.00.00.312.030
10-31 14:21:41.157 12927 12965 I Adreno Remote Branch : NONE
10-31 14:21:41.157 12927 12965 I Adreno Reconstruct Branch : NOTHING
10-31 14:21:41.167 12927 12965 I Adreno PFP: 0x005ff087, ME: 0x005ff063
10-31 14:21:41.176 12927 12965 I OpenGLRenderer Initialized EGL, version 1.4
10-31 14:21:41.176 12927 12965 D OpenGLRenderer Swap behavior 2
10-31 14:21:41.190 12927 12965 E vndksupport Could not load vendor/lib64/egl/libGLES_mali.so from sphal namespace: dlopen failed: library "vendor/lib64/egl/libGLES_mali.so" not found.
10-31 14:21:41.450 12927 12927 W InputMethodManager startInputReason = 1
10-31 14:21:41.492 12927 12927 W InputMethodManager startInputReason = 5
10-31 14:21:41.805 12927 12927 E SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
10-31 14:21:41.805 12927 12927 E SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
10-31 14:21:41.819 12927 12927 E SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
10-31 14:21:41.819 12927 12927 E SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
10-31 14:21:41.832 12927 12927 E SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
10-31 14:21:41.832 12927 12927 E SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
10-31 14:21:42.665 12927 12933 I zygote64 Do partial code cache collection, code=61KB, data=49KB
10-31 14:21:42.665 12927 12933 I zygote64 After code cache collection, code=60KB, data=49KB
10-31 14:21:42.665 12927 12933 I zygote64 Increasing code cache capacity to 256KB
10-31 14:21:43.831 12927 12927 W InputMethodManager startInputReason = 3
10-31 14:21:43.900 12927 12927 D AndroidRuntime Shutting down VM
10-31 14:21:43.907 12927 12927 E AndroidRuntime FATAL EXCEPTION: main
10-31 14:21:43.907 12927 12927 E AndroidRuntime Process: com.mycompany.myapp, PID: 12927
10-31 14:21:43.907 12927 12927 E AndroidRuntime java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
10-31 14:21:43.907 12927 12927 E AndroidRuntime at com.mycompany.myapp.kada.getView(kada.java:38)
如果存在,我需要知道我的代碼中的錯誤&謝謝。
我自己發現了問題:
在適配器 java 文件kada.java 中,當我需要將氣泡布局膨脹到 ListView 中時,我沒有定義行視圖。 膨脹代碼必須是:
LayoutInflater li=(LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row=li.inflate(R.layout.me,parent,false);
而不是:
LayoutInflater li=(LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
li.inflate(R.layout.me,parent,false);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.