I know that this exception is thrown when an application attempts to perform a networking operation on its main thread. I am running my code in AsyncTask
.
I'm trying to connect to database in an a button's setOnClickListener
How should I proceed, and avoid this Exception? I mean, how to set my code in order to execute database connection in a AsyncTask
?