に結合に対する、私はこのようなビューコンポーネントに私のホルダーコンストラクタにButterKnife、およびBindViewをバインドしていますアンドロイドButterKnifeにNullPointer私は私のCustomAdapterクラスのレイアウトコンポーネントをバインドしようCustomAdapter
public static class Holder
{
public Holder(View view)
{
ButterKnife.bind(this,view);
}
@BindView(R.id.txtName)
TextView tvName;
@BindView(R.id.txtGroup)
TextView tvGroup;
@BindView(R.id.imageProfile)
ImageView img;
}
と、このGetViewメソッドです:
FATAL EXCEPTION: main
Process: com.project.echo.contactmanagement, PID: 2861
java.lang.RuntimeException: Unable to bind views for com.project.echo.contactmanagement.mainscreen.CustomAdapter$Holder
at butterknife.ButterKnife.bind(ButterKnife.java:189)
at butterknife.ButterKnife.bind(ButterKnife.java:167)
at com.project.echo.contactmanagement.mainscreen.CustomAdapter$Holder.<init>(CustomAdapter.java:61)
at com.project.echo.contactmanagement.mainscreen.CustomAdapter.getView(CustomAdapter.java:76)
at android.widget.AbsListView.obtainView(AbsListView.java:2263)
at android.widget.ListView.makeAndAddView(ListView.java:1790)
at android.widget.ListView.fillDown(ListView.java:691)
at android.widget.ListView.fillFromTop(ListView.java:752)
at android.widget.ListView.layoutChildren(ListView.java:1630)
at android.widget.AbsListView.onLayout(AbsListView.java:2091)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:437)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1994)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1751)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1007)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5677)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5021)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at butterknife.internal.Finder$1.findView(Finder.java:12)
at butterknife.internal.Finder.findOptionalView(Finder.java:64)
at butterknife.internal.Finder.findRequiredView(Finder.java:48)
at com.project.echo.contactmanagement.mainscreen.CustomAdapter$Holder$$ViewBinder.bind(CustomAdapter$Holder$$ViewBinder.java:17)
at com.project.echo.contactmanagement.mainscreen.CustomAdapter$Holder$$ViewBinder.bind(CustomAdapter$Holder$$ViewBinder.java:12)
at butterknife.ButterKnife.bind(ButterKnife.java:187)
at butterknife.ButterKnife.bind(ButterKnife.java:167)
at com.project.echo.contactmanagement.mainscreen.CustomAdapter$Holder.<init>(CustomAdapter.java:61)
at com.project.echo.contactmanagement.mainscreen.CustomAdapter.getView(CustomAdapter.java:76)
at android.widget.AbsListView.obtainView(AbsListView.java:2263)
at android.widget.ListView.makeAndAddView(ListView.java:1790)
at android.widget.ListView.fillDown(ListView.java:691)
at android.widget.ListView.fillFromTop(ListView.java:752)
at android.widget.ListView.layoutChildren(ListView.java:1630)
at android.widget.AbsListView.onLayout(AbsListView.java:2091)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:437)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14852)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1994)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1751)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1007)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5677)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5021)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
at dalvik.system.NativeStart.main(Native Method)
:
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Holder holder=new Holder(convertView);
View rowView;
rowView = inflater.inflate(R.layout.contact_list, null);
//holder.tvName=(TextView)rowView.findViewById(R.id.txtName);
holder.tvName.setText(result.get(position));
//holder.img=(ImageView) rowView.findViewById(R.id.imageProfile);
holder.img.setImageBitmap(imageId.get(position));
//holder.tvGroup=(TextView)rowView.findViewById(R.id.txtGroup);
holder.tvGroup.setText(listGroup.get(position));
rowView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(context, "You Clicked "+result.get(position), Toast.LENGTH_LONG).show();
}
});
return rowView;
}
しかし、私はそれを実行すると、それはNullPointerExceptionが引き金、これはメッセージであります
誰でもこの問題で私を助けることができますか?
をエラーが 'ホルダーホルダーは=新しいホルダー(ですconvertView) 'を実行します。あなたは 'convertView'がnullではないと確信していますか? –