Views in Fragment are null

后端 未结 1 803
余生分开走
余生分开走 2020-12-07 06:12

Im still working on my Android App. Now im facing this problem:

Code:

package smoca.ch.kreagen.Fragments;

import android.content.Context;
import and         


        
相关标签:
1条回答
  • 2020-12-07 06:54

    When you called inflater.inflate, you specified your third parameter, attachToRoot, as false. This means that what gets returned by the inflater is just the view for R.layout.single_idea_fragment_layout. Thus, findViewById should be called on layout rather than container

    title = (TextView) layout.findViewById(R.id.singleIdeaTitle);
    owner = (TextView) layout.findViewById(R.id.singleIdeaOwner);
    description = (TextView) layout.findViewById(R.id.singleIdeaDescription);
    
    0 讨论(0)
提交回复
热议问题