Java Question warning - Tag @see: can't find setScaleType(ScaleType)

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Hi ,

I am trying to wrap this project https://github.com/Rogero0o/GifLoadingView but getting the following error when compiling .

Can any one help please ?
Here is my source code : http://www.fileconvoy.com/dfl.php?id=g1a1bd24ea2552faf99982236077f2a17e833743a8
Starting step: Compiling Java code.
Completed successfully.
Starting step: Creating jar file.
Completed successfully.
Starting step: Creating XML file.
C:\Users\smms\Documents\0wrappinglibs\gifloadinglibrary\src\main\java\pl\droidsonroids\gif\GifTextureView.java:429: warning - Tag @see: can't find setScaleType(ScaleType) in pl.droidsonroids.gif.GifTextureView
java.lang.NullPointerException
at BADoclet.writeClass(BADoclet.java:184)
at BADoclet.start(BADoclet.java:403)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:280)
at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:160)
at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:397)
at com.sun.tools.javadoc.Start.begin(Start.java:167)
at com.sun.tools.javadoc.Main.execute(Main.java:59)
at com.sun.tools.javadoc.Main.main(Main.java:49)

Error.

Thanks in advance
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
I deleted @see form source code and it compiles OK but I tried to rename class but got this error

B4X:
smmgifloadingview.java:30: error: type argument GifLoadingView is not within bounds of type-variable T
public class smmgifloadingview extends ViewWrapper <GifLoadingView>{
                                                    ^
  where T is a type-variable:
    T extends View declared in class ViewWrapper
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error


Error.
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Hello again
I don't know how to wrap this .
What is supposed to be passed to setImageResource method ?
B4X:
mGifLoadingView.setImageResource(R.drawable.image);
 

DonManfred

Expert
Licensed User
Longtime User
What is supposed to be passed to setImageResource method ?
I suggest to use it this way (that´s what i do in my wraps)
B4X:
  public void setImageResource(final BA ba, String imageResource) {
         int resourceId=BA.applicationContext.getResources().getIdentifier(imageResource, "drawable", BA.packageName);
      this.getObject().setImageResource(resourceId);
  }
Place the drawable in your res folder in the folder drawable. maybe test.png
B4X:
obj.setImageResource("test")
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
I suggest to use it this way (that´s what i do in my wraps)
B4X:
  public void setImageResource(final BA ba, String imageResource) {
         int resourceId=BA.applicationContext.getResources().getIdentifier(imageResource, "drawable", BA.packageName);
      this.getObject().setImageResource(resourceId);
  }
Place the drawable in your res folder in the folder drawable. maybe test.png
B4X:
obj.setImageResource("test")
I am not using setObject and tried
B4X:
        int resourceId=BA.applicationContext.getResources().getIdentifier(imageResource, "drawable", BA.packageName);
        re.setImageResource(resourceId);
re is my GifLoadingFragment


but I get
B4X:
android.content.res.Resources$NotFoundException: Resource ID #0x0
 

DonManfred

Expert
Licensed User
Longtime User
how did you call the method? Is the drawable avalable in the drawable folder in res folder?
Again: i suggest to use it the way i posted above.

You need to get the "resourceID" of the drawable you are requesting. If you dont have this id you are lost in b4a. Give the drawable name as string and get the id from the code i posted.
 

DonManfred

Expert
Licensed User
Longtime User
re is my GifLoadingFragment
B4X:
public void setImageResource(final BA ba, String imageResource) {
         int resourceId=BA.applicationContext.getResources().getIdentifier(imageResource, "drawable", BA.packageName);
      re.setImageResource(resourceId);
  }
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
how did you call the method? Is the drawable avalable in the drawable folder in res folder?
Again: i suggest to use it the way i posted above.

You need to get the "resourceID" of the drawable you are requesting. If you dont have this id you are lost in b4a. Give the drawable name as string and get the id from the code i posted.
I followed a source code that Erel posted about Fragment because I believe this library uses it .
Here is my new code
B4X:
package smm.gifloadingview;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ActivityObject;
import android.view.View;
import android.os.Bundle;
import anywheresoftware.b4a.BA.Events;
import anywheresoftware.b4a.BA.Hide;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.AbsObjectWrapper;
import android.util.AttributeSet;
import android.R.drawable;
import anywheresoftware.b4a.BA.Pixel;
import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.Version;
import anywheresoftware.b4a.BA.DependsOn;
import android.app.FragmentTransaction;
import anywheresoftware.b4a.BALayout;
import anywheresoftware.b4a.keywords.Common.DesignerCustomView;
import anywheresoftware.b4a.objects.ViewWrapper;
import anywheresoftware.b4a.objects.PanelWrapper;
import anywheresoftware.b4a.objects.LabelWrapper;
import android.view.ViewGroup;
import com.roger.gifloadinglibrary.GifLoadingView;
import android.R.drawable;
// extends ViewWrapper <GifLoadingView>"android-support-v7-appcompat","android-support-v4"
@ShortName("GifLoadingView")
@ActivityObject
@Events(values={"_eventname(value As String)"})
@Author("SMM")
@Version(0.01f)
@DependsOn(values={"android-support-annotations","renderscript-v8"})
public class smmgifloadingview {

    private Object fragm;
    private GifLoadingFragment re;
    private String eventName;
    private BA ba;
    private ViewGroup mainparent;
    private FragmentTransaction ft;
    public void Initialize(final BA ba , String EventName,ViewGroup Parent,String imageResource) {
        _initialize(ba, null,  EventName,Parent,imageResource);
       
    }

    @Hide
    public void _initialize(final BA ba, Object activityClass,String EventName,ViewGroup Parent,String imageResource) {
        this.ba = ba;
        this.eventName = EventName.toLowerCase(BA.cul);
        this.mainparent=Parent;

        // re = (GifLoadingFragment) ba.activity.getFragmentManager().findFragmentById(Parent.getId());
        ft = ba.activity.getFragmentManager().beginTransaction();
        if (re != null) {
            ft.remove(re);
        }
        re = new GifLoadingFragment();
        re.attach(this);
       
        // ft.add(Parent.getId(), re);
        re.show(ft, "");
       
       
        int resourceId=BA.applicationContext.getResources().getIdentifier(imageResource, "drawable", BA.packageName);
        re.setImageResource(resourceId);
        String string = resourceId + "";
        ba.Log(string);
    
       
   
     }
   
   
       
       
       
       
   

    @Hide
    public static class GifLoadingFragment extends GifLoadingView {
        private smmgifloadingview parent;
        public void attach(smmgifloadingview parent) {
            this.parent = parent;
        }
        @Override
        public void onViewCreated(View view, Bundle savedInstanceState) {
            if (parent != null)
                parent.ba.raiseEvent(parent, parent.eventName + "_gifloadingready");
        }
       
       

    }
   
   
   
   
}
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
how did you call the method? Is the drawable avalable in the drawable folder in res folder?
Again: i suggest to use it the way i posted above.

You need to get the "resourceID" of the drawable you are requesting. If you dont have this id you are lost in b4a. Give the drawable name as string and get the id from the code i posted.
resources are like "num0.gif" but it seems that the library requests an int ID .
by some logging from library I can see I am having a real ID because otherwise I will get a 0
 

DonManfred

Expert
Licensed User
Longtime User
Erel wrote that it is not easy too. You need to learn how the fragmentmanager is included in the mapview-source.
Then you need to build a fragmentmanager for your lib.

Sadly I did not get it to run till now... :-/
I always take the curve if i need to wrap a lib which is using fragments.
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
but you are not using a fragmentmanager in your code!?
You are right I commented this line
B4X:
re = (GifLoadingFragment) ba.activity.getFragmentManager().findFragmentById(Parent.getId());
which I thought is what I need and forgot :D
 
Top