Answered here: 
https://stackoverflow.com/questions/67673539/display-an-android-linearlayout-in-a-codename-one-application

On Monday, May 24, 2021 at 5:24:27 PM UTC+3 ahmed.t...@gmail.com wrote:

> I have a method that implements native android code to create this view. 
> if the method returns an EditText or Button for example, all works fine. 
> but if it returns a LinearLayout, nothing happens and I have no error 
> message.
>
> signature of the method that calls on the native code:
> public interface NativeCall extends NativeInterface { public PeerComponent 
> getMainView(); } 
>
> native implementation code that works well:
> public class NativeCallImpl { public android.view.View getMainView() { 
> Button b0 = new Button(((Context) MyApplication.getContext())); return b0; 
> } public boolean isSupported() { return true; } } 
>
> native code implementation which does not work:
> public class NativeCallImpl { public android.view.View getMainView() { 
> Button b0 = new Button(((Context) MyApplication.getContext())); Button b1 = 
> new Button(((Context) MyApplication.getContext())); b0.setText("b0"); 
> b1.setText("b1"); LinearLayout linearLayout = new LinearLayout(((Context) 
> MyApplication.getContext())); 
> linearLayout.setOrientation(LinearLayout.VERTICAL); 
> linearLayout.addView(b0); linearLayout.addView(b1); return linearLayout; } 
> public boolean isSupported() { return true; } } 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/5dead35c-508c-4610-90fc-7184a1fda2b3n%40googlegroups.com.

Reply via email to