当我提交页面以加载.net图表控件时,会出现此错误.我在下面的web.config中有http处理程序.因为它似乎不起作用的原因.
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
<add verb="GET" path="FtbWebResource.axd" type="FreeTextBoxControls.AssemblyResourceHandler, FreeTextBox" />
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>
Run Code Online (Sandbox Code Playgroud)
任何想法为什么会出现这个错误?我很难过这个.
我写了一个简单的paypal订阅系统,用户可以输入他们的信息,点击按钮,然后开始订阅.我想知道如何找出用户何时取消订阅?我见过$ txn_type subscr_cancel,但我不知道如何使用它,因为paypal不会再次调用我的处理程序.
谢谢!
这是我的错误:
*** Uncaught remote exception! (Exceptions are not yet supported across processes.)
android.util.AndroidRuntimeException: { what=1008 when=368280372 } This message is already in use.
at android.os.MessageQueue.enqueueMessage(MessageQueue.java:171)
at android.os.Handler.sendMessageAtTime(Handler.java:457)
at android.os.Handler.sendMessageDelayed(Handler.java:430)
at android.os.Handler.sendMessage(Handler.java:367)
at android.view.ViewRoot.dispatchAppVisibility(ViewRoot.java:2748)
Run Code Online (Sandbox Code Playgroud)
我正在尝试的是有一个listview,由自定义列表项填充,每个列表项有多个视图,每个视图都附加一个onclick监听器.当按下这个onClickListener时,它会向一个带有what和arg1参数的Handler发送一条消息.单击我的一个元素会触发启动新活动的意图.单击另一个显示祝酒词.当组合按下这些时,我得到上面的错误.即单击文本以触发意图,(然后按回)然后单击图像以显示吐司,然后当您单击文本再次触发意图时,我获得FC.
这是下面的代码,我试图尽可能多地删除错误的骨头:
如果你想跳到什么重要的,请看ConversationAdapter.class中的onClickListener以及它们如何与StartPage.class交互
Android清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.handler.test"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".StartPage"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DetailsPage"
android:label="DetailsPage"
>
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
</manifest>
Run Code Online (Sandbox Code Playgroud)
StartPage.class:
package com.handler.test;
import java.util.ArrayList;
import android.app.ListActivity;
import android.app.ProgressDialog;
import …Run Code Online (Sandbox Code Playgroud) 我创建了一个扩展Thread的类,通过LocationManager在非ui线程中检索用户位置.我将它作为一个线程实现,因为它必须在请求时启动并在有限的时间内完成它的工作.顺便说一句,我必须在线程中添加一个Looper对象,以便能够为LocationManager(onLocationChanged)创建处理程序.
这是代码:
public class UserLocationThread extends Thread implements LocationListener {
//...
public void run() {
try {
Looper.prepare();
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
Looper.loop();
Looper.myLooper().quit();
} catch (Exception e) {
//...
}
}
@Override
public void onLocationChanged(Location location) {
locationManager.removeUpdates(this);
//...
handler.sendMessage(msg); //this is the handler for communication with father thread
}
//...}
Run Code Online (Sandbox Code Playgroud)
我希望线程启动,接收用户位置数据(在这种情况下只是一次),通过消息将数据发送到主线程给处理程序,然后死掉.问题是,在我的情况下,一旦run方法结束,线程就不会再死了(应该没问题,因为否则onLocationChanged将不会收到新的位置).
但是通过这种方式,假设线程的停止和挂起方法已被弃用,那么至少在这种情况下,使用looper die创建一个线程会是一个好方法吗?
提前致谢 ;)
示例代码:
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(String propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
Run Code Online (Sandbox Code Playgroud)
VS:
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(String propertyName)
{
if (PropertyChanged!= null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
Run Code Online (Sandbox Code Playgroud)
为什么我总是看到人们创建将PropertyChanged分配给"处理程序"而不是仅使用它?
我正在使用以下代码向文本框添加处理程序:
private void frmLogin_Load(object sender, EventArgs e)
{
foreach (Control tb in this.Controls)
{
if (tb is TextBox)
{
TextBox tb1 = (TextBox)tb;
tb1.KeyDown += new KeyEventHandler(TextBox_KeyDown);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我也使用以下代码删除处理程序:
private void frmLogin_FormClosed(object sender, FormClosedEventArgs e)
{
foreach (Control tb in this.Controls)
{
if (tb is TextBox)
{
TextBox tb1 = (TextBox)tb;
tb1.KeyDown -= new KeyEventHandler(TextBox_KeyDown);
}
}
}
Run Code Online (Sandbox Code Playgroud)
是正确的方法还是有更好的选择?
我需要一点帮助,每秒从Runnable/Handler更新我的UI.我正在使用此代码:
Runnable runnable = new Runnable() {
@Override
public void run() {
handler.post(new Runnable() {
@Override
public void run() {
prBar.setProgress(myProgress);
y = (double) ( (double) myProgress/ (double) RPCCommunicator.totalPackets)*100;
txtInfoSync1.setText(Integer.toString((int)y) + "%");
prBar.setMax(RPCCommunicator.totalPackets);
int tmp = totalBytesReceived - timerSaved;
Log.w("","totalBytesReceived : "+totalBytesReceived + " timerSaved : "+timerSaved );
Log.w("","tmp : "+tmp);
if (avgSpeedCalc.size() > 10)
{
avgSpeedCalc.remove(0);
}
avgSpeedCalc.add(tmp);
int x = 0;
for (int y=0;y<avgSpeedCalc.size();y++)
{
x += avgSpeedCalc.get(y);
Log.d("","x : "+x);
}
x = Math.round(x/avgSpeedCalc.size());
Log.e("","x : "+x); …Run Code Online (Sandbox Code Playgroud) 我已经搜索了很多但是通过google-fu'ing不会得到任何结果:(
我有一个已初始化的tinyMCE编辑器,我无法控制初始化过程,因此以下代码根本不起作用:
tinyMCE.init({
...
setup : function(ed) {
ed.onChange.add(function(ed, l) {
console.debug('Editor contents was modified. Contents: ' + l.content);
});
}
});
Run Code Online (Sandbox Code Playgroud)
由于未定义jQuery tinymce插件,因此以下代码不起作用:
$('textarea').tinymce({
setup: function(ed) {
ed.onClick.add(function(ed, e) {
alert('Editor was clicked: ' + e.target.nodeName);
});
}
});
Run Code Online (Sandbox Code Playgroud)
我的意思是,它必须使用tinymce.something语法.
在tinyMCE初始化之后,如何将回调函数绑定到任何tinyMCE事件?
我试图找到一种方法从我的服务发送一个整数值到我的MainActivity,但我无法弄清楚互联网上的教程.我正在使用处理程序来接收我从我的服务中的线程发送的消息.
我在服务中的线程代码:
private class ServiceThread extends Thread {
@Override
public void run() {
super.run();
try{
Log.i("Service", "TASK PERFORMED");
int x = 0;
for (int i = 0; i < 20; i++){
x += (random.nextInt(20) + 20);
}
theInteger = x/20;
Message msg = Message.obtain();
msg.what = MY_RND_INT;
msg.arg1 = theInteger;
handler.sendMessage(msg);
}catch(Exception e){
e.getMessage();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试接收邮件的代码:
public Messenger mMessenger = new Messenger(new IncomingHandler());
class IncomingHandler extends Handler {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case …Run Code Online (Sandbox Code Playgroud)