How to implement Processing Sketch without PFragment ?

edited December 2016 in Android Mode

Hello everybody !

Since P3, it seems that the object PFragment is not available :

import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;


import processing.core.*;
import processing.android.P;


public class MainActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.class_main);

        FragmentManager fragmentManager = getFragmentManager();
        PApplet sketch = new Sketch();
        PFragment fragment = new PFragment();
        fragment.setSketch(sketch);
        fragmentManager.beginTransaction().replace(R.id.container, fragment).commit();
    }
}

How can I do to insert my Processing Sketch in my Android Studio project ?

Thank you, Regards,

Arthur

Tagged:

Answers

  • No screenshots of your code please. Your code will be no searchable by other forum goers, for instance.

    Kf

  • Hello kfrajer,

    Sorry for that, I edited my post. Do you have any idea concerning PFragment ?

    Thank you,

    Arthur

  • @arthbouc===

    you create a new project in AS or eclipse extending Applet ( P5.jar must be added)=== that s all ...

  • Thank you Akhenaton !

    I read that since Processing 3, PApplet doesn't extending Activity anymore. Where can I find P5.jar ?

    Have a nice evening,

    Arthur

  • @arthbouc=== it does not extend Activity, it s a fragment created by an activity (that you cannot see in processing) && extending PApplet; as for the .jar you can get it in the mode folder (androidcore.jar)

Sign In or Register to comment.