据我所知,TTS需要TTS引擎才能说一种语言.在Android模拟器2.2中,Pico TTS引擎是默认的.它只有一些流行的语言.我可以在Market上看到一些必须购买才能安装的引擎.我的问题:有没有办法创建支持其他语言的自定义引擎?(通过编程或使用软件)
(我不知道是否应该在StackOverflow或SuperUser中发布此问题.如果错误的地方,请迁移它)
运行从Internet下载的源代码时出现此错误.怎么解决?这似乎是PHP版本的问题.我使用PHP 5.3.
[Wed Sep 05 20:31:40 2012] [error] [client 127.0.0.1] PHP Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /home/hieugioi/Workspace/PHP/Couponic/protected/modules/location/worklets/WLocationHelper.php on line 209
[Wed Sep 05 20:31:40 2012] [error] [client 127.0.0.1] PHP Notice: Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT' in /home/hieugioi/Workspace/PHP/Couponic/protected/modules/location/worklets/WLocationHelper.php on line 210
[Wed Sep 05 20:31:40 2012] [error] [client 127.0.0.1] PHP Notice: Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' in /home/hieugioi/Workspace/PHP/Couponic/protected/modules/location/worklets/WLocationHelper.php on line 211
[Wed Sep 05 20:31:40 2012] [error] [client 127.0.0.1] PHP …Run Code Online (Sandbox Code Playgroud) 我有这个代码.它用法语和俄语正确排序.我使用Locale.US,它似乎是正确的.这个解决方案适用于所有语言吗?它适用于其他语言吗?例如:中国人,韩国人,日本人......如果没有,有什么更好的解决方案?
public class CollationTest {
public static void main(final String[] args) {
final Collator collator = Collator.getInstance(Locale.US);
final SortedSet<String> set = new TreeSet<String>(collator);
set.add("abîmer");
set.add("abîmé");
set.add("aberrer");
set.add("abhorrer");
set.add("aberrance");
set.add("abécédaire");
set.add("abducteur");
set.add("abdomen");
set.add("??????????????-?????????????????");
set.add("???????");
set.add("????????");
set.add("?????????????");
set.add("???????");
set.add("???????");
set.add("???????");
set.add("???????");
for(final String s : set) {
System.out.println(s);
}
}
}
Run Code Online (Sandbox Code Playgroud)
更新: 对不起,我不要求这个集合必须包含所有语言.我的意思是这个集包含一种语言,并在每种语言中正确排序.
public class CollationTest {
public static void main(final String[] args) {
final Collator collator = Collator.getInstance(Locale.US);
final SortedSet<String> set = new TreeSet<String>(collator);
// Sorting in French.
set.clear();
set.add("abîmer");
set.add("abîmé"); …Run Code Online (Sandbox Code Playgroud) 尝试连接到Twitter时出现此错误?为什么?
02-18 16:40:33.270: W/System.err(7167): oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: Service provider responded in error: 301 (Moved Permanently)
02-18 16:40:33.270: W/System.err(7167): at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:218)
02-18 16:40:33.270: W/System.err(7167): at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:74)
02-18 16:40:33.270: W/System.err(7167): at app.jp.cropnet.twitter.TwitterApp$2.run(TwitterApp.java:255)
02-18 16:40:33.270: W/System.err(7167): Caused by: oauth.signpost.exception.OAuthCommunicationException: Service provider responded in error: 301 (Moved Permanently)
02-18 16:40:33.270: W/System.err(7167): at oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvider.java:245)
02-18 16:40:33.270: W/System.err(7167): at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:193)
02-18 16:40:33.270: W/System.err(7167): ... 2 more
Run Code Online (Sandbox Code Playgroud) 我试图将android.jar包含到Java项目中,从Build Path中删除JRE并运行此代码.它抛出运行时异常.为什么?
Exception in thread "main" java.lang.RuntimeException: Stub!
at android.content.ContentValues.<init>(ContentValues.java:5)
at JarTest.main(JarTest.java:5)
public class JarTest {
public static void main(final String[] args) {
final ContentValues values = new ContentValues();
values.put("test", "test");
System.out.println(values);
}
}
Run Code Online (Sandbox Code Playgroud)
为什么ContentValues仅在Android环境中使用?
1)我没有动摇,为什么Android的样本几乎使用AsyncTasks作为私有内部类.我知道使它成为内部类是方便的,但它使我们的类文件更长并且难以阅读.ShelvesActivity of Shelves样品应用甚至有845行.难道你不认为这是一个糟糕的设计或糟糕的建设?
2)如果我创建我的ScanStorageTask外部类,我需要传递给它什么?整个活动或仅使用小部件?
示例:如果我必须在ScanStorageTask中使用WebView,Button和ProgressBar.我用这个:
ScanStorageTask task = new ScanStorageTask(this); // "this" is activity reference, then get the webView, button, progressBar from it.
Run Code Online (Sandbox Code Playgroud)
或这个:
ScanStorageTask task = new ScanStorageTask(webView, button, progressBar);
Run Code Online (Sandbox Code Playgroud) 我想等待两个任务完成然后返回它们的结果但有时我得到这个错误.为什么?CancellationException来自哪里?
public class ShouldVoteTask extends AbstractWorkerTask<Void, Void, Boolean> {
private final int placeID;
private final int userID;
public ShouldVoteTask(final int placeID, final int userID) {
this.placeID = placeID;
this.userID = userID;
}
@Override
protected Boolean doInBackground(final Void... params) {
try {
// Prepare callables.
final IsMaxRatingCallable call1 = new IsMaxRatingCallable(placeID);
final DidVoteCallable call2 = new DidVoteCallable(placeID, userID);
final List<Callable<Boolean>> callables = new ArrayList<Callable<Boolean>>();
callables.add(call1);
callables.add(call2);
// Execute them.
final ExecutorService service = Executors.newFixedThreadPool(2);
final List<Future<Boolean>> futures = service.invokeAll(callables, 5, TimeUnit.SECONDS); …Run Code Online (Sandbox Code Playgroud) 我试图设置在线模式,但它不能通过名册.我运行此代码并检查我的localhost服务器,该模式仍然"可用"而不是"请勿打扰".
final Connection connection = new XMPPConnection("xxx.xxx.x.xx");
connection.connect();
connection.login("hieugioi@hieund", "123456");
final Roster roster = connection.getRoster();
Presence p = roster.getPresence("hieugioi@hieund");
p.setPriority(128);
p.setMode(Mode.dnd);
Run Code Online (Sandbox Code Playgroud) 我正在开展团队项目.我.jar在Build Path中包含了一个文件并提交给了SVN.当我在工作目录中更新代码时,Eclipse中会出现一个名为"Android Dependencies"的新文件夹.如果我让它在那里,我的程序运行; 如果我将其删除,我的程序会报告一个ClassNotFoundException.
现在该怎么解决这个问题ClassNotFoundException?
我想捕获doInBackground中的线程异常并在onPostExcecute中打印错误消息.问题是我在onPostExecute中没有Throwable对象.如何捕获异常在非UI线程,并打印在UI线程的错误信息?
public class TestTask extends AsyncTask<Void, Void, List<String>> {
@Override
protected List<String> doInBackground(final Void... params) {
try {
...
return listOfString;
} catch(SomeCustomException e) {
...
return null;
}
}
@Override
protected void onPostExecute(final List<String> result) {
if(result == null) {
// print the error of the Throwable "e".
// The problem is I don't have the Throwable object here! So I can't check the type of exception.
}
}
}
Run Code Online (Sandbox Code Playgroud)
Arun回答后更新:
这是我的AsyncTask包装类.它打算在doInBackground中处理Exception,但我找不到一个好的解决方案来做到这一点.
public abstract class …Run Code Online (Sandbox Code Playgroud)