我是新的android,我正在制作一个应用程序,其中一个可以下载文件到下载文件夹(使用下载管理器).如果我去模拟器中的下载文件夹,我可以看到图片.因此,如果我想显示下载文件的幻灯片,我如何才能访问该文件夹?其次,如何为此代码添加进度条: -
import java.util.Arrays;
import android.app.Activity;
import android.app.DownloadManager;
import android.app.DownloadManager.Query;
import android.app.DownloadManager.Request;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
public class Download_managerActivity extends Activity {
private long quueue_for_url;
private DownloadManager dm;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { …Run Code Online (Sandbox Code Playgroud) 我是maven的新手.我试图添加JAXB2插件和依赖项来从xsd生成xml文件.当我在依赖项下添加时,标记下会抛出错误: -
生命周期配置未涵盖的插件执行:org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.7.4:generate(执行:默认,阶段:生成源)
该错误标记在jaxb2插件中的标记上.我在互联网上引用解决方案时添加了这个标签,但没有任何作用.
我的pom.xml看起来像这样: -
<build>
<finalName>PatternsWebapp</finalName>
<defaultGoal>install</defaultGoal>
<pluginManagement>
<plugins>
<!-- This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.appfuse.plugins
</groupId>
<artifactId>
maven-warpath-plugin
</artifactId>
<versionRange>
[2.1.0,)
</versionRange>
<goals>
<goal>add-classes</goal>
</goals>
</pluginExecutionFilter>
<action>
<execution></execution>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.7.4</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
<schemaDirectory>src/main/resources</schemaDirectory> …Run Code Online (Sandbox Code Playgroud) 我想查询Oracle 10g数据库,并根据住宅地址按升序或降序获得结果.所以问题是建立地址的时间是110C或200D,所以根据sql"order by"asc或desc,我在20之前得到200D的结果.例如,如果地址是10 110 112 200D 232 95 20 100A 1050 944
按升序排列将导致: -
10 100 100A 1050 110 112 20 200D 232 944 95
Run Code Online (Sandbox Code Playgroud)
问题是因为地址中有字符,我不能认为它们是整数或数字,它们必须被视为字符串.
我试图<div>在HTML中打印选定的标签.我尝试使用这样的CSS:
<style media="print">
.onlyscreen {
display: none;
}
</style>
<html>
<body>
<div class="onlyscreen">
<p>Hello</p>
<div>
<p> Inner tag</p>
</div>
</div>
<input type="submit" value="Print Report" onclick="window.print()">
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
不打印"内部标签".这是一种有用的技术,但是当有分层<div>标签时它会失败.
我也试过这个JavaScript:
function printContent(id) {
str = document.getElementById(id).innerHTML;
newwin = window.open('', 'printwin', 'left=100,top=100,width=400,height=400');
newwin.document.write('<HTML>\n<HEAD>\n');
newwin.document.write('<TITLE>Report</TITLE>\n');
newwin.document.write('<script>\n');
newwin.document.write('function chkstate(){\n');
newwin.document.write('if(document.readyState=="complete"){\n');
newwin.document.write('window.close()\n');
newwin.document.write('}\n');
newwin.document.write('else{\n');
newwin.document.write('setTimeout("chkstate()",2000)\n');
newwin.document.write('}\n');
newwin.document.write('}\n');
newwin.document.write('function print_win(){\n');
newwin.document.write('window.print();\n');
newwin.document.write('chkstate();\n');
newwin.document.write('}\n');
newwin.document.write('<\/script>\n');
newwin.document.write('</HEAD>\n');
newwin.document.write('<BODY onload="print_win()">\n');
newwin.document.write(str);
newwin.document.write('</BODY>\n');
newwin.document.write('</HTML>\n');
newwin.document.close();
}
Run Code Online (Sandbox Code Playgroud)
然后通过调用此函数onclick.这个脚本适用于一个<div>标签但不适用于多个标签.例如
<html>
<body>
<div id="print_thistag">
<p>Hello</p> …Run Code Online (Sandbox Code Playgroud) 我尝试从servlet中获取值到我的JSP中,但它会抛出一个NullPointerException或其他一些错误.
这是从JSP获取值的servlet:
buildingprofilerequest.java
package asset.management.arms.buildingprofilemodule;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.sun.xml.internal.ws.client.SenderException;
/**
* Servlet implementation class buildingprofilerequest
*/
public class buildingprofilerequest extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try{
buildingservice building = new buildingservice();
building.setBuilding_name(request.getParameter("combobox"));
building = BuildingDAO.build(building);
request.setAttribute("abcd", building);
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher("/building_profile_details.jsp");
dispatcher.include(request, response);
} …Run Code Online (Sandbox Code Playgroud) 我试图将一个变量输入到ArrayList中,然后添加所有元素。我怎样才能做到这一点?我尝试过的代码如下。谢谢。
ArrayList<String> aListNumbers = new ArrayList<String>();
int abc = 23;
aListNumbers.add("abc");
aListNumbers.add("2");
aListNumbers.add("3");
//Java ArrayList Sum All Elements
int sum = 0;
for(int i=0; i < aListNumbers.size(); i++){
sum = sum + Integer.parseInt(aListNumbers.get(i));
}
System.out.println("Sum of all elements of ArrayList is " + sum);
Run Code Online (Sandbox Code Playgroud) 我有一种情况,我必须在一个表的一列中计算相同类型的字符串数,例如.列将具有如下值: -
苹果,苹果,苹果,橙,橙,香蕉,香蕉,香蕉,香蕉
所以我需要计算所有相同类型的字符串,这意味着查询应该给苹果计数结果3,橙子计数2,香蕉4.
什么可以是偶像查询?