在某些情况下,我希望我的活动(活动A)setResult和其他时间我想要我的活动,startActivity并在调用完成时调用一些参数.
我可以通过启动这一活动一与一些捆绑PARAMATERS,如果该参数存在,那么解决这个问题setResult别人startActivity,但现在我很好奇,如果有无论如何要检查它是如何在第一时间启动了意向
有没有办法确定我的活动A是否已开始结果?
我有一个名为的字符串DateCompareOld, it has the value "Fri Aug 12 16:08:41 EDT 2011".我想将其转换为日期对象.
SimpleDateFormat dateType = new SimpleDateFormat("E M dd H:m:s z yyyy");
Date convertDate = dateType.parse(DateCompareOld);
Run Code Online (Sandbox Code Playgroud)
但每次我尝试这个,我得到一个解析异常.我尝试过其他SimpleDateFormat格式标准,但总是失败.
建议?
我想要一组图像视图,但我不知道如何使用imageview类型的对象填充它.
ImageView[] forAdapter = new ImageView[imageIds.size()];
for(int i = 0; i < imageIds.size(); i++)
{
ImageView mImageView = new ImageView(context);
forAdapter[i] = mImageView.setImageDrawable(((imagesPulled.get(imageIds.get(i)))));
}
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为.setImageDrawable不返回imageview,我不知道任何实际做的对象!
我考虑在数组中使用drawables,但我最终为listview设置了一个arrayadapter,并且我不能使用drawables创建一个R.layout(我会得到一个类转换异常因为xml文件使用的是ImageView而不是drawable类型),所以我只有ImageViews放入一个数组 - 除非我接近错误的问题.
我得到"位图大小超过VM预算",最终我的应用程序.所以我添加了所有这些东西来帮助缓解不断增加的内存占用
BitmapFactory.Options options = new BitmapFactory.Options();
options.inTempStorage = new byte[32*1024];
options.inDither=false; //Disable Dithering mode
options.inPurgeable=true; //Tell to gc that whether it needs free memory, the Bitmap can be cleared
options.inInputShareable=true; //Which kind of reference will be used to recover the Bitmap data after being clear, when it will be used in the future
options.inPreferredConfig = Bitmap.Config.RGB_565;
Drawable pulled = BitmapDrawable.createFromResourceStream(null, null, conn.getInputStream(), "galleryImage", options);
Run Code Online (Sandbox Code Playgroud)
我也在使用weakhashmaps,回收,System.gc()
而这一切都成功地延长了坠机事故.最初具有32M堆的设备在崩溃之前只能处理一些图像,现在它可以处理十几个,但这并不能解决问题.问题是BitMap方法泄漏内存并且根本无法清除.
我该如何解决?图像大小为256x357
我正在尝试使用matches()函数检查用户输入的密码以查找某些条件
"包含六个字母数字字符,至少一个字母和一个数字"
这是我检查字母数字字符的当前条件
pword.matches("([[a-zA-Z]&&0-9])*")
不幸的是在示例中使用"rrrrZZ1"作为密码,这个条件仍然返回false
什么是正确的正则表达式?谢谢
我需要知道如何打开我正在调试的程序的形式.
我在VS2010中加载了一个现有的解决方案,我可以看到代码,但我想看到项目的GUI部分,点击按钮,看看他们带我去的代码部分,设置断点我感觉如何.
我不知道如何在VS2010中看到GUI,我在哪里可以做到这一点?
另外,哪里有一个很好的资源来学习VS2010的来龙去脉?
我不确定为什么我的点击方法不起作用.在此测试中,我希望能够单击图表上的一个圆形节点并显示其编号.徘徊在工作的那种.
我在使用什么图书馆的点击事件,D3?jQuery的?普通的JS?
当我将鼠标悬停在节点上时,我最终想要做工具提示,当我将鼠标移开时让它们消失
http://jsfiddle.net/ericps/b5v4R/
dots.enter()
.append("circle")
//.append("svg:circle")
.attr("class", "dot")
.attr("cx", complete_line.x())
.attr("cy", complete_line.y())
.attr("r",3.5)
.append("title")
.text(function(d){ return d.completed;})
.on("click", function(d) { alert("hello"); });
Run Code Online (Sandbox Code Playgroud) 你好我试着计算怀孕期间还剩多少天,但我认为我的算法不正确
public int getDaysPregnantRemainder_new() {
GregorianCalendar calendar = new GregorianCalendar();
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
long diffDays = 280 - ((getDueDate().getTime() - calendar.getTime()
.getTime()) / (24 * 60 * 60 * 1000));
return (int) Math.abs((diffDays) % 7);
}
Run Code Online (Sandbox Code Playgroud)
我基于280天的期限,getDueDate()是一个Date对象,并getTime()返回毫秒的unix时间
在某些现实世界中,报告的数字有时是一个,我开始认为我的算法是错误的,或者毫秒时间逐渐变得越来越远,或者毫秒时间不够精确,或者格里高利日历功能很奇怪.
总而言之,我不确定,任何洞察力都赞赏
strtotime这个连接方法的部分不起作用
date("m/d/y", strtotime("last ".date("l")." of this ".date("F")))
例
"这个六月的最后一个星期一",这正是前面提到的字符串strtotime翻译的内容
相反,我得到了"12/31/69".