I’m trying to pass a view from one activity to another activity.
In my 1st activity, onButtonClick, I’m navigating to another activity by using Intent.
I’ve written this line setContentView(R.layout.main); in 1st activity and also declared a graphView.
Now the problem is, I want to populate the graphView in the second activity but it’s reference i.e. mySimpleXYPlot = (XYPlot) findViewById(R.id.mySimpleXYPlot); is present in 1st activity.
So how can I acess mySimpleXYPlot in 2nd activity?
if I use
setContentView(R.layout.main);
mySimpleXYPlot = (XYPlot) findViewById(R.id.mySimpleXYPlot);
in 2nd activity, whole layout gets restarted which I don’t want to happen 🙁
ANY HELP WILL BE APPRICIATED !
Simply add the same xml in the second content view. If you have to use a specific part of your layout in more then one view put it in an separate xml and include it.