My android app connects to my website to retrieve and upload information so I use an AsyncTask thread.
In one instance, I need my thread to return a true or a false
Handler is the best way to do this
in onPostExcecute() method simply do
@Override
protected void onPostExecute(Boolean bool) {
super.onPostExecute(bool);
Message msg=new Message();
msg.obj=bool;
mHandler.sendMessage(msg);
}
}
and your message handler will be
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
bool i=(String)msg.obj;
}
};