android updateLocaleListFromAppContext NullPointerException 中的问题 [英] Issue in android updateLocaleListFromAppContext NullPointerException

查看:258
本文介绍了android updateLocaleListFromAppContext NullPointerException 中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我的应用程序崩溃并显示以下错误.我无法检测到实际问题是什么,也无法检测到崩溃.

Recently my app crashed and showed the below error. I can't detect what the actual issue is, and also can't detect crash.

如果有人对此崩溃有解决方案,请帮助解决此问题.

If anyone has a solution for this crash then help for this issue.

java.lang.NullPointerException: 
  at android.app.ActivityThread.updateLocaleListFromAppContext (ActivityThread.java:6107)
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6354)
  at android.app.ActivityThread.access$1300 (ActivityThread.java:220)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1860)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:7403)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:935)

提前致谢:)

推荐答案

在崩溃分析和检查 firebase crashlytics 之后,我得到了错误的解决方案.实际上,我将图像一个活动传递给另一个活动,并且在那里发生崩溃.

After a crash analysis and check firebase crashlytics I got the solution of my error. Actual I pass image one activity to another activity and its crash being there.

活动 A

Intent code = new Intent(Activity_A.this, Activity_B.class);
code.putExtra("BitmapImage", bitmap);
startActivity(code);

活动 B

我在另一个类中检索图像

And I retrieve the image in another class

if (getIntent()!= null) {
    bitmap = (Bitmap) getIntent().getParcelableExtra("BitmapImage");
}          

解决方案是:将一个活动传递给另一个活动后,将位图转换为字节数组,如下所示

Solution is: convert bitmap to byte array after pass one activity to another activity like below

活动 A:

Intent code = new Intent(Activity_A.this, Activity_B.class);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
code.putExtra("BitmapImage", byteArray);
startActivity(code);

活动 B:

Bundle extras;

if (intent != null) {
  extras = getIntent().getExtras();
  byte[] byteArray = extras.getByteArray("BitmapImage");
  Bitmap bitmap = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
}

在这段代码之后,我的问题就解决了:)

After this code, my issue is solved :)

这篇关于android updateLocaleListFromAppContext NullPointerException 中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆