Android Question 9-patch images still deleted after Run (F5)

Dear All,

I am developing a project using Ultimate List View (ULV) which using 9-patch images as section header / footer.

ultmate_section_footer_layout.png


The images are in the path ../Objects/res/drawable.
When the images files are read-only, the program works fine.
When the images files are NOT read-only, the 9 patch images would be deleted after compiled and the activity of this ULV would be crashed.

Referring to 9patch Image File Keep Deleted from res/drawable Folder, Mr. Erel suggested using tag #AdditionalRes to a new folder e.g. Resources in my case.

AdditionalRes Tag:
#AdditionalRes: ../Resources

However, the program crashed with the same error message as:

java.lang.NoSuchFieldException:
[COLOR=rgb(209, 72, 65)]Summary_LayoutCreator: java.lang.NoSuchFieldException: No field footer4d in class Lhk/prizemart/wms1/R$drawable; (declaration of 'hk.prizemart.wms1.R$drawable' appears in /data/app/hk.prizemart.wms1-2/base.apk)
Footer_ContentFiller: 220330:UL
palletforarrivalregistryarea_loadninepatchdrawable (java line: 3119)
java.lang.NoSuchFieldException: No field firstcell in class Lhk/prizemart/wms1/R$drawable; (declaration of 'hk.prizemart.wms1.R$drawable' appears in /data/app/hk.prizemart.wms1-2/base.apk)
    at java.lang.Class.getDeclaredField(Native Method)
    at anywheresoftware.b4a.agraham.reflection.Reflection.GetStaticField(Reflection.java:371)
    at hk.prizemart.wms1.palletforarrivalregistryarea._loadninepatchdrawable(palletforarrivalregistryarea.java:3119)
    at hk.prizemart.wms1.palletforarrivalregistryarea._pallet_rowlayoutcreator(palletforarrivalregistryarea.java:3483)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
    at flm.b4a.ultimatelistview.b.getView(SourceFile:576)
    at android.widget.AbsListView.obtainView(AbsListView.java:2474)
    at android.widget.ListView.makeAndAddView(ListView.java:1920)
    at android.widget.ListView.fillUp(ListView.java:751)
    at android.widget.ListView.layoutChildren(ListView.java:1696)
    at flm.b4a.ultimatelistview.UltimateListView.layoutChildren(SourceFile:551)
    at android.widget.AbsListView.onLayout(AbsListView.java:2235)
    at android.view.View.layout(View.java:16953)
    at android.view.ViewGroup.layout(ViewGroup.java:5579)
    at anywheresoftware.b4a.BALayout.onLayout(BALayout.java:60)
    at android.view.View.layout(View.java:16953)
    at android.view.ViewGroup.layout(ViewGroup.java:5579)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:396)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
    at android.view.View.layout(View.java:16953)
    at android.view.ViewGroup.layout(ViewGroup.java:5579)
    at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:493)
    at android.view.View.layout(View.java:16953)
    at android.view.ViewGroup.layout(ViewGroup.java:5579)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:396)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
    at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2740)
    at android.view.View.layout(View.java:16953)
    at android.view.ViewGroup.layout(ViewGroup.java:5579)
    at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2562)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2265)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1323)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6718)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:894)
    at android.view.Choreographer.doCallbacks(Choreographer.java:696)
    at android.view.Choreographer.doFrame(Choreographer.java:631)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:880)
    at android.os.Handler.handleCallback(Handler.java:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at android.os.Looper.loop(Looper.java:207)
    at android.app.ActivityThread.main(ActivityThread.java:5765)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)[/COLOR]

What is my mistakes by using tag #AdditionalRes: ../Resources ?
 
@Erel, I have just reminded by my supervisor that:

1. Copy all 3 folders i.e. drawable, layout and xml from <project folder>\Objects\res to <project folder>\Resources
2. Tag #AdditionalRes: ../Resources

After compiled, it works again.
 
Upvote 0
Top