按照主题.如果我们以前调用cursor.requery(),但现在不推荐使用,那么现在如何调用此函数?
"不推荐使用此方法.请勿使用此方法.只需请求一个新游标,这样您就可以异步执行此操作,并在新光标返回后更新列表视图."
那么如何请求新光标并将其传递回适配器?
目前我这样做是为了在点击编辑文本后获得listview中最后一项的焦点:
bodyText.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
getListView().setSelection(getListView().getCount());
}
});
bodyText.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
getListView().setSelection(getListView().getCount());
}
});
Run Code Online (Sandbox Code Playgroud)
它工作得很好并抓住了最后一项,问题是软键盘出现并覆盖列表视图中的最后3项.有没有办法显示软键盘出现后的最后一项并调整屏幕大小?谢谢!
目前我正在尝试以mime格式读取文件,其中包含一些png的二进制字符串数据.
在Windows中,读取文件为我提供了正确的二进制字符串,这意味着我只需复制字符串并将扩展名更改为png即可看到图片.
在Windows中读取文件后的示例如下:
--fh-mms-multipart-next-part-1308191573195-0-53229
Content-Type: image/png;name=app_icon.png
Content-ID: "<app_icon>"
content-location: app_icon.png
‰PNG
Run Code Online (Sandbox Code Playgroud)
等...等...
在Linux中读取文件后的示例如下:
--fh-mms-multipart-next-part-1308191573195-0-53229
Content-Type: image/png;name=app_icon.png
Content-ID: "<app_icon>"
content-location: app_icon.png
�PNG
Run Code Online (Sandbox Code Playgroud)
等...等...
我无法将Linux版本转换成图片,因为它变成了一些时髦的符号,并且有很多颠倒的"?" 和"1/2"符号.
任何人都可以告诉我发生了什么,也许可以提供解决方案?已经玩了一周以上的代码了.
logpath = LoggerUtils.getProperties().getProperty("log.path");
System.out.println("logpath: " + logpath);
Run Code Online (Sandbox Code Playgroud)
上面的代码返回:
logpath: C:UsersMauriceDesktopLogs
Run Code Online (Sandbox Code Playgroud)
在属性文件中是:
log.path C:\Users\Maurice\Desktop\Logs
Run Code Online (Sandbox Code Playgroud)
如何保留文件分隔符?我希望这也适用于Linux,而不仅仅是Windows.
有没有办法获得当前设置的图像的尺寸ImageButton?我正在努力实现这一目标.
我ImageButton的默认图片为36 x 36.然后我选择尺寸为200 x 200的图片.我想打电话给:
imageButton.setImageBitmap(Bitmap.createScaledBitmap(
bitmap, 36, 36, true));
Run Code Online (Sandbox Code Playgroud)
将图像缩小到36 x 36.我想要获得原始图像大小的原因是为了满足hdpi,mdpi和ldpi,所以我可以将位图的尺寸分别设置为36 x 36,24 x 24和18 x 18把它添加到ImageButton.有任何想法吗?
哦,伙计,我随机摆弄代码后得到了答案:
imageButton.getDrawable().getBounds().height();
imageButton.getDrawable().getBounds().width();
Run Code Online (Sandbox Code Playgroud) 如何HashMap按键的数值对键进行排序?目前,在自然顺序中它看起来像这样:
1 10 13 2 26 29
Run Code Online (Sandbox Code Playgroud)
我希望它看起来像这样:
29 26 13 10 2 1
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我注意到,在将我的jpeg文件转换为位图之后,大小几乎下降了一半,这是正常的吗?我做这样的事情:
bmp1 = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory()
+ "/Test/test" + System.currentTimeMillis()
+ ".jpg");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp1.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] byteArray = stream.toByteArray();
System.out.println(byteArray.length);
Run Code Online (Sandbox Code Playgroud) 参考此链接,如果您只有一个连接,何时是关闭连接的好时机?我总是在后台运行服务.什么时候打电话给这个close()功能好?有什么建议?
我想实现这样的目标:
String sentence = "Hi there over there";
String[]result = sentence.split("there");
//you get result[0] = Hi, result[1] = over
Run Code Online (Sandbox Code Playgroud)
是否可以使用字节数组格式的字符串进行拆分?
byte[]delimiter = "there".getBytes();
byte[]byteSentence = sentence.getBytes();
//then somehow split byteSentence using delimiter.
Run Code Online (Sandbox Code Playgroud) 目前我有一个程序可以拍摄照片并将其作为jpg保存在SD卡的顶层,但它没有出现在Gallery中.我必须做些什么来实现它?
在catalina.out中,我看到此消息出现在日志中:
Maximum number of threads (200) created for connector with address null and port 80
这是否意味着一个过程正在占用某些东西,还是我需要增加线程大小?
重新启动tomcat后,我收到了像这条消息的垃圾邮件:
"SEVERE: The web application [/MyServlet] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation."
有办法解决我的情况吗?