I'm new to multithreading in android and java, I'm having difficult time implementing a simple model in which we can start worker thread and send some message or runnable to the worker thread from main thread where it does some operation and send result to main thread and updating ui thread
I tried this:
public class NewThreadUsingRunnable implements Runnable {
Handler handler;
@Override
public void run() {
handler = new Handler(){
@Override
public void handleMessage(Message msg) {
Log.i("Message Recieved", " " + msg);
int result = 2+2
}
};
}
MainActivity:
new NewThreadUsingRunnable().run();