Android Question Customview Property Grayed Out In Designer

Mahares

Expert
Licensed User
Longtime User
I copied a layout file from Project1 to Project2. The layout file has a Customview: SpeakButton. When I compile Project2, I get the below warning in the logs, despite cleaning unused files and cleaning project. The project compiles ok . In older versions of B4A you could go to Designer and change the custom view property. But, using version 6.50, it is grayed out :

Class not found: com.cart.hhedataentry.speakbutton, trying: com.cart.divdataentrytabstrip.speakbutton

Where can I get rid of the warning (nuisance warning)?
Thank you
 

DonManfred

Expert
Licensed User
Longtime User
Where can I get rid of the warning (nuisance warning)?
Edit the layout, remove the custom view which you are not using in the active project and save the layout.
In your old project you was using a lib which adds an customview.
You need to use the lib in your new project too to get the customview enabled
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Edit the layout, remove the custom view which you are not using in the active project and save the layout.
It is not a matter of one customview. We are talking about 19 SpeakButton custom views, which will have to be deleted and recreated in the new project, and trying to remember their placement in the different layouts is no picnic. There has to be an easier way.

In your old project you was using a lib which adds an customview.
No, I do not use a lib for the customview. I use the Class module for the SpeakButton customview in both projects.
If there is no other more practical way, I can live with it, because they are just nuisance warnings and the project runs fine.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Note: objects placed in a layout stores the info about the app you are using(packagename).

If the customview comes from a Class then you should add the class to your new project too.
If you are already using the class in your new project you can try to

"load the layout (from old project) in the designer in your new project. SAVE the layout without changes. Try to run the app again"
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
If the customview comes from a Class then you should add the class to your new project too.
I already mentioned in my previous post that the class is also added in the new project.
If you are already using the class in your new project you can try to
"load the layout (from old project) in the designer in your new project
That is precisely what I did, but it still shows the warning.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
and you SAVED the layout in your new project too? I asked because you quoted just a part of my answer
Of course I did save it Manfred. I have done this type of procedure several times before with older versions of B4A and the customview property in the designer allows you to manually change the package name that it refers to and put the new package name in its place, but lately since I am using 6.50, that line in the designer is always grayed out.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Ok. then i must give up, sorry
For those of you who want to reproduce the warning and like a challenge and beat Erel to it, I have attached a simple project making use of the SpeakButton customview:
1. Run the attached project to simply see how it works. Close project.
2. Make a copy of the attached project to a new project.
3. Open the new project. Change its label and its package name.
4. Open Designer only layout. Save layout. Also, save the project with the new package name.
5. Run the new project and look at the logs. You will see a warning similar to this:
Class not found: b4a.example.speakone.speakbutton, trying: b4a.example.speaktwo.speakbutton
 

Attachments

  • SpeakButtonTestOne.zip
    9.2 KB · Views: 231
Upvote 0

Mahares

Expert
Licensed User
Longtime User
POSSIBLE SOLUTION:
1. Compile the SpeakButton Class module to a library and copy the xml and jar files to the Additional Library folder.
2. Open the second project, remove the SpeakButton Class module. Refresh the library and select the newly created SpeakButton library from the list of libs.
3. Save the project and run it.
The nuisance warning I was complaining about in Post #1 disappears and everything seems to work just fine.
I like to see @DonManfred test ( since he has followed this thread from the start) and @Erel or anyone else for that matter to confirm if this is a viable solution.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I was thinking about this already (compiling to library) but i thought it should be doable using "saving the layout" (like it works in the past) too...
i´m pretty sure that compiling the class to a library should fix this issue.
But i´m not sure if it is the only solution.
 
Upvote 0
Top