08-16 17:37:37.694: ERROR/InputDispatcher(61): channel '40803d28 com.myApp.android/com.myApp.android.PickActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
08-16 17:37:37.694: ERROR/InputDispatcher(61): channel '40803d28 com.myApp.android/com.myApp.android.PickActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
有时我也会看到这条消息。
08-16 17:44:21.092: ERROR/InputDispatcher(61): Received spurious receive callback for unknown input channel. fd=177, events=0x8
所以这只发生在 2.3.3 模拟器中,而不是 3.0 或 2.2 或我测试过的任何其他模拟器,甚至在我的 Froyo Droid Incredible 真实设备上也能很好地工作。没有错误。
每当我在 2.3.3 模拟器中打开应用程序的主 Activity 时,大约 5-7 秒后,我总会看到上面的日志消息并且 Activity 关闭。我不确定这意味着什么。我以前从未见过这个。
以下是该 Activity 的一些代码 fragment 。这是应用程序的主要 Activity ,在登录到应用程序时向用户显示,然后他们可以从 4 个图标中进行选择以启动各自的 Activity 。
另外我想值得一提的是,这个 Activity 有一个 MillenialMedia 横幅广告底部,它再次获取广告并且在所有其他模拟器和设备中工作正常。
公共(public)类 PickActivity 扩展 Activity 实现 OnClickListener、MMAdListener{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFormat(PixelFormat.RGBA_8888);
setContentView(R.layout.main);
// Instantiate shared preferences
mAppPreferences = PreferenceManager.getDefaultSharedPreferences(this);
mEditor = mAppPreferences.edit();
// Instantiate the views
setupViews();
Hashtable<String, String> map = new Hashtable<String, String>();
map.put("keywords", "shopping,deals,money,coupons,sports");
//include additional metadata or settings in the hashmap
MMAdView adView = new MMAdView(this, MYAPID, MMAdView.BANNER_AD_BOTTOM, 30, map);
adView.setId(123);
FrameLayout adFrameLayout = (FrameLayout)findViewById(R.id.mm_layout);
LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
adFrameLayout.addView(adView, lp);
}
然后我实现了 onStart、onStop 和 onResume。
这里是setupViews方法
private void setupViews() {
yourA = (ImageButton)findViewById(R.id.MA);
yourA.setOnClickListener(this);
yourC = (ImageButton)findViewById(R.id.MC);
yourC.setOnClickListener(this);
yourM = (ImageButton)findViewById(R.id.MM);
yourM.setOnClickListener(this);
yourS = (ImageButton)findViewById(R.id.MS);
yourS.setOnClickListener(this);
//Action bar Help button
helpButton = (ImageButton)findViewById(R.id.ActionHelpButton);
helpButton.setOnClickListener(this);
// Action bar Video button
videoButton = (ImageButton)findViewById(R.id.ActionVideoButton);
videoButton.setVisibility(View.VISIBLE);
videoButton.setOnClickListener(this);
// Footer marquee TextView
footerText = (TextView) findViewById(R.id.FooterMarquee);
}
我还在带有日志消息的类中添加了 MMAdListener 默认方法。
请帮我找出为什么这只在 2.3.3 模拟器中发生并且 Activity 被关闭。
感谢您的帮助。
最佳答案
我有同样的错误。我的应用正在调用 REST 服务,因此添加
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
Android list 为我解决了这个问题。
关于android - 这发生在什么时候?为什么? Android App Activity 正在关闭 2.3.3 模拟器并出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7082663/
类classAprivatedeffooputs:fooendpublicdefbarputs:barendprivatedefzimputs:zimendprotecteddefdibputs:dibendendA的实例a=A.new测试a.foorescueputs:faila.barrescueputs:faila.zimrescueputs:faila.dibrescueputs:faila.gazrescueputs:fail测试输出failbarfailfailfail.发送测试[:foo,:bar,:zim,:dib,:gaz].each{|m|a.send(m)resc
我有一个模型:classItem项目有一个属性“商店”基于存储的值,我希望Item对象对特定方法具有不同的行为。Rails中是否有针对此的通用设计模式?如果方法中没有大的if-else语句,这是如何干净利落地完成的? 最佳答案 通常通过Single-TableInheritance. 关于ruby-on-rails-Rails-子类化模型的设计模式是什么?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.co
我正在使用的第三方API的文档状态:"[O]urAPIonlyacceptspaddedBase64encodedstrings."什么是“填充的Base64编码字符串”以及如何在Ruby中生成它们。下面的代码是我第一次尝试创建转换为Base64的JSON格式数据。xa=Base64.encode64(a.to_json) 最佳答案 他们说的padding其实就是Base64本身的一部分。它是末尾的“=”和“==”。Base64将3个字节的数据包编码为4个编码字符。所以如果你的输入数据有长度n和n%3=1=>"=="末尾用于填充n%
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
为什么4.1%2返回0.0999999999999996?但是4.2%2==0.2。 最佳答案 参见此处:WhatEveryProgrammerShouldKnowAboutFloating-PointArithmetic实数是无限的。计算机使用的位数有限(今天是32位、64位)。因此计算机进行的浮点运算不能代表所有的实数。0.1是这些数字之一。请注意,这不是与Ruby相关的问题,而是与所有编程语言相关的问题,因为它来自计算机表示实数的方式。 关于ruby-为什么4.1%2使用Ruby返
它不等于主线程的binding,这个toplevel作用域是什么?此作用域与主线程中的binding有何不同?>ruby-e'putsTOPLEVEL_BINDING===binding'false 最佳答案 事实是,TOPLEVEL_BINDING始终引用Binding的预定义全局实例,而Kernel#binding创建的新实例>Binding每次封装当前执行上下文。在顶层,它们都包含相同的绑定(bind),但它们不是同一个对象,您无法使用==或===测试它们的绑定(bind)相等性。putsTOPLEVEL_BINDINGput
我可以得到Infinity和NaNn=9.0/0#=>Infinityn.class#=>Floatm=0/0.0#=>NaNm.class#=>Float但是当我想直接访问Infinity或NaN时:Infinity#=>uninitializedconstantInfinity(NameError)NaN#=>uninitializedconstantNaN(NameError)什么是Infinity和NaN?它们是对象、关键字还是其他东西? 最佳答案 您看到打印为Infinity和NaN的只是Float类的两个特殊实例的字符串
如果您尝试在Ruby中的nil对象上调用方法,则会出现NoMethodError异常并显示消息:"undefinedmethod‘...’fornil:NilClass"然而,有一个tryRails中的方法,如果它被发送到一个nil对象,它只返回nil:require'rubygems'require'active_support/all'nil.try(:nonexisting_method)#noNoMethodErrorexceptionanymore那么try如何在内部工作以防止该异常? 最佳答案 像Ruby中的所有其他对象
关闭。这个问题需要detailsorclarity.它目前不接受答案。想改进这个问题吗?通过editingthispost添加细节并澄清问题.关闭8年前。Improvethisquestion为什么SecureRandom.uuid创建一个唯一的字符串?SecureRandom.uuid#=>"35cb4e30-54e1-49f9-b5ce-4134799eb2c0"SecureRandom.uuid方法创建的字符串从不重复?
我刚刚被困在这个问题上一段时间了。以这个基地为例:moduleTopclassTestendmoduleFooendend稍后,我可以通过这样做在Foo中定义扩展Test的类:moduleTopmoduleFooclassSomeTest但是,如果我尝试通过使用::指定模块来最小化缩进:moduleTop::FooclassFailure这失败了:NameError:uninitializedconstantTop::Foo::Test这是一个错误,还是仅仅是Ruby解析变量名的方式的逻辑结果? 最佳答案 Isthisabug,or