Question

E/Surface(11901): Surface (identity=16464) requestBuffer(1, 0, 0, 0, 00000033) 
    returned a buffer with a null handle
E/Surface(11901): getBufferLocked(1, 0, 0, 0, 00000033) failed (Out of memory)
E/Surface(11901): dequeueBuffer failed (Out of memory)
E/ViewRoot(11901): OutOfResourcesException locking surface
E/ViewRoot(11901): android.view.Surface$OutOfResourcesException
E/ViewRoot(11901):  at android.view.Surface.lockCanvasNative(Native Method)
E/ViewRoot(11901):  at android.view.Surface.lockCanvas(Surface.java:314)
E/ViewRoot(11901):  at android.view.ViewRoot.draw(ViewRoot.java:1467)
E/ViewRoot(11901):  at android.view.ViewRoot.performTraversals(ViewRoot.java:1260)
E/ViewRoot(11901):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1873)
E/ViewRoot(11901):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/ViewRoot(11901):  at android.os.Looper.loop(Looper.java:130)
E/ViewRoot(11901):  at android.app.ActivityThread.main(ActivityThread.java:3703)
E/ViewRoot(11901):  at java.lang.reflect.Method.invokeNative(Native Method)
E/ViewRoot(11901):  at java.lang.reflect.Method.invoke(Method.java:507)
E/ViewRoot(11901):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller
    .run(ZygoteInit.java:841)
E/ViewRoot(11901):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
E/ViewRoot(11901):  at dalvik.system.NativeStart.main(Native Method)

E/Surface(11901): Surface (identity=16461) requestBuffer(1, 0, 0, 0, 00000033) 
    returned a buffer with a null handle
E/Surface(11901): getBufferLocked(1, 0, 0, 0, 00000033) failed (Out of memory)
E/Surface(11901): dequeueBuffer failed (Out of memory)
E/ViewRoot(11901): OutOfResourcesException locking surface
E/ViewRoot(11901): android.view.Surface$OutOfResourcesException
E/ViewRoot(11901):  at android.view.Surface.lockCanvasNative(Native Method)
E/ViewRoot(11901):  at android.view.Surface.lockCanvas(Surface.java:314)
E/ViewRoot(11901):  at android.view.ViewRoot.draw(ViewRoot.java:1467)
E/ViewRoot(11901):  at android.view.ViewRoot.performTraversals(ViewRoot.java:1260)
E/ViewRoot(11901):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1873)
E/ViewRoot(11901):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/ViewRoot(11901):  at android.os.Looper.loop(Looper.java:130)
E/ViewRoot(11901):  at android.app.ActivityThread.main(ActivityThread.java:3703)
E/ViewRoot(11901):  at java.lang.reflect.Method.invokeNative(Native Method)
E/ViewRoot(11901):  at java.lang.reflect.Method.invoke(Method.java:507)
E/ViewRoot(11901):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller
    .run(ZygoteInit.java:841)
E/ViewRoot(11901):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
E/ViewRoot(11901):  at dalvik.system.NativeStart.main(Native Method)

E/Surface(11901): Surface (identity=16462) requestBuffer(1, 0, 0, 0, 00000033) 
    returned a buffer with a null handle
E/Surface(11901): getBufferLocked(1, 0, 0, 0, 00000033) failed (Out of memory)
E/Surface(11901): dequeueBuffer failed (Out of memory)
E/ViewRoot(11901): OutOfResourcesException locking surface
E/ViewRoot(11901): android.view.Surface$OutOfResourcesException
E/ViewRoot(11901):  at android.view.Surface.lockCanvasNative(Native Method)
E/ViewRoot(11901):  at android.view.Surface.lockCanvas(Surface.java:314)
E/ViewRoot(11901):  at android.view.ViewRoot.draw(ViewRoot.java:1467)
E/ViewRoot(11901):  at android.view.ViewRoot.performTraversals(ViewRoot.java:1260)
E/ViewRoot(11901):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1873)
E/ViewRoot(11901):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/ViewRoot(11901):  at android.os.Looper.loop(Looper.java:130)
E/ViewRoot(11901):  at android.app.ActivityThread.main(ActivityThread.java:3703)
E/ViewRoot(11901):  at java.lang.reflect.Method.invokeNative(Native Method)
E/ViewRoot(11901):  at java.lang.reflect.Method.invoke(Method.java:507)
E/ViewRoot(11901):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller
    .run(ZygoteInit.java:841)
E/ViewRoot(11901):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
E/ViewRoot(11901):  at dalvik.system.NativeStart.main(Native Method)

E/Surface(11901): Surface (identity=16463) requestBuffer(1, 0, 0, 0, 00000033) 
    returned a buffer with a null handle
E/Surface(11901): getBufferLocked(1, 0, 0, 0, 00000033) failed (Out of memory)
E/Surface(11901): dequeueBuffer failed (Out of memory)
E/ViewRoot(11901): OutOfResourcesException locking surface
E/ViewRoot(11901): android.view.Surface$OutOfResourcesException
E/ViewRoot(11901):  at android.view.Surface.lockCanvasNative(Native Method)
E/ViewRoot(11901):  at android.view.Surface.lockCanvas(Surface.java:314)
E/ViewRoot(11901):  at android.view.ViewRoot.draw(ViewRoot.java:1467)
E/ViewRoot(11901):  at android.view.ViewRoot.performTraversals(ViewRoot.java:1260)
E/ViewRoot(11901):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1873)
E/ViewRoot(11901):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/ViewRoot(11901):  at android.os.Looper.loop(Looper.java:130)
E/ViewRoot(11901):  at android.app.ActivityThread.main(ActivityThread.java:3703)
E/ViewRoot(11901):  at java.lang.reflect.Method.invokeNative(Native Method)
E/ViewRoot(11901):  at java.lang.reflect.Method.invoke(Method.java:507)
E/ViewRoot(11901):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller
    .run(ZygoteInit.java:841)
E/ViewRoot(11901):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
E/ViewRoot(11901):  at dalvik.system.NativeStart.main(Native Method)

ViewPagerFragment.java

package nsixty.crew.app;

import java.util.List;
import java.util.Vector;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;

import com.viewpagerindicator.TitlePageIndicator;
import com.viewpagerindicator.TitleProvider;

public class ViewPagerFragment extends FragmentActivity {

    private CustomFragmentAdapter mPagerAdapter;

    ViewPager pager;
    TitlePageIndicator titleIndicator;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.viewpager);

        this.initialisePaging();

    }

    private void initialisePaging() {

        List<Fragment> fragments = new Vector<Fragment>();

        fragments
                .add(Fragment.instantiate(this, LoginActivity.class.getName()));
        fragments.add(Fragment.instantiate(this, main.class.getName()));
        this.mPagerAdapter = new CustomFragmentAdapter(
                super.getSupportFragmentManager(), fragments);
        pager = (ViewPager) findViewById(R.id.viewpager);
        pager.setAdapter(this.mPagerAdapter);
//        titleIndicator = (TitlePageIndicator) findViewById(R.id.);
//        titleIndicator.setViewPager(pager);
    }

    public static class CustomFragmentAdapter extends FragmentPagerAdapter
            implements TitleProvider {
        public static final int POSITION_PAGE_1 = 0;
        public static final int POSITION_PAGE_2 = 1;
        public static final int POSITION_PAGE_3 = 2;
        private List<Fragment> fragments;
        private static final String[] TITLES = new String[] { "LOGIN", "HOME" };
        public static final int NUM_TITLES = TITLES.length;

        @Override
        public String getTitle(int position) {
            return TITLES[position];
        }

        public CustomFragmentAdapter(FragmentManager fm,
                List<Fragment> fragments) {
            super(fm);
            this.fragments = fragments;
        }

        @Override
        public int getCount() {
            // return this.fragments.size();
            return NUM_TITLES;
        }

        @Override
        public Fragment getItem(int position) {

            try {
                LoginActivity.class.newInstance();
            } catch (InstantiationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return this.fragments.get(position);
        }
    }
}

Similar Questions

LINK 1, LINK 2

Help, I need help don't know what kind of error is these I have research and I didn't see any answer reasonable... its very strange, I don't know what kind of error is these. Am just doing a simple view pager of just two slides that's all.

Was it helpful?

Solution

I found out the problem from my main.java. I had menu classes (on option create) half commented leaving the on option create class and the xml values were on the wrong xml file.. For those of you facing this kind of problem, here is what I did to diagnose this problem:

  • I create two empty classes with just a button property (light weight fragments).
  • Then I tested it worked.
  • Then I tried one of each fragment I was using (i.e login activity and main activity) ..like this LoginActivity and sample 1 fragment worked.
  • Then I tried main and sample 1 or 2 and I found out it didn't work and the problem was in main so I traced it and I found out what it was.

I hope this was helpful..
Anyway I use this View pager extensions to perfect my project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top