How can I make an activity go to background without calling its finish() method and return to the Parent activity that started this? I tried so much but I could
If you have data you want to cache / store / process in the background, you can use an AsyncTask or a Thread.
When you are ready to cache / transition to parent, you would do something like the following in one of your child Activity methods (assuming you started child with startActivityForResult() )
Thread Approach:
Thread t1 = new Thread(new Runnable() {
@Override
public void run() {
// PUT YOUR CACHING CODE HERE
}
});
t1.start();
setResult( whatever );
finish();
You can also use a Handler if you need to communicate anything back from your new thread.
AsyncTask Approach:
new CacheDataTask().execute( data params );
set_result( whatever );
finish();
The AsyncTask is for situations in which you need to process something in a new thread, but be able to communicate back with the UI process.