我在启动应用程序时遇到此错误。这是我的代码
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()); } } }
我没有日志,客户端正在报告nexus 5上的应用程序启动...他很遗憾myapp已经停止了错误。 这个错误也可能发生什么变化?