title: java.lang.OutOfMemoryError: Failed to allocate
body: <p>So I made an activity with a viewPager, and well, it crashes as soon as the <code>viewPager.setAdapter</code> works. Here's the crash log.</p>
  
  <pre><code>java.lang.OutOfMemoryError: Failed to allocate a 26488162 byte allocation with 16777216 free bytes and 24MB until OOM
                    at java.lang.StringFactory.newStringFromChars(Native Method)
                    at java.lang.AbstractStringBuilder.toString(AbstractStringBuilder.java:629)
                    at java.lang.StringBuffer.toString(StringBuffer.java:723)
                    at java.io.StringWriter.toString(StringWriter.java:100)
                    at android.util.Log.getStackTraceString(Log.java:345)
                    at com.android.internal.os.RuntimeInit.Clog_e(RuntimeInit.java:61)
                    at com.android.internal.os.RuntimeInit.-wrap0(RuntimeInit.java)
                    at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:86)
                    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
                    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
  </code></pre>
  
  <p>Here's the activity's class </p>
  
  <pre><code>public class SetupActivity extends AppCompatActivity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_setup);
          ViewPager setupPager = (ViewPager) findViewById(R.id.setupViewpager); 
          SetupPagerAdapter setupPagerAdapter = new SetupPagerAdapter(getSupportFragmentManager());    
          setupPager.setAdapter(setupPagerAdapter);
     }
  }
  </code></pre>
  
  <p>Here's the <code>SetupPagerAdapter</code></p>
  
  <pre><code>public class SetupPagerAdapter extends FragmentPagerAdapter {
      public SetupPagerAdapter(FragmentManager fm) {
          super(fm);
      }
  
      @Override
      public Fragment getItem(int position) {
          if(position == 0){
              return new SetupFragmentOne().newInstance();
          }
          return null;
      }
  
      @Override
      public int getCount() {
          return 1;
      }
  }
  </code></pre>
  
  <p>and Here's <code>SetupFragmentOne</code></p>
  
  <pre><code>public class SetupFragmentOne extends Fragment {
      public SetupFragmentOne newInstance() {
          SetupFragmentOne fragment = new SetupFragmentOne();
          return fragment;
      }
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.setup_fragment_1, container);
          Typeface typeface = Typeface.createFromAsset(getContext().getAssets(),"coolvetica_rg.ttf");
          TextView tv = (TextView) view.findViewById(R.id.setupText1);
          tv.setTypeface(typeface);
          return view;
      }
  }
  </code></pre>