button.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
setContentView(R.layout.activity_chart);
}
});
Hi i have the above code wherein upon clicking a button i am trying to display them activity activity_chart. In that activity i want to display a graph. Here i am calling a method createIntent(). But my problem is that the graph is not getting plotted. Please help i am new to android.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
createIntent();
}
public Intent createIntent()
{
...
}
Am i calling the method right.
A new Activity is called with:
startActivity(new Intent(currentActivity.this, nextActivity.class));
Then in your new Activities
onCreate(Bundle savedInstance)
method you can callsetContentView(Layout layout);
to set the new Layout.So if you want to change the Activity when clicking on a Button you have to do the following:
You are currently only changing the layout of the current Activity when clicking the button and not changing to another Activity.
I hope I understood you correctly. If not then provide me with some more code so I can try to understand what you want to do.