majijid
majijid

Reputation: 1

from an activity to new xml file without making new class for the xml

I want to know if threre is a way to use a button.OnclickListener() to go from one activity to xml file without making a class for that xml.For example:

btn.OnClickListener(new OnclickListener(){

@Override public void onClick(View v) {

       Intent i = new Intent(ex.this, ex.class);
       startActivity(i);

}};

we use the intent to go from activity class to another new activity class, and in the new class there is setContentView(R.layout.example); in onCreate method, so the xml layout will be displayed.

but I ask if there is a way to display the xml layout withot making a class activity.

Upvotes: 0

Views: 332

Answers (1)

Sim
Sim

Reputation: 231

There isn't if want to go to a new activity I believe you need a class. You can do this programatically without any XML. (however I am reasonably new to android so could be wrong)

Upvotes: 0

Related Questions