gpt4 book ai didi

java - ViewPager : OutOfResourcesException locking surface

转载 作者:行者123 更新时间:2023-12-01 15:11:27 26 4
gpt4 key购买 nike

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);
}
}
}

类似问题

LINK 1 , LINK 2

帮助,我需要帮助,不知道这些是什么类型的错误,我进行了研究,但没有看到任何合理的答案...这很奇怪,我不知道这些是什么类型的错误。我只是做一个简单的 View 寻呼机,只有两张幻灯片而已。

最佳答案

我从我的 main.java 中发现了问题。我对菜单类(在选项创建上)进行了一半注释,留下了选项创建类,并且 xml 值位于错误的 xml 文件中。对于那些面临此类问题的人,以下是我诊断此问题的方法:

  • 我创建了两个空类,只有一个按钮属性(轻量级 fragment )。
  • 然后我测试了它是否有效。
  • 然后,我尝试了我正在使用的每个 fragment (即登录 Activity 和主 Activity )。就像这个 LoginActivity 和示例 1 fragment 一样。
  • 然后我尝试了 main 和示例 1 或 2,但发现它不起作用,问题出在 main 中,所以我跟踪它并找出了问题所在。

我希望这对您有帮助..
无论如何我用这个View pager extensions完善我的项目。

关于java - ViewPager : OutOfResourcesException locking surface,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12291941/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com