why same methods work Eclipse (+processingP3) and not in P3

edited November 2015 in Android Mode

the simplest example is::


              @  Override
                    public void onAttach(Activity activity) {
                        println("I am now in on attach life cycle");
                        act = super.getActivity();
                          c = act.getApplicationContext();
                          DisplayMetrics metrics = new DisplayMetrics();
                         println( metrics.widthPixels);

returns== what is expected= myDisplay.width== some size

P3:error=== on attach() does not exists... and getWindowManager does not exist... and.... (....super has to be transformed in "getActivity()", but here it does not matter...)


so :: on create(), or on createdView() or on start()

exists:: Why??? not error.... returns nothing...

there is obviously something i have not understood: is the aim (P3, android mode) to make simpler things that are not so simple (though!!) with android or make these simple things impossible??? on attach() is not called??? what is the use for android imports if they are ignored???

thanks in advance because now i begin to be tired out by P3 android mode....


  • AFAIK, Eclipse can smartly find out which libraries are needed and insert their imports automatically.
    In PDE, besides its default imports, every other import must be explicit!

  • edited October 2015

    @goToloop::: not at all!!! i do know what imports i do; they were done. my imports are absolutely ok, sure and that s why p3 does not claim (errors, console, what you want....)

    have you tried what i say??? try.... if not why are are you answering???

  • @ goToloop: on attach() --- (see my post) needs Fragment as import, no???? - that's the standard lifecycle for a fragment, no???

    -- of course i have done the import

    if not::: what else????

    why on attach() does not work???

  • I dunno Android, sorry! All I know onAtach() surely isn't PApplet's.
    So in order to @Override it, it's either happening inside a subclass or it belongs to an anonymous instantiation.

  • edited October 2015

    @GoToLoop ::

    ...onAttach() is not PApplet, that's sure!

    ----now, if i write onAttach() with Eclipse && P3 && importing Fragment + activity, not any error...WHY???


    ----when i write in P3

        @ Override
        public void onViewCreated(View view, Bundle savedInstanceState) {
            println("vie cree-------------");

    ---it does not fire any error accepts the overriding and returns what i want...

    ---is OnViewCreated() more PApplet than onAttach() in P3?

Sign In or Register to comment.