Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 941

Where or how is it possible (if it is...) to add some layout to an app with P3???

$
0
0

with Eclipse with or without P3 i can easily , from xml or from code, add a layout to an app. I have tried to do the same with P3 (coding) with this simple code (importing what is needed)

             Activity act;

            act = this.getActivity() // which is "said" an error by P3, i dont understand why as this is the way to do in a fragment
            //yet does not matter as it compiles....

            layout = new LinearLayout(act);

                tv = new TextView(act);
            layout.setLayoutParams(new ViewGroup.LayoutParams(-1,-1));
                tv.setLayoutParams(new ViewGroup.LayoutParams(-1,-2));
                 tv.setText("Hello world!");
            tv.setId(2);

                layout.addView(tv);

---- not any error in the console ----the sketch is launched "successfully" ---- the app crashes on the device (real one) ---- not any error message returned....

-----then i have tried to create manually and put some layout: :: but where ??? -----i have created a layout folder in res, given an hard coded id to the layout but when i want to inflate it (in another fragment) i get an error saying that this resource does not exist


Viewing all articles
Browse latest Browse all 941

Trending Articles