title: Fragment and Activities
body: <p>Hello I am creating an application in Android using Tab Layout. I am not good with fragments and I cant get it to work, the application displays the right layout but button and stuff like that is unresponsive. Here is my code (I cant make the first class "FragmentActivity" because the caller wont accept that </p>
  
  <pre><code>public class ebookC extends android.support.v4.app.Fragment {
  
  
  
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                               @Nullable Bundle savedInstanceState) {
  
  
          return inflater.inflate(R.layout.layout_ebook, container, false);
      }
  
      @Override
      public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
          super.onViewCreated(view, savedInstanceState);
  
  
      }
  
  
      public static class ebookr extends FragmentActivity {
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.layout_ebook);
              Button button= (Button) findViewById(R.id.nextbt);
              final TextView textView = (TextView) findViewById(R.id.pageCount);
              button.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      textView.setText("Works????");
                  }
              });
  
          }
      }
  }
  </code></pre>