Hi. I have read a bunch of posts,articles and everything but i cant get a solution..
i make an android app..
i start the first activity(first class). then i have a button for the second activity which i load it like this:

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

in the second activity on click event to a button i want to call one method from the first activity:

firstactivity f1= new firstactivity();
f1.MyMethod("my string goes here")

when i run this the application crashes..i tried the try catch exeption and i printed to exeption which is one error for null... i cant get it to work.....

thanks

why don't you pass the object of the first activity within the intent?? i think it should work
like this

class MyMessage extends Serializable {
    private firstActivity myFirstActivityObj;

    public MyMessage(firstActivity obj) {
        myFirstActivityObj=obj;
    }

    public firstActivity getMyFirstActivityObj() {
        return myFirstActivityObj;
    }
}

Then in the first activity,

MyMessage msg=new MyMessage(this);
Intent i=new Intent(firstActivity.this, secondActivity.class);
i.putExtra("myMessage",msg);
startActivity(i);

Then in the second activity,

Intent i=getIntent();
firstActivity f1=((MyMessage)i.getSerializableExtra("myMessage")).getMyFirstActivityObj();
f1.someMethod(...);