How to call function of one activity from another activity
<p>Actually i want to call a function of one activity from another activity..i write a simple code  for that but its not working..and show runtime error..please check the code...if there any mistake..</p>

<p>code for activity1:</p>

<pre><code>public class Activity1 extends Activity2  
{
        public void onCreate(Bundle savedInstanceState) 
        {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main2);

                call();
        }
        public void call()
        {
                showToast("Helloo");
        }
}
</code></pre>

<p>code for activity2:</p>

<pre><code>public class Activity2 extends Activity 
{

        public void onCreate(Bundle savedInstanceState) 
        {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
        }
        public void showToast(String s)
        {
                EditText t=(EditText)findViewById(R.id.editText1);
                t.setText(s);
        }
}
</code></pre>
