我有一个文本到语音应用程序,用户可以选择一种语言,并选择男性或女性的声音.问题是,对于每种语言,有不同的字符串用于调用男性和女性的声音,但在我看来,我只有两种选择(男性和女性).
<string-array name="Language">
<item>English (US)</item>
<item>English (UK)</item>
<item>French (France)</item>
<item>Spanish (Spain)</item>
<item>Italian</item>
</string-array>
<string-array name="languageAlias">
<item>"en-US"</item>
<item>"en-GB"</item>
<item>"fr-FR"</item>
<item>"es-ES"</item>
<item>"it-IT"</item>
</string-array>
<string-array name="Voice">
<item>Male</item>
<item>Female</item>
</string-array>
<string-array name="VoiceAlias">
<item>"usenglishmale"</item>
<item>"usenglishfemale"</item>
<item>"ukenglishmale"</item>
<item>"ukenglishfemale"</item>
<item>"eurfrenchmale"</item>
<item>"eurfrenchfemale"</item>
<item>"eurspanishmale"</item>
<item>"eurspanishfemale"</item>
<item>"euritalianmale"</item>
<item>"euritalianfemale"</item>
</string-array>
Run Code Online (Sandbox Code Playgroud)
我试图找到一种方法,只根据选择的语言参考相关的男性和女性语音.是否可以在此处执行此操作,还是必须编写一些代码,根据所选语言更改voiceAlias数组的值?
提前致谢
对于我需要在我的应用中使用的每个图标,我有4种不同的尺寸.问题是My Nexus 7(1280 x 800)和galaxy s2(800 x 480)似乎使用drawable-hdpi中的资源.如何强制Nexus在drawable-xhdpi中使用资源,然后使用10英寸选项卡使用drawable-xxhdpi.
我在我的清单文件中有这个
<supports-screens android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
Run Code Online (Sandbox Code Playgroud) android android-manifest android-screen android-screen-support android-drawable
我无法从我的webservice向我的数据库发送或显示带有特殊字符的文本.在我的日食中,我将字符编码设置为UTF-8,但它仍然不允许我显示字符.例如,简单的打印,如下面的代码
String test ="??????";
System.out.println(test);
Run Code Online (Sandbox Code Playgroud)
要么
String test ="??????";
String query = "insert into communication (`test`) VALUES ('"+ test +"');
PreparedStatement preparedStmt1 = con.prepareStatement(query);
preparedStmt1.executeUpdate();
Run Code Online (Sandbox Code Playgroud)
控制台上的结果以及如果我将其发送到我的数据库是??????.如何在控制台上正确显示它并希望在数据库中显示
我有一个带有两个按钮的自定义ListView,当我点击任何一行上的任何一个按钮时,我想在Listview上获得文本标签,现在只需弹出一个Toast.到目前为止没有任何工作我继续得到我的数组中的最后一项.
这是一个屏幕截图,让您更好地了解我的意思

这是我的自定义ListView的Adapter子类
static final String[] Names =
new String[] { "John", "Mike", "Maria", "Miguel"};
class MyArrayAdapter extends ArrayAdapter<String> {
private final Context context;
int which;
public MyArrayAdapter(Context context, String[] pValues) {
super(context, R.layout.main, pValues);
this.context = context;
values = pValues;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
rowView = inflater.inflate(R.layout.main, parent, false);
TextView textView = (TextView) rowView.findViewById(R.id.label);
ImageView imageView = (ImageView) rowView.findViewById(R.id.logo);
Button call = (Button) rowView.findViewById(R.id.button1);
Button chat …Run Code Online (Sandbox Code Playgroud) 我需要知道是否可以仅使用具有共享意图的URL来共享图像.这是我的代码.
Intent imageIntent = new Intent(Intent.ACTION_SEND);
Uri imageUri = Uri.parse("http://eofdreams.com/data_images/dreams/face/face-03.jpg");
imageIntent.setType("image/*");
imageIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
startActivity(imageIntent);
Run Code Online (Sandbox Code Playgroud)
到目前为止,它没有工作,我没有在网上找到任何有用的答案.我想使用共享意图并且不下载图像来执行此操作.
我有一个有2个活动的应用程序,首选项和主要活动,我需要首选项屏幕来显示应用程序运行,以便用户可以进行一些配置.我已经检查了这个主题的答案,它们似乎不是很清楚,但我收集它与检查共享首选项文件是否为空有关.
有人可以给我一个代码来解决这个问题以及我将代码放在哪个活动上?此外,我仍然处于开发阶段,所以我已经有我的首选项设置如何撤消这个?
提前致谢
我有两个活动A和B,从A移动到B你需要登录.在我转移到BI之后调用finsih.
在B活动中,当按下后退按钮时,我调用movetoBack.但是,当我回想起我的应用程序时,它会将我带回A.
@Override
public void onBackPressed() {
super.onBackPressed();
moveTaskToBack (true);
}
Run Code Online (Sandbox Code Playgroud) 我需要用户输入金额,这可能有不同的格式,如500或500.00.所以我需要检查用户是否输入了一个带有两个小数点的数字或数字.到目前为止我已经尝试过
if(/^\d+$/.test(amount) === false || /[0-9]+(\.[0-9][0-9]?)?/.test(amount) === false){
//valid
}else{
//invalid
}
Run Code Online (Sandbox Code Playgroud)
但到目前为止只有一个检查它是否是一个数字工作正常.
我正试图在我必须通过的网络服务电话
login.php?message=[{"email":"mikeymike@mouse.com","password":"tiger"}]
Run Code Online (Sandbox Code Playgroud)
我使用反斜杠来逃避这样的双引号
String weblink = "login.php?message=[{\"email\":\"mikeymike@mouse.com\",\"password\":\"tiger\"}]";
Run Code Online (Sandbox Code Playgroud)
但我仍然遇到错误.我试过调用其他没有任何双引号需要数据的web服务,它们工作正常,所以我很确定问题来自于此.我也得到一个java.lang异常说
java.lang.Exception Indicates a serious configuration error.DateParseException An exception to indicate an error parsing a date string. DestroyFailedException Signals that the destroy() method failed
Run Code Online (Sandbox Code Playgroud)
编辑:我已经尝试使用URLEncoder和JSON对象但仍然出错
这是代码的其余部分
String HOST = "http://62.285.107.329/disaster/webservices/";
String weblink = "login.php?message=[{\"email\":\"mikeymike@mouse.com\",\"password\":\"tiger\"}]";
String result = callWebservice(weblink);
public String callWebservice(String weblink) {
String result = "";
try {
HttpParams httpParameters = new BasicHttpParams();
int timeoutConnection = 7500;
HttpConnectionParams.setConnectionTimeout(httpParameters,
timeoutConnection);
int timeoutSocket = 7500;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
HttpClient client = new DefaultHttpClient(httpParameters);
HttpGet request …Run Code Online (Sandbox Code Playgroud)