title: myAdapter cannot be resolved
body: <p>I am trying to create a ViewPager in Android but Android Studio tells me that 'myAdapter cannot be resolved'. This is my code:</p>
  
  <pre><code>public class MainActivity extends FragmentActivity {
  
  GridView gridview_id;
  FloatingActionButton fab_main;
  ViewPager pager;
  objectAdapter oa;
  MainActivity activity;
  Fragment fragment;
  
  
  
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      MenuInflater inflater =  getMenuInflater();
      inflater.inflate(R.menu.menu, menu);
      final MenuItem searchItem = menu.findItem(R.id.action_search);
      SearchView searchView = (SearchView)
              MenuItemCompat.getActionView(searchItem);
      searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
              oa.filter(query);
  
  
              return false;
          }
  
          @Override
          public boolean onQueryTextChange(String newText) {
  
  
              return false;
          }
  
  
      });
      return true;
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      fab_main = (FloatingActionButton) findViewById(R.id.fab_main);
      gridview_id = (GridView) findViewById(R.id.gridview_id);
      pager = (ViewPager) findViewById(R.id.pager);
      fab_main.show();
  
      AdView mAdView = (AdView) findViewById(R.id.adView);
      //AdRequest adRequest = new AdRequest.Builder()
              //.addTestDevice("YOUR_DEVICE_HASH")
              //.build();
  
      //do not make visible while testing!!
      mAdView.loadAd(adRequest);
  
  
      android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
  
  
      gridview_id.setAdapter(new objectAdapter(this));
      pager.setAdapter(new myAdapter(fragmentManager));
  
      class myAdapter extends FragmentPagerAdapter {
  
  
          public myAdapter(android.support.v4.app.FragmentManager fm) {
              super(fm);
  
          }
  
          @Override
          public android.support.v4.app.Fragment getItem(int position) {
              if (position == 0) {
                  activity = new MainActivity();
  
              }
              if (position == 1) {
                  fragment = new DailyIntakeActivity();
                  fab_main.hide();
              }
              return null;
          }
  
          @Override
          public int getCount() {
              return 2;
          }
      }
  
              setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
              fab_main.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      fab_main.hide();
                      onSearchRequested();
  
                  }
  
  
              });
  
              gridview_id.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                      fab_main.hide();
                      Intent intent = new Intent(view.getContext(), SecondActivity.class);
                      objectAdapter.ViewHolder holder = (objectAdapter.ViewHolder) view.getTag();
                      SingleItem temp = (SingleItem) holder.myItem.getTag();
                      intent.putExtra("image", temp.image);
                      if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
                          ActivityOptionsCompat options = ActivityOptions.makeSceneTransitionAnimation(MainActivity.this, temp.image, getString(R.string.image_transition));
                          startActivity(intent, options.toBundle());
                      } else {
                          startActivity(intent);
                      }
  
                  }
              });
  
          }
      }
  </code></pre>