我想OnLongClickListener在列表视图中添加.每当用户长按列表中的项目时,应执行一些操作,但我的代码不会捕获此侦听器.请让我知道我哪里出错了.类似的代码setOnItemClickListener非常适用.
这是代码:
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> arg0, View v,
int index, long arg3) {
// TODO Auto-generated method stub
Log.d("in onLongClick");
String str=listView.getItemAtPosition(index).toString();
Log.d("long click : " +str);
return true;
}
});
Run Code Online (Sandbox Code Playgroud) 嗨,我正在使用3层从头开始创建一个登录表单.我已经设法构建一个工作表单来检查用户数据是否正确.如果他填写了错误的数据,他会得到一条消息.但现在我需要创建一个存储id的会话.
我在网上搜索过,他们说你必须添加Session["sessionName"]= data,但如果我打字,Session["userId"]=s.studentNummer他就不会识别任何东西.将会话放在DAL或DLL中会更好吗?我想在DAL(函数checkLogin)中编写它.有人能帮帮我吗?
这是我的代码:
DALstudent.cs
public class DALstudent
{
dc_databankDataContext dc = new dc_databankDataContext();
public void insertStudent(Student s)
{
dc.Students.InsertOnSubmit(s);
dc.SubmitChanges();
}
public bool checkLogin(string ID, string passw)
{
bool canlogin = false;
var result = (from s in dc.Students
where s.studentNummer == ID && s.studentPasswoord == passw
select s).Count();
if (result == 1)
{
canlogin = true;
}
else
{
canlogin = false;
}
return canlogin;
}
}
Run Code Online (Sandbox Code Playgroud)
BLLstudent.cs
public class BLLstudent
{
DALstudent DALstudent …Run Code Online (Sandbox Code Playgroud) 我目前正在尝试编写一个拦截文本消息的应用程序,并根据该消息的内容做出反应.我试图_receivedMessage:(struct __CKSMSRecord *)message replace:(BOOL)replace在CKSMSService类中挂钩方法,但这似乎根本没有被调用.
有人可以告诉我我必须挂钩的功能/类吗?我需要在文本消息显示并存储到数据库之前拦截它.我在IOS 5.0.1上.
真的很感激任何帮助.
我正在尝试使用Eclipse Galileo为Android开发设置我的工作站.我安装了最新的ADT插件和Android SDK,但是当我尝试运行我创建的任何基本Android项目时,我收到此错误.
eclipse.buildId=M20090917-0800
java.version=1.6.0_17
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.java.product -product org.eclipse.epp.package.java.product
Command-line arguments: -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.java.product -data C:\Documents and Settings\dmcnamar\workspace -product org.eclipse.epp.package.java.product
Error
Tue Jan 26 18:00:41 EST 2010
An internal error occurred during: "Launching HelloWorld".
java.lang.NullPointerException
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.launch(Unknown Source)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.doLaunch(Unknown Source)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(Unknown Source)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:866)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1069)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Run Code Online (Sandbox Code Playgroud) 我正在使用_CrtDumpMemoryLeaks运行良好的函数,但在文档中承诺不仅返回 true 或 false 还打印一些信息。
我尝试使用:
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );
Run Code Online (Sandbox Code Playgroud)
但我的一些代码在屏幕上没有出现。
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <stdio.h>
#include <string.h>
int main() {
slist* students = 0;
clist* courses = 0;
char c;
char buf[100];
int id, num;
malloc(100);
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );
printf("there is memmory leaks?: %d\n",_CrtDumpMemoryLeaks());
system("pause");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
输出没有关于内存泄漏的数据......为什么会这样?
顺便说一下,输出是
是否有内存泄漏?: 1 按任意键继续。. .
我正在使用此代码来获取光标位置:
NSInteger insertionPoint = [[[myTextView selectedRanges] objectAtIndex:0] rangeValue].location;
Run Code Online (Sandbox Code Playgroud)
如何在当前光标位置添加所选文本而不是附加文本?
我有WPF APP我想用SQLite怎么做这样的事情?
(顺便说一句,我理解如何在Adobe Air中做这样的事情,但在WPF中这对我来说是一个很大的问题,所以在\比较怎么做的一些解释是Big + ...)
我找不到用于提取当前日/月/年的批处理文件语法的简单细分.
我有以下语法来声明用作目录名的变量;
set folder=%date:~10,4%%date:~7,2%%date:~4,2%
Run Code Online (Sandbox Code Playgroud)
任何人都可以对波浪线,双重百分比意味着什么发光(或发布链接)?我似乎无法完全从直觉中解读它.
我有一个应用程序,我正在我的PC上使用MonoTouch构建.使用deploy to device时出现此错误
/Developer/MonoTouch/usr/bin/mtouch -installdev "/SVN/myapp/bin/iPhone/Release/my.app"
Please ensure your device is connected...
Connected to: myiPad
This application has been signed with a provisioning profile which does not include any device
Connected to: myiPad
Installing application
Installation failed: AMDeviceInstallApplication returned: 0xe8000050
The application was terminated by a signal: SIGHUP
Run Code Online (Sandbox Code Playgroud)
我试过iPhone 4和iPad 2.
我可以将my.app拖到iTunes或iPhone配置实用程序中,并在任一设备上安装它都没有错误.然后按预期运行.
我已经将我的ffmpeg版本升级到最新的提交.现在我可以看到音频解码功能avcodec_decode_audio3已被弃用,当我使用新功能时avcodec_decode_audio4,根据其中所需的更改,我得到错误为
[amrnb @ 003a5000] get_buffer() failed.
我无法找到导致此错误的原因.任何人都有一个使用这个新功能的示例:
avcodec_decode_audio4((AVCodecContext *avctx, AVFrame *frame,int *got_frame_ptr, AVPacket *avpkt);