title: Firebase Android Fragment int null
body: <p>I make <code>FragmentViewPost</code> in Fragment, it shows error. But if I build <code>ViewPost</code> not in Fragment project it work. I don't know what issue that makes error in Fragment</p>
  
  <blockquote>
    <p>java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.support.v7.widget.RecyclerView.findViewById(int)' on a null object reference</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code> public class FragmentViewPost extends Fragment {
  
          public static FragmentViewPost newInstance() {
              FragmentViewPost fragment = new FragmentViewPost();
              return fragment;
          }
  
  
          public FragmentViewPost() {
              // Required empty public constructor
          }
  
  
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                   Bundle savedInstanceState) {
              // Inflate the layout for this fragment
              return inflater.inflate(R.layout.fragment_fragment_view_post, container, false);
          }
  
          private RecyclerView mBlogList;
          private DatabaseReference mDatabase;
          private FirebaseAuth mAuth;
          private FirebaseAuth.AuthStateListener mAuthListener;
  
          @Override
          public void onViewCreated(View view, Bundle savedInstanceState) {
              mAuth = FirebaseAuth.getInstance();
              mAuthListener = new FirebaseAuth.AuthStateListener() {
                  @Override
                  public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
  
                      if(firebaseAuth.getCurrentUser() == null){
  
  
                          startActivity();
  
                      }
                  }
              };
  
              mDatabase = FirebaseDatabase.getInstance().getReference().child("Blog");
              mBlogList = (RecyclerView) mBlogList.findViewById(R.id.blog_list_fragment); &lt;&lt;&lt; Problem
  
              mBlogList.setHasFixedSize(true);
              mBlogList.setLayoutManager(new LinearLayoutManager(getContext()));
  
          }
  
          private void startActivity() {
  
              Intent loginIntent = new Intent(getActivity(),PageLogin.class);
              loginIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
              startActivity(loginIntent);
  
          }
  
  
          @Override
          public void onStart() {
              super.onStart();
  
              mAuth.addAuthStateListener(mAuthListener);
  
              FirebaseRecyclerAdapter&lt;Blog, BlogViewHolder&gt; firebaseRecyclerAdapter = new FirebaseRecyclerAdapter&lt;Blog, BlogViewHolder&gt;(
  
                      Blog.class,
                      R.layout.blog_row,
                      BlogViewHolder.class,
                      mDatabase
  
              ) {
                  @Override
                  protected void populateViewHolder(BlogViewHolder viewHolder, Blog model, int position) {
  
                      viewHolder.setTitle(model.getTitle());
                      viewHolder.setDesc(model.getDesc());
                      viewHolder.setImage(getApplicationContext(), model.getImage());
  
                  }
              };
  
              mBlogList.setAdapter(firebaseRecyclerAdapter);
          }
  
  
  
          public static class BlogViewHolder extends RecyclerView.ViewHolder{
  
              View mView;
  
              public BlogViewHolder(View itemView) {
                  super(itemView);
  
                  mView = itemView;
              }
  
              public void setTitle(String title){
  
                  TextView post_title = (TextView) mView.findViewById(R.id.post_title);
                  post_title.setText(title);
              }
  
              public void setDesc(String desc){
  
                  TextView post_desc = (TextView) mView.findViewById(R.id.post_desc);
                  post_desc.setText(desc);
              }
  
              public void setImage(Context ctx, String image){
                  ImageView post_image = (ImageView) mView.findViewById(R.id.post_image);
                  Picasso.with(ctx).load(image).into(post_image);
              }
          }
  
      //    @Override
      //    public boolean onCreateOptionsMenu(Menu menu) {
      //        getMenuInflater().inflate(R.menu.menu_post, menu);
      //        return super.onCreateOptionsMenu(menu);
      //    }
  
          @Override
          public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
              inflater.inflate(R.menu.menu_post, menu);
              super.onCreateOptionsMenu(menu,inflater);
          }
      }
  </code></pre>
  
  <p>Detail error: </p>
  
  <pre><code>mBlogList = (RecyclerView) mBlogList.findViewById(R.id.blog_list_fragment);
  </code></pre>