据我所知,在android"发布版"中签名APK.如何从代码中检查它还是Eclipse有一些秘密定义?
我需要这个来调试从Web服务数据中填充ListView项目(不,logcat不是一个选项).
我的想法:
android:debuggable,但由于某些原因看起来不可靠.我正在开发一个支持两种不同语言的应用程序 -
用户可以随时切换到任何语言,并根据我正在更改应用程序语言的选择。
下面提到的是代码片段 -
public static void setLocale(String languageCode, Context ctx) {
Locale locale = new Locale(languageCode);
Locale.setDefault(locale);
if (Build.VERSION.SDK_INT >= VERSION_CODES.N) {
updateResourcesLocale(ctx, locale);
} else {
updateResourcesLocaleLegacy(ctx, locale);
}
}
private static void updateResourcesLocale(Context context, Locale locale) {
Configuration configuration = context.getResources().getConfiguration();
configuration.setLocale(locale);
context.getApplicationContext().createConfigurationContext(configuration);
}
private static void updateResourcesLocaleLegacy(Context context, Locale locale) {
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
configuration.setLayoutDirection(locale);
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
}
Run Code Online (Sandbox Code Playgroud)
同样在应用程序的每个活动中,我都覆盖了attachBaseContext方法。我在其中使用了以下逻辑-
@Override
protected void attachBaseContext(Context …Run Code Online (Sandbox Code Playgroud)