OTTAA-Project / OTTAAProject

Join us to create the first Augmentative communication platform for speech-impaired children!
https://ottaa-project.github.io/
GNU General Public License v3.0
5 stars 2 forks source link

[Bug]: Load Drawable principal bug #147

Closed gonojuarez closed 1 year ago

gonojuarez commented 2 years ago

Contact Details

gonojuarez17@gmail.com

What happened?

The App crashed because doesn't find an Image resource.

GlideAttatcher attatcher = new GlideAttatcher(this); attatcher.UseCornerRadius(true).loadDrawable(this.getResources().getDrawable(this.getContext().getResources().getIdentifier(pictogram.getPictogram(), "drawable", this.getPackageName())), getImageView(position));

Version

6.7.x (Production)

Where are you seeing the problem on?

Android

Relevant log output

Fatal Exception: android.content.res.Resources$NotFoundException: Resource ID #0x0
       at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:254)
       at android.content.res.Resources.getDrawableForDensity(Resources.java:982)
       at android.content.res.Resources.getDrawable(Resources.java:922)
       at android.content.res.Resources.getDrawable(Resources.java:897)
       at com.stonefacesoft.ottaa.Principal.loadDrawable(Principal.java:1717)
       at com.stonefacesoft.ottaa.Principal.CargarSeleccion(Principal.java:834)
       at com.stonefacesoft.ottaa.Principal.loadSelection(Principal.java:2371)
       at com.stonefacesoft.ottaa.Principal.createRelationShip(Principal.java:1006)
       at com.stonefacesoft.ottaa.Principal.click(Principal.java:989)
       at com.stonefacesoft.ottaa.Principal.function_clickOption(Principal.java:1598)
       at com.stonefacesoft.ottaa.Principal.onClickOption(Principal.java:1850)
       at com.stonefacesoft.ottaa.Principal.onClick(Principal.java:1189)
       at android.view.View.performClick(View.java:7465)
       at android.view.View.performClickInternal(View.java:7442)
       at android.view.View.access$3600(View.java:813)
       at android.view.View$PerformClick.run(View.java:28394)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:250)
       at android.app.ActivityThread.main(ActivityThread.java:7848)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)

Code of Conduct

gonojuarez commented 2 years ago

I replaced the following code attatcher.UseCornerRadius(true).loadDrawable(this.getResources().getDrawable(this.getContext().getResources().getIdentifier(pictogram.getPictogram(), "drawable", this.getPackageName())), getImageView(position));

with :

 Drawable drawable = Json.getInstance().getIcono(pictogram.getObject());
  if(drawable != null)
    attatcher.UseCornerRadius(true).loadDrawable(drawable, getImageView(position));