谁能告诉我这是怎么回事。当我在数据库中添加数据时出现此错误。它仅针对特定行发生。我尝试通过互联网寻找答案或理由。但徒劳无功。截图
public void FunSetVisitorDetails(String strResult) {
Log.d(TAG, "Get Visitor Details started.");
if (!strResult.equalsIgnoreCase("NA") && !strResult.equalsIgnoreCase("NI")) {
SQLiteDatabase database = getWritableDatabase();
database.delete("TBL_VISITOR_MASTER", null, null);
String[] strResultData = strResult.split("#");
for (int index = 0; index < strResultData.length; index++) {
String[] strRowData = strResultData[index].split(",");
ContentValues values = new ContentValues();
values.put("VISITORID", strRowData[0]);
values.put("MEMBERID", strRowData[1]);
values.put("TEAMID", strRowData[2]);
values.put("CATEGORY", strRowData[3]);
values.put("NAME", strRowData[4]);
values.put("COMPNAME", strRowData[5]);
values.put("SPECIALIZED1", strRowData[6]);
values.put("SPECIALIZED2", strRowData[7]);
values.put("SPECIALIZED3", strRowData[8]);
values.put("SPECIALIZED4", strRowData[9]);
values.put("SPECIALIZED5", strRowData[10]);
values.put("CLIENT1", strRowData[11]);
values.put("CLIENT2", strRowData[12]);
values.put("CLIENT3", strRowData[13]);
values.put("CLIENT4", strRowData[14]);
values.put("CLIENT5", strRowData[15]);
values.put("ASK", strRowData[16]);
values.put("GIVE", strRowData[17]);
values.put("TAGLINE", strRowData[18]);
values.put("EMAIL", strRowData[19]);
values.put("MOBILE", strRowData[20]);
values.put("WEBSITE", strRowData[21]);
values.put("LOCATION", strRowData[22]);
try{
values.put("COMP_LOGO", strRowData[23]);// it is happening when adding the logo and image below. there is no exception thrown as well.
values.put("PERSON_IMAGE", strRowData[24]);
} catch (Exception e){
e.printStackTrace();
}
database.insert("TBL_VISITOR_MASTER", null, values);
}
最佳答案
我猜是保存图片的错误。您需要保存特定行的位图图像。因此,将列创建为 BLOB 并在其上保存 bytes 的图像。
您会发现很多教程,例如 THIS .
关于android - 对象已收集无法评估 ContentValues.values.tostring(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35519850/
总的来说,我对ruby还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用
我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-
在控制台中反复尝试之后,我想到了这种方法,可以按发生日期对类似activerecord的(Mongoid)对象进行分组。我不确定这是完成此任务的最佳方法,但它确实有效。有没有人有更好的建议,或者这是一个很好的方法?#eventsisanarrayofactiverecord-likeobjectsthatincludeatimeattributeevents.map{|event|#converteventsarrayintoanarrayofhasheswiththedayofthemonthandtheevent{:number=>event.time.day,:event=>ev
我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
我有一个表单,其中有很多字段取自数组(而不是模型或对象)。我如何验证这些字段的存在?solve_problem_pathdo|f|%>... 最佳答案 创建一个简单的类来包装请求参数并使用ActiveModel::Validations。#definedsomewhere,atthesimplest:require'ostruct'classSolvetrue#youcouldevencheckthesolutionwithavalidatorvalidatedoerrors.add(:base,"WRONG!!!")unlesss
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
好的,所以我的目标是轻松地将一些数据保存到磁盘以备后用。您如何简单地写入然后读取一个对象?所以如果我有一个简单的类classCattr_accessor:a,:bdefinitialize(a,b)@a,@b=a,bendend所以如果我从中非常快地制作一个objobj=C.new("foo","bar")#justgaveitsomerandomvalues然后我可以把它变成一个kindaidstring=obj.to_s#whichreturns""我终于可以将此字符串打印到文件或其他内容中。我的问题是,我该如何再次将这个id变回一个对象?我知道我可以自己挑选信息并制作一个接受该信
我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳
如果您尝试在Ruby中的nil对象上调用方法,则会出现NoMethodError异常并显示消息:"undefinedmethod‘...’fornil:NilClass"然而,有一个tryRails中的方法,如果它被发送到一个nil对象,它只返回nil:require'rubygems'require'active_support/all'nil.try(:nonexisting_method)#noNoMethodErrorexceptionanymore那么try如何在内部工作以防止该异常? 最佳答案 像Ruby中的所有其他对象