钛的Andr​​oid:查看没有连接到窗口管理器chrash [英] Titanium Android: View not attached to window manager chrash

查看:159
本文介绍了钛的Andr​​oid:查看没有连接到窗口管理器chrash的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个views.In第一种观点,我有一个表视图,我在其细胞中显示远程数据。我显示,而数据下载活动的指标。

选择任一行时

第二种观点得到开放。

当我再回到第一个观点,我通过下载远程数据刷新表视图。

但在Android的,我回来的时候,首先查看并开始下载数据,应用程序得到坠毁由于活动的指标!应用程序崩溃只在Android上,iPhone !!其做工精细

我在刷新表的数据的焦点当前窗口的事件。

错误: -


  

活动org.appcelerator.titanium.TiActivity渗漏窗口
  com.android.internal.policy.impl.PhoneWindow$DecorView@450c4488说
  这里原本是加入E /窗口管理器(324):
  android.view.WindowLeaked:活动
  org.appcelerator.titanium.TiActivity渗漏窗口
  com.android.internal.policy.impl.PhoneWindow$DecorView@450c4488说
  这里原本是加入



  

(主)2225,140482]发送事件:在线程异常:主要
  消息:java.lang.IllegalArgumentException异常:查看没有连接到窗口
  经理;钛1.8.1,2012 / 01/27 17:31,a24502​​a E / TiApplication(
  324):java.lang.IllegalArgumentException异常:查看没有连接到窗口
  经理


EDITED

我的code: -

  VAR currentWindow = Titanium.UI.currentWindow;变种placeTableData = [];
VAR placeTableView = Titanium.UI.createTableView
({
    数据:placeTableData,
    顶部:0dp',
    高度:365dp
});currentWindow.addEventListener('专注',winopened);
功能winopened(五)
{
    placeTableData = createRow();
}功能createRow()
{
    currentWindow.add(活动);
    activity.show();
    currentWindow.touchEnabled = FALSE;    //下载数据    如果(loader1.DONE)
    {
        currentWindow.touchEnabled = TRUE;
        activity.hide();
    }
}


解决方案

解决!我发现,在Android中,当你preSS后退按钮,它不处理正确导航到previous视图。它只是显示没有采取当前视图照顾previous视图。

因此​​,有必要显示另一种观点认为前正确地关闭当前视图。所以我显示previous视图之前关闭当前视图。

当我们preSS后退按钮在Android上,的android:窗口的后面事件 get调用。所以我在这个方法关闭当前窗口,如:

  Titanium.UI.currentWindow.addEventListener('机器人:回'功能(E)
{
    Ti.API.info('后退按钮pressed');
    currentWindow.close();
});

I have two views.In first view, I have a table view and I am displaying remote data in its cells. I am showing activity indicator while data downloading.

Second view gets open when any of row is selected.

When I come back to the first view, I am refreshing the table view by downloading remote data.

But in Android, when I come back to first view and start downloading data, application gets crash due to activity indicator !!! Application crashes only in Android, its working fine in iPhone !!

I am refreshing the table's data in focus event of current window.

the error : -

Activity org.appcelerator.titanium.TiActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@450c4488 that was originally added here E/WindowManager( 324): android.view.WindowLeaked: Activity org.appcelerator.titanium.TiActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@450c4488 that was originally added here

and

(main) [2225,140482] Sending event: exception on thread: main msg:java.lang.IllegalArgumentException: View not attached to window manager; Titanium 1.8.1,2012/01/27 17:31,a24502a E/TiApplication( 324): java.lang.IllegalArgumentException: View not attached to window manager

EDITED

my code : -

var currentWindow = Titanium.UI.currentWindow;

var placeTableData = [] ;
var placeTableView = Titanium.UI.createTableView
({
    data:placeTableData,
    top:'0dp',
    height:'365dp'
});

currentWindow.addEventListener('focus',winopened);
function winopened(e)
{
    placeTableData = createRow();
}

function createRow() 
{   
    currentWindow.add(activity);
    activity.show();    
    currentWindow.touchEnabled = false;

    // downloading data 

    if(loader1.DONE)
    {
        currentWindow.touchEnabled = true ;
        activity.hide();
    }
}

解决方案

Solved !!! I found that, in Android, when you press back button, it doesn't handle proper navigation to the previous view. It simply displays previous view without take care of current view.

So it necessary to close current view properly before displaying another view. So I closed current view before displaying the previous view.

When we press back button on Android, android:back event of Window get call. So I closed current window in this method , like :

Titanium.UI.currentWindow.addEventListener('android:back',function(e)
{
    Ti.API.info('back button pressed');
    currentWindow.close();
});

这篇关于钛的Andr​​oid:查看没有连接到窗口管理器chrash的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆