-3

My application is working well in my test device and also to most of the users (maybe), but I am getting a crash report in my play console account and I don't understand where the problem is. I am attaching a screenshot of the stack traces and the codes.

This is line no. 60, AdhynikYugDetails.java, as mentioned in stack traces:

tv_detailed_description.setText(R.string.jatiyatabadi_andolan_details);

There are many lines like this, but only this line is responsible for the crash: Stack traces

This is the full block:

else if (getIntent().getBooleanExtra("jatiyatabadi_andolan", AdhunikYug.jatiyatabadi_andolan)) {
        tv_heading.setText(R.string.jatiyatabadi_andolan);
        tv_detailed_description.setText(R.string.jatiyatabadi_andolan_details); //line no 60

        AdhunikYug.jatiyatabadi_andolan = false;
    } 

Could there be a problem in the string? should I post it? It is a long Bengali string.

jkdev
  • 11,360
  • 15
  • 54
  • 77
Neo
  • 7
  • 5

1 Answers1

1

Do this:-

tv_detailed_description.setText(getResources().getString(R.string.jatiyatabadi_andolan_details));
Raj
  • 2,997
  • 2
  • 12
  • 30
  • Thank you @Raj for your response. could you please explain it? The application is working very well in my test device, Lenovo K3 Note and may be to most of the users. – Neo Jul 31 '18 at 14:49
  • https://stackoverflow.com/questions/18641994/how-getresources-getstring-works-android – Raj Jul 31 '18 at 15:00
  • Thanks again @Raj, I was saying that my application was working well from the beginning. I will surely accept your answer if the problem gets solved. Is there a way to check it right now, without uploading a new version? Sorry for the delay. – Neo Jul 31 '18 at 15:16
  • It's fairly simple: what you were doing is setting a string `Resource` as a text. It may work on some devices, but more bullet-proof way would be to do as @Raj said, by extracting that resource via android tools and passing in to `setText` method as `String` instead – jujka Jul 31 '18 at 15:28
  • @Raj the method setText() has 6 implementations: `public final void setText(CharSequence text)`, `public void setText(CharSequence text, BufferType type)` `private void setText(CharSequence text, BufferType type, boolean notifyBefore, int oldlen)` `public final void setText(char[] text, int start, int len)` `public final void setText(@StringRes int resid)` `public final void setText(@StringRes int resid, BufferType type)` –  Jul 31 '18 at 16:23