walterf25 Expert Licensed User Longtime User Nov 20, 2014 #1 Hello all, i'm trying to wrap a CircularProgressBar library, i'm just trying to do this for fun, i've wrapped a few other libraries before but i'm a little confused with this library, since it requires a few xml libraries to be included. Here's what i have so far. Code: Copy package com.genesis.circularprogressbar; import anywheresoftware.b4a.BA; import anywheresoftware.b4a.BA.ActivityObject; import anywheresoftware.b4a.BA.Author; import anywheresoftware.b4a.BA.DependsOn; import anywheresoftware.b4a.BA.Permissions; import anywheresoftware.b4a.BA.ShortName; import anywheresoftware.b4a.BA.Version; import com.lylc.widget.circularprogressbar.example.CircularProgressBar; @Version(1.0f) @ShortName("B4ACircularProgressBar") @ActivityObject @Permissions(values={"android.permission.INTERNET"}) @Author("Walter F") @DependsOn(values = { "CircularProgressBar" }) public class B4ACircularProgressBar { public void Initialize(BA ba, String eventname){ CircularProgressBar c1 = new CircularProgressBar(ba.context); c1.setProgress(45); } } The library compiles just fine in Eclipse, but i get a Resource Not found error when I try to use it in my B4A project, of course this has to do with the xml files that are needed. How can I call this files or include them in my project so that i get rid of this error? I know it might be a simple answer, but my brain keeps farting at the moment. I'd really appreciate it if anyone can point me in the right direction. The original project can be found here.https://github.com/ylyc/circular_progress_bar Thanks everyone in Advance. Cheers, Walter
Hello all, i'm trying to wrap a CircularProgressBar library, i'm just trying to do this for fun, i've wrapped a few other libraries before but i'm a little confused with this library, since it requires a few xml libraries to be included. Here's what i have so far. Code: Copy package com.genesis.circularprogressbar; import anywheresoftware.b4a.BA; import anywheresoftware.b4a.BA.ActivityObject; import anywheresoftware.b4a.BA.Author; import anywheresoftware.b4a.BA.DependsOn; import anywheresoftware.b4a.BA.Permissions; import anywheresoftware.b4a.BA.ShortName; import anywheresoftware.b4a.BA.Version; import com.lylc.widget.circularprogressbar.example.CircularProgressBar; @Version(1.0f) @ShortName("B4ACircularProgressBar") @ActivityObject @Permissions(values={"android.permission.INTERNET"}) @Author("Walter F") @DependsOn(values = { "CircularProgressBar" }) public class B4ACircularProgressBar { public void Initialize(BA ba, String eventname){ CircularProgressBar c1 = new CircularProgressBar(ba.context); c1.setProgress(45); } } The library compiles just fine in Eclipse, but i get a Resource Not found error when I try to use it in my B4A project, of course this has to do with the xml files that are needed. How can I call this files or include them in my project so that i get rid of this error? I know it might be a simple answer, but my brain keeps farting at the moment. I'd really appreciate it if anyone can point me in the right direction. The original project can be found here.https://github.com/ylyc/circular_progress_bar Thanks everyone in Advance. Cheers, Walter
Olaan Expert Licensed User Longtime User Nov 20, 2014 #2 I would love to know this too. I 'm not understand how to create library(How to convert) when we have the original project. Please give me only example. I think I will clearly. Should I start at this java file ? @Walter I think it should be below. import com.lylc.widget.circularprogressbar.example; Last edited: Nov 20, 2014
I would love to know this too. I 'm not understand how to create library(How to convert) when we have the original project. Please give me only example. I think I will clearly. Should I start at this java file ? @Walter I think it should be below. import com.lylc.widget.circularprogressbar.example;
Erel B4X founder Staff member Licensed User Longtime User Nov 20, 2014 #3 Have you tried to copy the resource files to your project Objects\res (and make them readonly)?
thedesolatesoul Expert Licensed User Longtime User Nov 20, 2014 #4 Use the AdditionalRes attribute in the project, to point to the res folder for the library. Also, as a tip for views, use ViewWrapper to wrap it. i.e. Code: Copy public class B4ACircularProgressBar extends <ViewWrapper> CircularProgressBar {
Use the AdditionalRes attribute in the project, to point to the res folder for the library. Also, as a tip for views, use ViewWrapper to wrap it. i.e. Code: Copy public class B4ACircularProgressBar extends <ViewWrapper> CircularProgressBar {
Olaan Expert Licensed User Longtime User Nov 20, 2014 #5 @Erel I've be understand 2 examples in simplewrapper tool. The first,it is easy function,the second,it is sdk and has jar file . And the third is this which I still not understand how to create it.
@Erel I've be understand 2 examples in simplewrapper tool. The first,it is easy function,the second,it is sdk and has jar file . And the third is this which I still not understand how to create it.
walterf25 Expert Licensed User Longtime User Nov 20, 2014 #6 Erel said: Have you tried to copy the resource files to your project Objects\res (and make them readonly)? Click to expand... Hi Erel, yes i tried copying the resource files to my objects/res folder, but it doesn't seem to work. Thanks, Walter
Erel said: Have you tried to copy the resource files to your project Objects\res (and make them readonly)? Click to expand... Hi Erel, yes i tried copying the resource files to my objects/res folder, but it doesn't seem to work. Thanks, Walter
walterf25 Expert Licensed User Longtime User Nov 20, 2014 #7 thedesolatesoul said: Use the AdditionalRes attribute in the project, to point to the res folder for the library. Also, as a tip for views, use ViewWrapper to wrap it. i.e. Code: Copy public class B4ACircularProgressBar extends <ViewWrapper> CircularProgressBar { Click to expand... Thanks for that tip tds, i will try that. Cheers, Walter
thedesolatesoul said: Use the AdditionalRes attribute in the project, to point to the res folder for the library. Also, as a tip for views, use ViewWrapper to wrap it. i.e. Code: Copy public class B4ACircularProgressBar extends <ViewWrapper> CircularProgressBar { Click to expand... Thanks for that tip tds, i will try that. Cheers, Walter
walterf25 Expert Licensed User Longtime User Nov 20, 2014 #8 I used the extend viewWrapper<CircularProgressBar> and also tried the AdditionalRes attribute but i get this error. PackageAdded: package:com.genesis.circular ** Activity (main) Create, isFirst = true ** android.content.res.Resources$NotFoundException: Resource ID #0x7f040000 type #0x5 is not valid at android.content.res.Resources.getColor(Resources.java:1697) at com.lylc.widget.circularprogressbar.example.CircularProgressBar.init(CircularProgressBar.java:95) at com.lylc.widget.circularprogressbar.example.CircularProgressBar.<init>(CircularProgressBar.java:68) at com.genesis.circularprogressbar.B4ACircularProgressBar.Initialize(B4ACircularProgressBar.java:31) at com.genesis.circular.main._activity_create(main.java:319) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175) at com.genesis.circular.main.afterFirstLayout(main.java:98) at com.genesis.circular.main.access$100(main.java:16) at com.genesis.circular.main$WaitForLayout.run(main.java:76) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:157) at android.app.ActivityThread.main(ActivityThread.java:5356) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) at dalvik.system.NativeStart.main(Native Method) Click to expand... Any Ideas?
I used the extend viewWrapper<CircularProgressBar> and also tried the AdditionalRes attribute but i get this error. PackageAdded: package:com.genesis.circular ** Activity (main) Create, isFirst = true ** android.content.res.Resources$NotFoundException: Resource ID #0x7f040000 type #0x5 is not valid at android.content.res.Resources.getColor(Resources.java:1697) at com.lylc.widget.circularprogressbar.example.CircularProgressBar.init(CircularProgressBar.java:95) at com.lylc.widget.circularprogressbar.example.CircularProgressBar.<init>(CircularProgressBar.java:68) at com.genesis.circularprogressbar.B4ACircularProgressBar.Initialize(B4ACircularProgressBar.java:31) at com.genesis.circular.main._activity_create(main.java:319) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175) at com.genesis.circular.main.afterFirstLayout(main.java:98) at com.genesis.circular.main.access$100(main.java:16) at com.genesis.circular.main$WaitForLayout.run(main.java:76) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:157) at android.app.ActivityThread.main(ActivityThread.java:5356) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) at dalvik.system.NativeStart.main(Native Method) Click to expand... Any Ideas?
walterf25 Expert Licensed User Longtime User Nov 20, 2014 #9 Now I get this error I excluded the res folder from the eclipse project. I also used the AdditionalRes Attribute in my b4a project, but i get the error below. Any suggestions please? Walter Attachments error.jpg 206.4 KB · Views: 572
Now I get this error I excluded the res folder from the eclipse project. I also used the AdditionalRes Attribute in my b4a project, but i get the error below. Any suggestions please? Walter
walterf25 Expert Licensed User Longtime User Nov 20, 2014 #10 Never Mind everyone, I figured it out, i got it all working now, thanks tds and Erel. Walter
walterf25 Expert Licensed User Longtime User Nov 21, 2014 #11 Hi Guys again, i got the library working, but i want to expand and expose all of the functionalities, right now i can only display the basic circular progressbar but in the original project, I see that there are various styles declared in the activity_main.xml file, i need to know how to load those different layouts from code. Can anyone please help me with this. I tries this but i get a null exception error when i run my b4a project. Code: Copy String resourceName="circularprogressbar2"; int resourceId = BA.applicationContext.getResources().getIdentifier(resourceName, "id", BA.packageName); BA.Log("ResourceID " + resourceId); final CircularProgressBar c2 = (CircularProgressBar) new CircularProgressBar(ba.context).findViewById(R.id.circularprogressbar2); on the original project they call it like this Code: Copy final CircularProgressBar c2 = (CircularProgressBar) findViewById(R.id.circularprogressbar2); This is the error I get now Installing file. PackageAdded: package:com.genesis.circular ** Activity (main) Create, isFirst = true ** ResourceID 2131296257 rogressbar.B4ACircularProgressBarAnimatedProgressBar (B4A line: 32) progress1.AnimatedProgressBar(0, 80, "animated") java.lang.NullPointerException at com.genesis.circularprogressbar.B4ACircularProgressBar.AnimatedProgressBar(B4ACircularProgressBar.java:62) at com.genesis.circular.main._activity_create(main.java:319) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175) at com.genesis.circular.main.afterFirstLayout(main.java:98) at com.genesis.circular.main.access$100(main.java:16) at com.genesis.circular.main$WaitForLayout.run(main.java:76) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:157) at android.app.ActivityThread.main(ActivityThread.java:5356) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) at dalvik.system.NativeStart.main(Native Method) Click to expand... Hope I make sense, thanks all. Any ideas? Cheers, Walter Last edited: Nov 21, 2014
Hi Guys again, i got the library working, but i want to expand and expose all of the functionalities, right now i can only display the basic circular progressbar but in the original project, I see that there are various styles declared in the activity_main.xml file, i need to know how to load those different layouts from code. Can anyone please help me with this. I tries this but i get a null exception error when i run my b4a project. Code: Copy String resourceName="circularprogressbar2"; int resourceId = BA.applicationContext.getResources().getIdentifier(resourceName, "id", BA.packageName); BA.Log("ResourceID " + resourceId); final CircularProgressBar c2 = (CircularProgressBar) new CircularProgressBar(ba.context).findViewById(R.id.circularprogressbar2); on the original project they call it like this Code: Copy final CircularProgressBar c2 = (CircularProgressBar) findViewById(R.id.circularprogressbar2); This is the error I get now Installing file. PackageAdded: package:com.genesis.circular ** Activity (main) Create, isFirst = true ** ResourceID 2131296257 rogressbar.B4ACircularProgressBarAnimatedProgressBar (B4A line: 32) progress1.AnimatedProgressBar(0, 80, "animated") java.lang.NullPointerException at com.genesis.circularprogressbar.B4ACircularProgressBar.AnimatedProgressBar(B4ACircularProgressBar.java:62) at com.genesis.circular.main._activity_create(main.java:319) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175) at com.genesis.circular.main.afterFirstLayout(main.java:98) at com.genesis.circular.main.access$100(main.java:16) at com.genesis.circular.main$WaitForLayout.run(main.java:76) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:157) at android.app.ActivityThread.main(ActivityThread.java:5356) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) at dalvik.system.NativeStart.main(Native Method) Click to expand... Hope I make sense, thanks all. Any ideas? Cheers, Walter
walterf25 Expert Licensed User Longtime User Nov 21, 2014 #12 Never Mind again, i also figured it out, haha. I will post the library once i'm done. this is how i did it. Code: Copy final CircularProgressBar c2 = (CircularProgressBar) new CircularProgressBar(ba.context, null, BA.applicationContext.getResources().getIdentifier(resourceName, "layout", BA.packageName)); Thanks, walter
Never Mind again, i also figured it out, haha. I will post the library once i'm done. this is how i did it. Code: Copy final CircularProgressBar c2 = (CircularProgressBar) new CircularProgressBar(ba.context, null, BA.applicationContext.getResources().getIdentifier(resourceName, "layout", BA.packageName)); Thanks, walter