我已经编写了一个添加时间的函数,如下所示
private void Delay15Minute() {
String pkManifest = manifest.pkManifestNo;
manifest_helper = new manifest_helper(this);
cursor = manifest_helper.GetDeliveries(pkManifest);
cursor.moveToFirst();
for (int i = 0; i < cursor.getCount(); i++) {
cursor.getString(cursor.getColumnIndex("PKDelivery"));
// String
// RevisedTime=cursor.getString(cursor.getColumnIndex("RevisedEstimatedDeliveryTime"));
String RevisedTime = "12:55";
// get hour and minute from time string
StringTokenizer st1 = new StringTokenizer(RevisedTime, ":");
int j = 0;
int[] val = new int[st1.countTokens()];
// iterate through tokens
while (st1.hasMoreTokens()) {
val[j] = Integer.parseInt(st1.nextToken());
j++;
}
// call time add method with current hour, minute …Run Code Online (Sandbox Code Playgroud) 我已将我的apk文件转换为字节数组,并使用webservice发送它,如下所示
[WebMethod]
public byte[] GetApkFile(string deviceID)
{
try
{
string path = ServiceHelper.GetTempFilePath();
string fileName = path + "\\VersionUpdate.apk";
FileStream fileStream = File.OpenRead(fileName);
return ConvertStreamToByteBuffer(fileStream);
}
catch (Exception ex)
{
throw ex;
}
}
public byte[] ConvertStreamToByteBuffer(System.IO.Stream theStream)
{
int b1;
System.IO.MemoryStream tempStream = new System.IO.MemoryStream();
while ((b1 = theStream.ReadByte()) != -1)
{
tempStream.WriteByte(((byte)b1));
}
return tempStream.ToArray();
}
Run Code Online (Sandbox Code Playgroud)
我已经在我的android应用程序中使用ksoap协议消耗了Web服务作为数组的字节,如下所示
public void DownloadApkFile(String serverIPAddress,
String deviceId) {
String SOAP_ACTION = "http://VisionEPODWebService/GetApkFile";
String OPERATION_NAME = "GetApkFile";
String WSDL_TARGET_NAMESPACE = "http://VisionEPODWebService/";
String SOAP_ADDRESS …Run Code Online (Sandbox Code Playgroud) 我已经在我的一个主要活动课程中启动了我的服务.问题是,当我的应用程序没有运行时,我想停止我的服务.我怎么能实现这个.有任何选项可以在不使用任何按钮单击停止它的情况下停止它或控件的其他点击事件.
还有什么方法可以在我的应用程序运行时指示服务是否正在运行
最初使用System.Xml.Linq dll版本3.5.0.0我删除了空元素,如下所示
XDocument document = XDocument.Load(_fileName);
document.Descendants().Where(e => string.IsNullOrEmpty(e.Value)).Remove();
document.Save(_fileName, SaveOptions.DisableFormatting);
Run Code Online (Sandbox Code Playgroud)
现在我的System.Xml.Linq DLL版本是4.0.0.0,但上面的代码无法正常工作,因为我无法看到Where子句.
任何人都可以帮助我如何重写代码删除4.0.0.0中的空元素
我已经编写了一个以24小时格式添加时间的功能,如下所示
for (int i = 0; i < cursor.getCount(); i++) {
String RevisedTime="00:00";
// get hour and minute from time string
StringTokenizer st1 = new StringTokenizer(RevisedTime, ":");
int j = 0;
int[] val = new int[st1.countTokens()];
// iterate through tokens
while (st1.hasMoreTokens()) {
val[j] = Integer.parseInt(st1.nextToken());
j++;
}
// call time add method with current hour, minute and minutesToAdd,
// return added time as a string
String date = addTime(val[0], val[1], 15);
}
public String addTime(int hour, int minute, int …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我使用下面的代码检查了是否存在ineternet连接
private boolean isNetworkAvailable() {
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null; }
Run Code Online (Sandbox Code Playgroud)
现在的问题是,我如何检查是否存在对一台远程计算机Ip的依赖...我需要连接到外部IP网络服务.....需要检查连接到那个.假设链接就像是如下
有人请帮助我,我有一个if子句,其中有两个条件检查通过或条件,但它不工作我已经给出了下面的代码
if ((!"C".equals(FKLoadStatus))||(!"D".equals(FKLoadStatus)))
{
confirm_Depot_button.setEnabled(true);
}
else
{
confirm_Depot_button.setEnabled(false);
}
Run Code Online (Sandbox Code Playgroud) 我收到以下错误
“通讯对象System.ServiceModel.Channels.ServiceChannel无法用于通讯,因为它处于故障状态。”
using (SecurityClient securityClient = new SecurityClient())
{
SecurityService.GetIncomingPermissionsByIdRequest securityRequest =
new GetIncomingPermissionsByIdRequest(Convert.ToInt32(recordId));
SecurityService.GetIncomingPermissionsByIdResponse securityResponse =
securityClient.GetIncomingPermissionsById(securityRequest);
incomingPermissions = securityResponse.GetIncomingPermissionsByIdResult;
SetPermissionFields();
SetPermissionList();
securityClient.Close();
}
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我能够发送请求,但是当涉及到响应行并尝试获取响应时,它会移至错误状态并遇到上述错误。在移至响应之前,我已经检查了SecurityClient的状态行,则它处于已创建状态。但是,当尝试获取响应时,它将进入故障状态。
请问有人可以帮我吗?我尝试了堆栈中提到的一些方法,但没有找到解决方案。
我已经编写了一个条件if if检查字符串FKLoadStatus是否为"C".但即使字符串FKLoadStatus返回值"C"本身也无法工作......任何人都会检查代码中是否有任何错误.... ..我正在从sqllite数据库中获取FKLoadStatus的值
sql=" SELECT trim(FKLoadStatus) as FKLoadStatus , tblLoad.PKLoad, " +
"date(tblLoad.PlannedLoadDate) AS PlannedLoadDate, tblLoad.Carrier," +
" tblLoad.FKCarrierDriver, COUNT(tblDelivery.FKLoad) AS NoOfDeliveries ," +
" DriverReportTime FROM tblLoad LEFT OUTER JOIN tblDelivery" +
" ON tblLoad.PKLoad = tblDelivery.FKLoad WHERE PKLoad = ? " +
" GROUP BY FKLoadStatus , tblLoad.PKLoad, tblLoad.PlannedLoadDate, " +
" tblLoad.Carrier, tblLoad.FKCarrierDriver , DriverReportTime";
dbAdapter = new DatabaseAdapter(this);
dbAdapter.open();
cursor=dbAdapter.ExecuteRawQuery(sql,strpkManifest);
if (cursor.moveToFirst())
ManifestNo.setText(cursor.getString(cursor
.getColumnIndex("PKLoad")));
ManifestDate.setText(cursor.getString(cursor
.getColumnIndex("PlannedLoadDate")));
Carrier.setText(cursor.getString(cursor.getColumnIndex("Carrier")));
CarrierDriver.setText(cursor.getString(cursor.getColumnIndex("FKCarrierDriver")));
DepotReportTime.setText(cursor.getString(cursor.getColumnIndex("DriverReportTime")));
NoofDeliveries.setText(cursor.getString(cursor.getColumnIndex("NoOfDeliveries")));
FKLoadStatus=cursor.getString(cursor.getColumnIndex("FKLoadStatus"));
if FKLoadStatus!="C" )
{
confirm_Depot_button.setEnabled(true); …Run Code Online (Sandbox Code Playgroud)