Unknown bloat error on Toast call

I have a published application that has received some weird user reviews. Accordingly, with a stack trace, when trying to call the Toast show() method, a bloat error occurred. The stack is as follows:

 android.view.InflateException: Binary XML file line #21: Error inflating class <unknown> at android.view.LayoutInflater.createView(LayoutInflater.java:596) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:644) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669) at android.view.LayoutInflater.inflate(LayoutInflater.java:457) at android.view.LayoutInflater.inflate(LayoutInflater.java:391) at android.view.LayoutInflater.inflate(LayoutInflater.java:347) at android.widget.Toast.makeText(Toast.java:247) at my.app.name.Launcher$ActionDecider.onPostExecute(Launcher.java:155) 

And on line 155, I have a generic show call Toast ():

 Toast.makeText(LauncherAct.getContext(), "Some random string here", Toast.LENGTH_SHORT).show(); 

Does anyone have any idea what this might be?

+4
source share
1 answer

I had the same problem. Suddenly my Toast calls started giving this error Binary XML file line #21: Error inflating class . I again called my method inside the same method until I got the desired gps values ​​from the network provider. When I delete the call, the problem is gone. I did not get a relationship between them, but it worked.

 public void getLocation() { if(gps.canGetLocation()) { latitude = gps.latitude; longitude = gps.longitude; if((latitude < 0) || (longitude < 0)) { Toast.makeText(CharityGPS.this, "Konumunuz saptanıyor lütfen bekleyiniz.", Toast.LENGTH_SHORT).show(); getLocation(); //recalling is here. when I remove it, problem has gone. } else { ... } } 

Hope this helps.

0
source

Source: https://habr.com/ru/post/1434933/


All Articles