Android Question I want to convert this code to B4A

AlfaizDev

Well-Known Member
Licensed User
Longtime User
Welcome
I want to convert this code to B4A


B4X: Copy
Sub SingleLineCS (cs As CSBuilder) As CSBuilder
    Dim ParaStyle As NativeObject
    ParaStyle = ParaStyle.Initialize("NSMutableParagraphStyle").RunMethod("alloc",Null).RunMethod("init",Null)
    ParaStyle.SetField("alignment",2)
    ParaStyle.SetField("lineBreakMode", 4)
    cs.As(NativeObject).RunMethod("addAttribute:value:range:", Array("NSParagraphStyle", ParaStyle, cs.As(NativeObject).MakeRange(0, cs.Length)))
    Return cs
End Sub
 
I can't understand what you want to do? why do you convert the code? can't it be called in B4A?
 
Upvote 0
There is a function that replaces it in java Android Studio
I want to call more orders related to
Csbuilder
Perhaps it is by Reflector
Or javaobject
 
Last edited:
Upvote 0
Could you show with an image or something else what should be the result that you would like to obtain?
 
Upvote 0
Shouldn't you start by replacing NativeObject (which I think is used in B4i) with JavaObject which is used in B4A?
probably yes. Also NSMutableParagraphStyle is not known in Android.
 
Upvote 0
Could you show with an image or something else what should be the result that you would like to obtain?

I use Clvtree
I customize the offer with Csbuilder
This problem is in the picture

1654075143451.png



I want it look like this

1654075307395.png
 
Upvote 0
You want to maintain the single line in CLV item and show "..." if the text would exceed in two or more lines?
And then show the entire text when clicking?
In this case I think that JavaObject it's not needed.
It would be easier to have your project, if possible, to work on it.
 
Upvote 0
You want to maintain the single line in CLV item and show "..." if the text would exceed in two or more lines?
And then show the entire text when clicking?
In this case I think that JavaObject it's not needed.
It would be easier to have your project, if possible, to work on it.
 

Attachments

Upvote 0
you can not convert a swift code to android.
Find a androidcode (java) which works as expected. We can help porting this code. But not with Swift-Code
Do not care about my question a lot
The important thing is that I want a solution to this problem
Even in another way
And if the answer is contrary to the way in the question

Look
Post 7, 9
 
Upvote 0
Post 7, 9
i can´t help with that. I can not read anything from this output. I´m not interested in understanding this language either.
You probably have to split the long text by yourself and add a ... at the end so it matches one line.
 
Upvote 0
As it is a Specialized CLV I don't know how much it's customizable.
I am not used to it.
Sorry.
I thought that it was an experiment, as it was populated as a normal CLV.
My mistake.
But I think I am not able to help you further.
 
Upvote 0
As it is a Specialized CLV I don't know how much it's customizable.
I am not used to it.
Sorry.
I thought that it was an experiment, as it was populated as a normal CLV.
My mistake.
But I think I am not able to help you further.
It's okay
Thank you
 
Upvote 0
Back
Top