Android 不幸的是,您的应用程序在启动droid时已停止
我在启动应用程序时遇到这个错误。这是我的代码 我没有日志,客户端正在报告nexus 5上的应用程序启动。。。不幸的是,他发现myapp已停止出错。Android 不幸的是,您的应用程序在启动droid时已停止,android,locale,Android,Locale,我在启动应用程序时遇到这个错误。这是我的代码 我没有日志,客户端正在报告nexus 5上的应用程序启动。。。不幸的是,他发现myapp已停止出错。 这个错误也可能是什么原因?您确实有一个日志,它在Logcat中。我没有设备,客户在每台设备上使用nexus 5时都向我报告这个错误。除了这个设备,您测试的任何设备是否运行4.4.2(nexus 5正在运行的是什么)?我建议制作一个Nexus5模拟器,并在上面进行测试,看看是否有崩溃。不,其他一些人在Nexus5上进行了测试,效果很好。我还在我的Nex
这个错误也可能是什么原因?您确实有一个日志,它在Logcat中。我没有设备,客户在每台设备上使用nexus 5时都向我报告这个错误。除了这个设备,您测试的任何设备是否运行4.4.2(nexus 5正在运行的是什么)?我建议制作一个Nexus5模拟器,并在上面进行测试,看看是否有崩溃。不,其他一些人在Nexus5上进行了测试,效果很好。我还在我的Nexus4(Kitkat4.4.2)上测试了它,效果很好。这让我困惑,为什么它不与Nexus5上的特定用户合作。
package com.mycompany.myapp.android;
import java.util.Locale;
import android.app.Application;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Configuration;
import android.preference.PreferenceManager;
import com.droidux.components.DroidUxLib;
import com.mycompany.myapp.R;
public class MyApp extends Application {
/**
* Called when the application is starting, before any activity, service, or
* receiver objects (excluding content providers) have been created.
*/
private Locale locale = null;
@Override
public void onCreate() {
super.onCreate();
// register the DroidUX library here
DroidUxLib.register("sakldsadkdla",
this);
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
String lang = settings.getString(getString(R.string.locale_lang), "");
changeLang(lang);
}
public void changeLang(String lang) {
Configuration config = getBaseContext().getResources().getConfiguration();
if (!"".equals(lang) && !config.locale.getLanguage().equals(lang)) {
Editor ed = PreferenceManager.getDefaultSharedPreferences(this).edit();
ed.putString(getString(R.string.locale_lang), lang);
ed.commit();
locale = new Locale(lang);
Locale.setDefault(locale);
Configuration conf = new Configuration(config);
conf.locale = locale;
getBaseContext().getResources().updateConfiguration(conf, getBaseContext().getResources().getDisplayMetrics());
}
}
}