Hi,
I just started learning Android programming. I've been programming in C# for 7 years, I know java is very similar to C#, but I am stumped with Android.
So this is what I have done and tried...(for testing purposes before I start what I am working on)
I have a new activity with a button that when clicked opens a new activity, which I'll call activity2, it has a button on it to try and close the current activity(activity2) and return to the main activity..
this is the code I have tried and it doesn't work..
protected void CloseMyActivity(View view) {
super.onStop();
finish();
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
I have tried omitting starting a new intent, didn't work. I have omitted the finish method and that didn't work and I have omitted the super.onStop method, not all at the same time though.
I am using my S3 for testing and when I get try the new button on activity2, it hangs for a minute then I get a message saying that it has stopped working.
But I can use the back button on the phone and it will bring me back to the original activity, and that's not what I need to do..
Fast forward...once I get this sorted out the activity2 button will actually be a save button to that will save the info and return to the main activity.

Sorry for a long post but I wanted to make sure that I explained everything.
I have searched online and everyone keeps saying use Finish(); but it just isn't happening..

thanks for all help!