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

Processing to Android visualization on Android

$
0
0

I am running Processing Sketches on Android Studio. Did it through exporting the project from Processing to Android, checking all the libraries. Then started a new Android Project, added these libraries, and that's it.. Now the question is how to project them in a visually appealing way on the activity layout.. For instance, how can I control how big the area is a Processing Sketch is displayed on. Another question is how to load a number of Processing Sketches in different places on the Layout.

Does anyone have experience on this, can share some code, point me to some sketches...?

THANKS!!!!

public class MainActivity extends AppCompatActivity {  

private PApplet sketch;
private PApplet secondsketch;

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout frame = new FrameLayout(this);
    frame.setId(CompatUtils.getUniqueViewId());
    setContentView(frame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));


    sketch = new weatherBrussels();

    PFragment fragment = new PFragment(sketch);
    fragment.setView(frame, this);
}


public void onRequestPermissionsResult(int requestCode,
                                       String permissions[],
                                       int[] grantResults) {
    if (sketch != null) {
        sketch.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }
}


public void onNewIntent(Intent intent) {
    if (sketch != null) {
        sketch.onNewIntent(intent);
    }
}

}


Viewing all articles
Browse latest Browse all 941