how do i call methods from another class in android?
<p>I have two classes in question. Both extend Activity.</p>

<p>Class A</p>

<pre><code>public void displayinfo() 
{
setContentView(R.layout.dynamicinfo);
//Add some buttons dynamically here
//do some processing
// move on to Class B
}
</code></pre>

<p>In Class B: I want to go back to Class A state in UI if BACK button is pressed.</p>

<p>Class B</p>

<pre><code>//Register a listener for this button
Backbutton.setOnClickListener(new OnClickListener() 
{
public void onClick(View arg0)
{
Log.i("setOnClickListener", "Pressed Back Button ");
Toast.makeText(mycontext, "Pressed Back Button", Toast.LENGTH_SHORT).show();
//HERE I want to go back class's function in UI as well as restoring the sttae for that screen.
}
</code></pre>

<p>how do I do that?
I looked around some questions.
they did not answer clearly what I am looking for.hence the posting.</p>

<p>thanks.I think I was adding my own Back button on the Layout I created in the Class B's UI Screen --not using the regular "Back" button on the key board. May be that was the problem. </p>
