这个声音很简单,我无法弄清楚为什么我找不到答案哈哈
我有一个工作的声音池类(感谢教程和我做过的一些调整),它工作正常.
现在的问题是我希望能够随机改变我的背景音乐.(并不总是在循环中有相同的音乐,但有2或3,当一个完成时,我播放其他2个中的一个).
问题是我找不到通知音乐播放完毕的方法.
有任何想法吗 ?
贾森
我开始使用XML文件和解析器作为存储数据的便捷方式
我想使用DTD来检查xml文件到达时的结构.
这是我的DTD文件
< ?xml version="1.0" encoding="UTF-8"?>
< !ELEMENT document (level*)>
< !ELEMENT level (file,filelName?,fileNumber?)>
< !ELEMENT file (#PCDATA)>
< !ELEMENT filelName (#PCDATA)>
< !ELEMENT fileNumber (#PCDATA)>
Run Code Online (Sandbox Code Playgroud)
(请注意,fileName和fileNumber实际上是纯可选的)
和
<document>
<level>
<file>group1file01</file>
</level>
<level>
<file>group1file02</file>
<fileName>file 2</fileName>
<fileNumber>0</fileNumber>
</level>
...
Run Code Online (Sandbox Code Playgroud)
所以这一切都很好.(我现在使用eclipse"validate"选项来测试它)
然而,在测试时我得到了我认为是一个奇怪的错误
如果我做
<level>
<levelName>Level 2</levelName>
<levelNumber>0</levelNumber>
<file>group1level02</file>
</level>
Run Code Online (Sandbox Code Playgroud)
更改行的顺序,Eclipse拒绝验证它...
我想知道这是否是Eclipse的问题,或者订单是否真的很重要.
如果订单很重要,我怎样才能更改DTD以使其无论元素的排序如何都能正常工作?
我无法真正改变XML,因为我已经编写了所有的XML文件和解析器(我知道我的方法是错误的)
我目前正在使用这个UIAlertView进行登录弹出,
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Restricted"
message:@"Please Enter Code to Enable Fields"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Login"
, nil];
alert.alertViewStyle = UIAlertViewStyleSecureTextInput;
[alert show];
Run Code Online (Sandbox Code Playgroud)
但是,我希望文本输入是数字键盘而不是常规键盘
有没有一种简单的方法可以做到这一点,或者我是否需要研究创建自定义UIAleartView
大家好
我正在与我的程序斗争,以便在正确的时间刷新它.
并没有很多成功哈哈
我有两个问题
Q1:当界面发生变化时我应该使用哪个:重绘还是无效?
Q2:什么时候应该打电话?我知道这听起来很愚蠢,但由于SwingWorker和其他线程操作,我实际上遇到了问题.
这应该很简单,但我找不到任何关于此的信息......
我只是想读取android清单中的包值...
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="THIS"
Run Code Online (Sandbox Code Playgroud)
原因很简单,我必须调用context.getResources().getIdentifier(...),我需要包.
因为这个代码将在其他应用程序中重用,我想在导出它时使其变得简单,因此不必每次都更改值.
谁知道怎么做?
这个问题似乎很明显发生了什么:我已经打开了连接,问题是我不知道为什么.
现在我只是测试我的http登录和退出.
登录:
HttpURLConnection con = openConnection(URLGenerator.getLoginURL(), true, true,"POST");
String content = ...;
writeToOutput(con, content);
con.connect();
String cookieVal = con.getHeaderField("Set-Cookie");
if(cookieVal != null)
{
sessionId = cookieVal.substring(0, cookieVal.indexOf(";"));
}
con.disconnect();
return con.getResponseCode();
Run Code Online (Sandbox Code Playgroud)
登出:
HttpURLConnection con = openConnection(URLGenerator.getLogoutURL(), true, true,"GET");
String content = ...;
writeToOutput(con, content);
setCookies(con);
con.connect();
con.disconnect();
return con.getResponseCode();
Run Code Online (Sandbox Code Playgroud)
对于代码爱好者而言,OpenConnection函数(因为我知道人们首先要问的是"这个函数在哪里"
public static final HttpURLConnection openConnection(URL url, boolean in, boolean out,String requestMethode) throws IOException{
HttpURLConnection con = (HttpURLConnection) url.openConnection ();
con.setDoInput(in);
con.setDoOutput (out);
if(requestMethode == null){
requestMethode = "GET";
} …Run Code Online (Sandbox Code Playgroud) 我一直在为我的公司工作这个项目,我的老板说:"我们想要尽可能多的设备,所以让它适用于1.6",这在某些时候严重束缚了我的手.
我现在流浪的是:一般来说值得支持1.6吗?
随着2.3的发布以及最近的手机已经更新到2.X这一事实,1.6设备还剩下什么地方.
由于实施错误很小,我发现我能够多快地解决Java堆空间问题
现在错误已修复一切都很好,但它确实让我研究如何解决这个问题,并且我提出了多种解决方案,例如
java -Xms5m -Xmx15m MyApp
问题是这会改变我计算机上的java内存,但我正在开发一个将在webrowser中使用的Applet.
因此,有一种方法,在APPLET的RUNTIME中改变堆大小?
请看一下这段代码android示例:
private static final boolean aBoolean = false;
...
if(aBoolean){
//do something like logs
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,由于aBoolean的值为false并且它不能在运行时更改,因此//在构建时是否会执行类似于logs语句的操作,或者它是否仍然是构建的,并且每次它将评估if?
我正在尝试找到像预处理器#DEFINE #IF ...这样的行为,这样当我编码时,我得到了我的日志,当我发布时,我切换一个值,我的所有调试代码都被完全忽略.
(我还想指出我的问题是面向Android的,所以如果Java和Android之间存在差异,请告诉我)
我目前正在编写应用程序的下一个版本.
在旧版本中,没有CoreData sqlite
在新版本中,我们有一个本地CoreData sqlite数据库.
当我从头开始安装新版本的应用程序时,没有问题,商店就在那里,我可以查询.
但是,当我在具有上一版本的手机上安装应用程序时,我的查询会返回,但没有结果.
当我查看日志时,控制台中没有任何内容,并且不会返回任何错误.
#import "CoreDataHelper.h"
@implementation CoreDataHelper
@synthesize store = _store;
@synthesize coordinator = _coordinator;
#pragma mark -
#pragma mark - FILES
NSString *storeFileName = @"Reporting.sqlite";
#pragma mark -
#pragma mark - PATHS
- (NSString *)applicationDocumentsDirectory {
return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
}
- (NSURL *)applicationStoresDirectory {
NSURL *storesDirectory = [[NSURL fileURLWithPath:[self applicationDocumentsDirectory]]URLByAppendingPathComponent:@"Stores"];
NSFileManager *fileManager = [NSFileManager defaultManager];
if (![fileManager fileExistsAtPath:[storesDirectory path]]) {
NSError *error = nil;
if ([fileManager createDirectoryAtURL:storesDirectory
withIntermediateDirectories:YES
attributes:nil
error:&error]) {
//File …Run Code Online (Sandbox Code Playgroud)