Bakke Andres Bakke Andres - 5 months ago 22
Android Question

How to destroy an android activity after when I sending a post with a web service?

I'm trying to submit a form using a web service done with GlassFish in Java and save the data in a PostgreSQL database. I am using AsyncTask to send data. The problem I have is that when I've finish sending the data I want to destroy the activity and return to the main page.

Answer

if you are in a sub-method, listeners, etc.:

youractivityclass.this.finish();

if you are directly on your activity class just call

finish()