3

Now that Firebase has ANR reports, I'm seeing some ANRs that I never saw on the Play Store Console. I'm struggling to understand what I'm doing wrong on some of those situations, for example, I have this one ANR when calling setText on a TextView. How do I go about figuring out the issue? Is it maybe that that the text is too long or something?

main (runnable): tid=1 systid=22334
       at android.content.ContextWrapper.getBaseContext(ContextWrapper.java:91)
       at androidx.appcompat.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:167)
       at android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:188)
       at android.app.Activity.getSystemService(Activity.java:6896)
       at android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:188)
       at android.content.Context.getSystemService(Context.java:3736)
       at android.widget.Editor.getInputMethodManager(Editor.java:1919)
       at android.widget.Editor.extractedTextModeWillBeStarted(Editor.java:2706)
       at android.widget.Editor.refreshTextActionMode(Editor.java:2454)
       at android.widget.TextView.spanChange(TextView.java:11989)
       at android.widget.TextView$ChangeWatcher.onSpanAdded(TextView.java:15285)
       at android.text.SpannableStringBuilder.sendSpanAdded(SpannableStringBuilder.java:1297)
       at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:787)
       at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:686)
       at android.text.Selection.setSelection(Selection.java:96)
       at android.text.Selection.setSelection(Selection.java:78)
       at android.text.Selection.setSelection(Selection.java:153)
       at android.text.method.ArrowKeyMovementMethod.initialize(ArrowKeyMovementMethod.java:325)
       at android.widget.TextView.setText(TextView.java:6933)
       at android.widget.TextView.setText(TextView.java:6761)
       at android.widget.EditText.setText(EditText.java:145)
       at android.widget.TextView.setText(TextView.java:6713)
       at MyActivity.mySetTextMethod(MyActivity.java)
casolorz
  • 8,486
  • 19
  • 93
  • 200

2 Answers2

0

Sometimes it's better you don't as you'll be wasting a lot of time figuring out what excactly is happening on that one device. Sometimes it seems to be a too low display resolution, Sometimes it's just the custom operating system of the device itself. To me, this seems more a problem with the android device, than your app itself.

Cherdenko
  • 1
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 19 '21 at 15:28
0

look at this article. maybe you initialized your TextView with the wrong context: Difference between getContext() , getApplicationContext() , getBaseContext() and "this"

berlindev
  • 1,753
  • 14
  • 22
  • That particular `TextView` is part of the `Activity` layout and just initialized using `setContentView` on the `onCreate` – casolorz Nov 19 '21 at 23:33