可能重复:
更改应用程序本身内的区域设置
在我的应用程序中我需要"强制"语言让我说我有英语语言环境作为默认波兰语和芬兰语,根据我发布的帖子我发布的功能也在下面,函数在createActivity()中调用,但问题是它确实不工作....任何想法为什么?有什么建议?
private void setLocale(String localeCode){
Locale locale = new Locale(localeCode);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
}
Run Code Online (Sandbox Code Playgroud) 我想打开本机应用程序发送短信但应该已经有电话号码.我找到了ACTION_SEND,但是当我调用我的函数时,返回错误:
04-26 11:59:15.991: ERROR/AndroidRuntime(20198): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SENDTO (has extras) }
Run Code Online (Sandbox Code Playgroud)
我的代码在这里提出:
private void smsSend(String number) {
Intent intent = new Intent(Intent.ACTION_SENDTO, null);
intent.putExtra(Intent.EXTRA_PHONE_NUMBER, number);
startActivity(intent);
}
Run Code Online (Sandbox Code Playgroud)
我知道这很简单,但我不知道为什么它不起作用,我找不到任何有用的信息.
谢谢你的建议.
我在mongodb中通过mongoose更新文档时出现问题.
我的模特吼叫:
var mongoose = require('mongoose');
var bcrypt = require('bcrypt-nodejs');
var UserSchema = new mongoose.Schema({
first_name:{
type: String
},
last_name:{
type: String
},
email:{
type: String,
unique: true,
required: true
},
password:{
type: String,
required: true
},
is_active:{
type: Boolean,
default: true
},
last_login:{
type: Date
}
});
module.exports = mongoose.model('User', UserSchema);
Run Code Online (Sandbox Code Playgroud)
控制器放下功能:
exports.updateUser = function (req, res) {
console.log(req.body);
User.findByIdAndUpdate(req.body.user_id, {$set:req.body}, function(err, result){
if(err){
console.log(err);
}
console.log("RESULT: " + result);
});
res.send('Done')
}
Run Code Online (Sandbox Code Playgroud)
控制台输出:
Listening on port 3000... { …Run Code Online (Sandbox Code Playgroud) 可能我提出了一些琐碎的问题,但我想知道SQLite中的表名或字段名是否有限制,尤其是在Android中。我记得,Oracle数据库中存在或仍然存在类似问题。
我想在我的Android应用程序中发送多部分表单但不使用org.apache.http.entity.mime所以我创建了mu自己的方式,但它不能像我创建请求的方式一样:
public byte[] createRequest(byte[] imagedata){
byte[] requestData = null;
ByteArrayOutputStream buf = new ByteArrayOutputStream();
OutputStreamWriter output = null;
try {
Log.i(TAG, "Creating request");
output = new OutputStreamWriter(buf, "UTF-8");
output.write("--");
output.write(boundary);
output.write("\r\n");
output.write("Content-Disposition: form-data; name=\"auth\"; filename=\"auth\"\r\n");
output.write("Content-Type: text/xml; charset=utf-8\r\n");
output.write("\r\n");
byte temp2[] = buf.toByteArray();
Log.i(TAG, "BUF SIZE: " + temp2.length);
Log.i(TAG, "BUF: " + buf.toString());
ByteArrayOutputStream authBuffer = new ByteArrayOutputStream();
OutputStreamWriter authOut = new OutputStreamWriter(authBuffer, "UTF-8");
writeAuthRequestFragment(user, pass, company_id, "RESLINK CLIENT", "2.0", null, null, null, authOut);
buf.write(authBuffer.toByteArray());
Log.i(TAG, "BUF SIZE: " …Run Code Online (Sandbox Code Playgroud)