We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am developing an Application in Android. For the visualization part, I am using Processing. Now I would like to show a number of visualization on one Android Activity.
The standard code for one visualization is the following:
public class MainActivity extends AppCompatActivity {
private PApplet sketch;
@Override
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 Sketch();
PFragment fragment = new PFragment(sketch);
fragment.setView(frame, this);
}
The code found on the "Processing for Android" website works for a single visualization. Now I would like to extend this to a number of visualizations each given a specific (x,y) position on the Activity Layout. Which methods allow me to do that?
Can you point me in the right direction?
Kind regards,
Niels
Answers
I have found an answer to my questions.. Answer lie in setting a Static ID to my FrameLayouts and then losing the "SetContentView()" method..
@nvwingh===
sorry, i dont understand what you are doing: more precisely what are you calling "visualizations"??? - And why setting static the id permits more than one "visualization"???
With visualizations I mean to communicate information clearly and efficiently via statistical graphics, plots and information graphics. So using obtained data in Graphs, BoxPlots,..
The idea is to have a number of FrameLayouts in different positions on the screen. So to define a number of FrameLayouts with different relative screen positions. Setting the id dynamically does not allow me control on the position of the FrameLayouts. Setting it statically does..
Sorry for the long wait, I was working on something else..
Beste Niels, Ik heb al een tijdje gewerkt nu met P5 en wil nu verder leren op AS Het zijn mijn eerste stappen in deze wereld. Ik zou je willen vragen of je een voorbeeld programma, anders dan die van op de Github, om mee te beginnen. Zit je ook op het niewe forum?