Android Question I want to convert this code to B4A

AlfaizDev

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


B4X:
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
 

teddybear

Well-Known Member
Licensed User
I can't understand what you want to do? why do you convert the code? can't it be called in B4A?
 
Upvote 0

AlfaizDev

Well-Known Member
Licensed User
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

Sagenut

Expert
Licensed User
Longtime User
Could you show with an image or something else what should be the result that you would like to obtain?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
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

AlfaizDev

Well-Known Member
Licensed User
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

Sagenut

Expert
Licensed User
Longtime User
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

AlfaizDev

Well-Known Member
Licensed User
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

  • Project.zip
    14.1 KB · Views: 83
Upvote 0

AlfaizDev

Well-Known Member
Licensed User
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

DonManfred

Expert
Licensed User
Longtime User
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

Sagenut

Expert
Licensed User
Longtime User
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

AlfaizDev

Well-Known Member
Licensed User
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

epiCode

Active Member
Licensed User
try this one
 

Attachments

  • Project.zip
    14.5 KB · Views: 90
Upvote 0
Top