android当前的上下文环境,android – 在没有当前上下文的情况下调用...

当我从我正在显示谷歌地图的网页视图切换到另一个视图时,偶尔只会偶然关闭我的应用程序(没有强制关闭对话框,只需关闭).我在logcat中收到此错误:

E / libEGL(29103):调用没有当前上下文的OpenGL ES API(每个线程记录一次)

有任何想法吗?

我有一个mainActivity,它为每个页面使用不同的“视图”.以下是main中用于调用视图的代码:

private void changeCardDisplayed(int index) {

// Log.i(DEBUG_TAG, "changeCardDisplay index is " + index);

if (mCardLayout != null){

mCardLayout.destroy();

} else {

mCardLayout = new CardLayout(this);

}

if (mMapView != null) mMapView.destroy();

mCardLayout = null;

mMapView = null;

mCardContainer.removeAllViews();

mMapsContainer.removeAllViews();

if (mWD != null) {

mAdView.makeAdRequest(mWD.cityId, mWD.iconCode);

}

System.gc();

switch (index) {

case ACCUWX.Views.CURRENT_VIEW:

mCardLayout = new CurrentView(this);

break;

case ACCUWX.Views.FORECAST_VIEW:

mCardLayout = new ForecastView(this);

break;

case ACCUWX.Views.HOURLY_VIEW:

mCardLayout = new HourlyListView(this);

break;

case ACCUWX.Views.LIFESTYLE_VIEW:

mCardLayout = new LifestyleView(this);

break;

case ACCUWX.Views.VIDEO_VIEW:

mCardLayout = new VideoView(this);

break;

case ACCUWX.Views.NEWS_VIEW:

mCardLayout = new NewsView(this);

break;

case ACCUWX.Views.MAP_VIEW:

mMapView = new MapsView(this);

break;

default: mCardLayout = new CurrentView(this);

break;

}

if (index == ACCUWX.Views.MAP_VIEW) {

mMapsContainer.addView(mMapView);

} else {

mCardContainer.addView(mCardLayout);

}

}

这是CardLayout类:

public class CardLayout extends RelativeLayout {

//XXX Constants

private static final String DEBUG_TAG = "Tablet/CardLayout";

public CardLayout(Context context, AttributeSet attrs) {

super(context, attrs);

}

public CardLayout(Context context) {

super(context);

}

/**

* Updates layout display with the provided WeatherData

* @param wdm

*/

public void update(WeatherData wd) {}

/**

* Tell the view to do any final cleanup

*/

public void destroy(){

// Log.i(DEBUG_TAG, "destroy");

// this.removeAllViews();

}

public int getViewType() {

return ACCUWX.CardViewTypes.get(this.getClass()) == null ? -999 : ACCUWX.CardViewTypes.get(this.getClass());

}

}

以下是在此视图中加载地图的updateView方法MapsView.java:

private void updateView(){

mWebView = (WebView)findViewById(R.id.mapWebView);

mWebView.setFocusable(false);

mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);

Double lat = 0.0;

Double lon = 0.0;

lat = Double.parseDouble(mWd.getCurrentWeatherDataModel().lat);

lon = Double.parseDouble(mWd.getCurrentWeatherDataModel().lon);

mCenterURL = "javascript:mpSetCenter(" + lat + "," + lon + ")";

if (WeatherData.isWaking()) WeatherData.setWakingInMaps(true);

// Log.i(DEBUG_TAG, "centerURL is " + mCenterURL);

if (mWebView != null) {

mWebView.getSettings().setEnableSmoothTransition(true);

mWebView.getSettings().setJavaScriptEnabled(true);

mWebView.setWebViewClient(new WebViewClient() {

@Override

public boolean shouldOverrideUrlLoading(WebView view, String url) {

String GOOGLE = "http://maps.google.com/maps?ll=" + mWd.getCurrentWeatherDataModel().lat + "," + mWd.getCurrentWeatherDataModel().lon +"&z=7&t=m";

URL urlObj;

try {

urlObj = new URL(url);

if(!(TextUtils.equals(urlObj.toString(), TERMS_OF_USE) || TextUtils.equals(urlObj.toString(), GOOGLE))){

return false;

} else if(TextUtils.equals(urlObj.toString(), GOOGLE)) {

return true;

}else if (TextUtils.equals(urlObj.toString(), TERMS_OF_USE)) {

// Open it in phone's browser rather than app's webview

if (mListener!=null)

mListener.showMapsTermsOfUse(TERMS_OF_USE);

return true;

}

} catch (MalformedURLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

return false;

}

@Override

public void onPageFinished(WebView view, String url) {

// Log.i(DEBUG_TAG, "onPageFinished() b4 dimiss dialogs");

Dialogs.dismiss();

mHandler.removeCallbacks(mRunnable);

mHandler.postDelayed(new Runnable() {

@Override

public void run() {

if(mWebView != null) {

// Log.i(DEBUG_TAG, "run() onPageFinished");

mWebView.loadUrl(mCenterURL);

if(Utilities.isTv(mContext)) {

mWebView.loadUrl("javascript:hideMarker()");

}

}

}

}, 1000);

init();

WeatherData.setWakingInMaps(false);

}

@Override

public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {

// Log.i(DEBUG_TAG, "Error, oh noes! " + description);

}

});

mWebView.setWebChromeClient(new WebChromeClient() {

@Override

public boolean onJsAlert(WebView view, String url, String message, JsResult result) {

// Log.i(DEBUG_TAG, "message in onJsAlert is " + message);

result.confirm();

return true;

}

});

if (Utilities.isTv(mContext)) {

mZoomControl = (ZoomControl) findViewById(R.id.zoom_control);

mZoomControl.setVisibility(View.VISIBLE);

mZoomControl.setOnZoomListener(mZoomListener);

mPanningControl = (PanningControl) findViewById(R.id.panning_control);

mPanningControl.setVisibility(View.VISIBLE);

mPanningControl.setPanningListener(mPanningListener);

}

String roundedTime = Utilities.roundMinutes(5);

String url = "http://vortex.accuweather.com/widget/googleMaps/maps_v3_honeycomb.html?cbt=" + roundedTime;

mWebView.loadUrl(url);

// mWebView.loadUrl("file:///android_asset/maps_v3_honeycomb.html");

Dialogs.dismiss();

// Log.i(DEBUG_TAG, "dismiss b4 this stmnt and showLoadingDialog after");

Dialogs.showLoadingDialog((android.app.Activity) mContext);

mHandler.postDelayed(mRunnable, 30000);

consumeKeyEvent(this.findViewById(R.id.mapLayout));

}

}

更新:

我有一个带有我的应用程序的预加载版本的平板电脑,当我安装我当前的代码时,我得到这是我崩溃的原因:(如果我因为预加载而更改包名称,以便我可以直接从Eclipse加载它,应用程序没有关闭,这是我得到那个OpenGL日志)

01-11 14:54:03.277: I/DEBUG(30128): handle_crashing_process(9)

01-11 14:54:03.277: I/DEBUG(30128): reading tid

01-11 14:54:03.277: I/DEBUG(30128): BOOM: pid=30589 uid=10040 gid=10040 tid=30589

01-11 14:54:03.277: I/DEBUG(30128): waitpid: n=30589 status=0000137f

01-11 14:54:03.277: I/DEBUG(30128): stopped -- continuing

01-11 14:54:03.277: I/DEBUG(30128): waitpid: n=30589 status=00000b7f

01-11 14:54:03.277: I/DEBUG(30128): stopped -- fatal signal

01-11 14:54:03.277: I/DEBUG(30128): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

01-11 14:54:03.277: I/DEBUG(30128): Build fingerprint: 'Huawei/MediaPad/hws7300u:3.2/HuaweiMediaPad/C201B021:user/release-keys'

01-11 14:54:03.277: I/DEBUG(30128): pid: 30589, tid: 30589 >>> com.accuweather.android.tablet <<<

01-11 14:54:03.277: I/DEBUG(30128): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 000073dc

01-11 14:54:03.277: I/DEBUG(30128): r0 00dfae78 r1 000073dc r2 00000060 r3 00000001

01-11 14:54:03.277: I/DEBUG(30128): r4 00dfae78 r5 00000042 r6 00207a34 r7 00000060

01-11 14:54:03.277: I/DEBUG(30128): r8 0000004b r9 000073dc 10 00000060 fp 00000001

01-11 14:54:03.277: I/DEBUG(30128): ip 00000003 sp bec4dfd4 lr 8288bec1 pc aff0c9e8 cpsr 80000010

01-11 14:54:03.277: I/DEBUG(30128): d0 0000a0000000a000 d1 000001c0000001a8

01-11 14:54:03.277: I/DEBUG(30128): d2 0000100000000006 d3 0000204000000002

01-11 14:54:03.277: I/DEBUG(30128): d4 000000000000000f d5 0000000000000000

01-11 14:54:03.277: I/DEBUG(30128): d6 00000000000000ff d7 0000000000000000

01-11 14:54:03.277: I/DEBUG(30128): d8 0000000000000000 d9 430b000041200000

01-11 14:54:03.277: I/DEBUG(30128): d10 3f0000003ea655c4 d11 0000004040800000

01-11 14:54:03.277: I/DEBUG(30128): d12 00000000000000c5 d13 0000000000000000

01-11 14:54:03.277: I/DEBUG(30128): d14 0000000000000000 d15 0000000000000000

01-11 14:54:03.277: I/DEBUG(30128): d16 43c8000000000000 d17 c418000043c80400

01-11 14:54:03.277: I/DEBUG(30128): d18 3efffee044180200 d19 40b794363efffee0

01-11 14:54:03.277: I/DEBUG(30128): d20 4113d70a3f800000 d21 007007983f800000

01-11 14:54:03.277: I/DEBUG(30128): d22 00000c0707010701 d23 0009000000000000

01-11 14:54:03.277: I/DEBUG(30128): d24 0000000000000000 d25 3ff0000000000000

01-11 14:54:03.277: I/DEBUG(30128): d26 0000000000000000 d27 3ff0000000000000

01-11 14:54:03.277: I/DEBUG(30128): d28 3ff2fe0de7600000 d29 0000000000000000

01-11 14:54:03.277: I/DEBUG(30128): d30 3ff0000000000000 d31 0000000000000000

01-11 14:54:03.277: I/DEBUG(30128): scr 8000001b

01-11 14:54:03.387: I/DEBUG(30128): #00 pc 0000c9e8 /system/lib/libc.so

01-11 14:54:03.387: I/DEBUG(30128): #01 lr 8288bec1 /system/lib/egl/libGLESv2_adreno200.so

01-11 14:54:03.387: I/DEBUG(30128): libc base address: aff00000

01-11 14:54:03.387: I/DEBUG(30128): code around pc:

01-11 14:54:03.387: I/DEBUG(30128): aff0c9c8 f440428d 1afffff5 e212207f 0a00001e

01-11 14:54:03.387: I/DEBUG(30128): aff0c9d8 e3520020 ba000007 e320f000 e1a0c2a2

01-11 14:54:03.387: I/DEBUG(30128): aff0c9e8 f421028d e25cc001 f400028d 1afffffb

01-11 14:54:03.387: I/DEBUG(30128): aff0c9f8 e212201f 0a000014 e2522010 ba000002

01-11 14:54:03.387: I/DEBUG(30128): aff0ca08 f4610a8d f4400a8d 0a00000f e1b0ce82

01-11 14:54:03.387: I/DEBUG(30128): code around lr:

01-11 14:54:03.387: I/DEBUG(30128): 8288bea0 f505fb01 18111e6a f507fa51 f707fa15

01-11 14:54:03.387: I/DEBUG(30128): 8288beb0 e0082500 46494620 35019a0b edeef7d2

01-11 14:54:03.387: I/DEBUG(30128): 8288bec0 19e49a0c 45454491 e0eadbf4 00a92301

01-11 14:54:03.387: I/DEBUG(30128): 8288bed0 fa131e4a 1811f007 f307fa51 f007fa13

01-11 14:54:03.387: I/DEBUG(30128): 8288bee0 980b900f ede6f7d2 28004607 80d6f000

01-11 14:54:03.387: I/DEBUG(30128): stack:

01-11 14:54:03.387: I/DEBUG(30128): bec4df94 00000000

01-11 14:54:03.387: I/DEBUG(30128): bec4df98 00000043

01-11 14:54:03.387: I/DEBUG(30128): bec4df9c 00214a08

01-11 14:54:03.387: I/DEBUG(30128): bec4dfa0 82876009 /system/lib/egl/libGLESv2_adreno200.so

01-11 14:54:03.387: I/DEBUG(30128): bec4dfa4 00207a34

01-11 14:54:03.387: I/DEBUG(30128): bec4dfa8 00000000

01-11 14:54:03.387: I/DEBUG(30128): bec4dfac 0000004b

01-11 14:54:03.387: I/DEBUG(30128): bec4dfb0 00000004

01-11 14:54:03.387: I/DEBUG(30128): bec4dfb4 00000009

01-11 14:54:03.387: I/DEBUG(30128): bec4dfb8 00000001

01-11 14:54:03.387: I/DEBUG(30128): bec4dfbc 82889053 /system/lib/egl/libGLESv2_adreno200.so

01-11 14:54:03.387: I/DEBUG(30128): bec4dfc0 00000001

01-11 14:54:03.387: I/DEBUG(30128): bec4dfc4 00000004

01-11 14:54:03.387: I/DEBUG(30128): bec4dfc8 df002777

01-11 14:54:03.387: I/DEBUG(30128): bec4dfcc e3a070ad

01-11 14:54:03.387: I/DEBUG(30128): bec4dfd0 00000018

01-11 14:54:03.387: I/DEBUG(30128): #00 bec4dfd4 00dfae78

01-11 14:54:03.387: I/DEBUG(30128): bec4dfd8 00000000

01-11 14:54:03.387: I/DEBUG(30128): bec4dfdc 00000009

01-11 14:54:03.387: I/DEBUG(30128): bec4dfe0 00dfb570

01-11 14:54:03.387: I/DEBUG(30128): bec4dfe4 000000d7

01-11 14:54:03.387: I/DEBUG(30128): bec4dfe8 00000475

01-11 14:54:03.387: I/DEBUG(30128): bec4dfec aff135e3 /system/lib/libc.so

01-11 14:54:03.387: I/DEBUG(30128): bec4dff0 00000000

01-11 14:54:03.387: I/DEBUG(30128): bec4dff4 00000004

01-11 14:54:03.387: I/DEBUG(30128): bec4dff8 002ea397

01-11 14:54:03.387: I/DEBUG(30128): bec4dffc 00000000

01-11 14:54:03.387: I/DEBUG(30128): bec4e000 00000000

01-11 14:54:03.387: I/DEBUG(30128): bec4e004 00000060

01-11 14:54:03.387: I/DEBUG(30128): bec4e008 fffff380

01-11 14:54:03.387: I/DEBUG(30128): bec4e00c 00001c20

01-11 14:54:03.387: I/DEBUG(30128): bec4e010 00000320

01-11 14:54:03.387: I/DEBUG(30128): bec4e014 00000018

01-11 14:54:03.387: I/DEBUG(30128): bec4e018 009043fc

01-11 14:54:04.897: I/BootReceiver(23874): Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)

01-11 14:54:04.907: I/DEBUG(30128): detaching

01-11 14:54:04.907: I/DEBUG(30128): debuggerd committing suicide to free the zombie!

01-11 14:54:04.917: I/DEBUG(30857): debuggerd: Sep 11 2011 00:30:27

01-11 14:54:04.977: E/InputDispatcher(23874): channel '41764b18 com.accuweather.android.tablet/com.accuweather.android.tablet.Main (server)' ~ Consumer closed input channel or an error occurred. events=0x8

01-11 14:54:04.977: E/InputDispatcher(23874): channel '41764b18 com.accuweather.android.tablet/com.accuweather.android.tablet.Main (server)' ~ Channel is unrecoverably broken and will be disposed!

01-11 14:54:04.987: I/WindowManager(23874): WIN DEATH: Window{41764b18 com.accuweather.android.tablet/com.accuweather.android.tablet.Main paused=false}

01-11 14:54:04.997: I/ActivityManager(23874): Process com.accuweather.android.tablet (pid 30589) has died.

01-11 14:54:04.997: I/WindowManager(23874): WINDOW DIED Window{41764b18 com.accuweather.android.tablet/com.accuweather.android.tablet.Main paused=false}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值