我有这个活动列出了一些我提供刷新按钮的信息.我刷新它的方式(可能不是最好的方法)只是重新启动活动.为了使后台堆栈以我需要的方式工作,我需要将FLAG_ACTIVITY_CLEAR_TOP标志传递给intent并且它工作正常.但是为了给出一种错觉,即信息正在刷新活动中的信息而不是完全重新启动它,我还需要添加标志FLAG_ACTIVITY_NO_ANIMATION.到目前为止,我还没有能够让这两个标志一起工作.我尝试了以下方法:
theIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION+Intent.FLAG_ACTIVITY_CLEAR_TOP);
theIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION|Intent.FLAG_ACTIVITY_CLEAR_TOP);
theIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
theIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Run Code Online (Sandbox Code Playgroud)
清除顶部适用于所有这些,但动画仍然存在.任何帮助将不胜感激.
我有一个应用程序,它在服务器上提取存储为xml文件的公告,并将每个公告的标题和作者加载到ListView项目中.我还需要存储每个项目的是每个公告的ID,但我实际上不需要显示它.我想可能将ID存储在我用来填充列表的哈希映射中,然后找到点击标题的相关ID,但我认为使用它是不安全的,因为两个公告可能具有相同的标题(以及作者和日期) .我还考虑过为每个项目添加一个不可见的TextView来存储ID,但这会导致布局问题.最后,我搜索了一下,发现了setTag()和getTag(),我觉得这对我想做的事情很完美,但我不确定如何在SimpleAdapter中使用它们(我对这个比较新... ).如果TextView的想法是我需要做的(尽管我对此表示怀疑),这里是我为每个项目使用的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6dip"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<LinearLayout
android:orientation="horizontal"
android:id="@+id/items"
android:weightSum="100"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@android:id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="85"/>
<LinearLayout
android:orientation="vertical"
android:id="@+id/itemCB"
android:layout_weight="15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<CheckBox
android:id="@+id/cbSelected"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我正在使用以下适配器来填充列表:
for(int i = 0; i < ann.length; i++)
{
map = new HashMap<String, String>();
map.put("line1", ann[i].getTitle());
map.put("line2", "Posted by: " + ann[i].getAuthor() + "\n" + ann[i].date.toLongString());
list.add(map);
}
String[] from = { "line1", …Run Code Online (Sandbox Code Playgroud) 我是Spring Web服务的新手,我一直收到这个错误:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionParser for element [annotation-driven]
Offending resource: ServletContext resource [/WEB-INF/spring-ws-servlet.xml]
Run Code Online (Sandbox Code Playgroud)
经过一番挖掘,看起来我很可能在我的架构和罐子之间存在版本不匹配但是我没有看到哪里(我正在为v3.1拍摄).
这是我库中的每个Spring jar:
M2_REPO\org\springframework\spring-aop\3.1.1.RELEASE\spring-aop-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-asm\3.1.1.RELEASE\spring-asm-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-beans\3.1.1.RELEASE\spring-beans-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-context\3.1.1.RELEASE\spring-context-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-context-support\3.1.1.RELEASE\spring-context-support-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-core\3.1.1.RELEASE\spring-core-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-expression\3.1.1.RELEASE\spring-expression-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-jdbc\3.1.1.RELEASE\spring-jdbc-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-jms\3.1.1.RELEASE\spring-jms-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-oxm\3.1.1.RELEASE\spring-oxm-3.1.1.RELEASE.jar
M2_REPO\org\springframework\ws\spring-oxm\1.5.10\spring-oxm-1.5.10.jar
M2_REPO\org\springframework\ws\spring-oxm-tiger\1.5.10\spring-oxm-tiger-1.5.10.jar
M2_REPO\org\springframework\security\spring-security-acl\3.1.1.RELEASE\spring-security-acl-3.1.1.RELEASE.jar
M2_REPO\org\springframework\security\spring-security-config\3.1.1.RELEASE\spring-security-config-3.1.1.RELEASE.jar
M2_REPO\org\springframework\security\spring-security-core\3.1.1.RELEASE\spring-security-core-3.1.1.RELEASE.jar
M2_REPO\org\springframework\security\spring-security-remoting\3.1.1.RELEASE\spring-security-remoting-3.1.1.RELEASE.jar
M2_REPO\org\springframework\security\spring-security-taglibs\3.1.1.RELEASE\spring-security-taglibs-3.1.1.RELEASE.jar
M2_REPO\org\springframework\security\spring-security-web\3.1.1.RELEASE\spring-security-web-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-test\3.1.1.RELEASE\spring-test-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-tx\3.1.1.RELEASE\spring-tx-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-web\3.1.1.RELEASE\spring-web-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-webmvc\3.1.1.RELEASE\spring-webmvc-3.1.1.RELEASE.jar
M2_REPO\org\springframework\ws\spring-ws-core\2.1.2.RELEASE\spring-ws-core-2.1.2.RELEASE.jar
M2_REPO\org\springframework\ws\spring-ws-core-tiger\1.5.10\spring-ws-core-tiger-1.5.10.jar
M2_REPO\org\springframework\ws\spring-xml\1.5.10\spring-xml-1.5.10.jar
Run Code Online (Sandbox Code Playgroud)
弹簧-WS-servlet.xml中
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/web-services
http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:component-scan base-package="my.package"/>
<sws:annotation-driven />
<sws:dynamic-wsdl id="MyService"
portTypeName="MyServiceInterface"
locationUri="/myService/">
<sws:xsd location="/WEB-INF/mySchema.xsd" />
</sws:dynamic-wsdl>
</beans>
Run Code Online (Sandbox Code Playgroud)
web.xml中
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" …Run Code Online (Sandbox Code Playgroud) 我正在尝试获取Windows Server 2003计算机上正在运行的进程及其文件路径的列表.我正在使用以下代码尝试这样做:
protected Map<String,String> getProcesses() {
Map<String,String> processes = new HashMap<String,String>();
try {
String line;
Process p = null;
// Windows
if (OS.indexOf("win") >= 0) {
p = Runtime.getRuntime().exec("wmic process get description,executablepath");
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
LOG.info("Entering while loop");
while ((line = input.readLine()) != null) {
LOG.info("blah");
String[] array = line.split("\\s+");
if (array.length > 1) {
processes.put(array[0], array[1]);
}
}
LOG.info("Exited while loop");
input.close();
}
} catch (Exception e) {
e.printStackTrace();
}
return processes;
}
Run Code Online (Sandbox Code Playgroud)
该程序在while条件下陷入无限循环."blah"和"退出while循环"从不输出到日志.我在win7本地机器和服务器上的命令提示符下运行命令,输出信息就好了.我也在我的本地机器上运行了上面的代码也工作正常.看起来Java和Windows Server …