package com.shayan.pourvatan.eventbus;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import eventManager.EventManager;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {


    EditText editText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        editText = (EditText) findViewById(R.id.main_et);
        findViewById(R.id.main_passData).setOnClickListener(this);
        findViewById(R.id.main_detail).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {

        switch (v.getId()) {
            case R.id.main_detail:
                startActivity(new Intent(MainActivity.this, DetailActivity.class));
                break;


            case R.id.main_passData:

                EventManager.getInstance().postEvent(ApplicationClass.MAIN_TEST_EVENT_NUM,
                        editText.getText().toString(),
                        "another data",
                        12); // you can pass any data

                break;
        }
    }
}

@@ -64,16 +64,69 @@
 Intent;%0A
+import android.os.Handler;%0Aimport android.os.Looper;%0A
 import a
@@ -166,16 +166,16 @@
 tivity;%0A
-
 import a
@@ -249,16 +249,74 @@
 ditText;
+%0Aimport android.widget.TextView;%0A%0Aimport java.util.Locale;
 %0A%0Aimport
@@ -454,16 +454,63 @@
 ditText;
+%0A    TextView textView;%0A%0A    Handler uiHandler;
 %0A%0A    @O
@@ -726,16 +726,75 @@
 in_et);%0A
+        textView = (TextView) findViewById(R.id.main_tv);%0A%0A
         
@@ -912,24 +912,82 @@
 tener(this);
+%0A%0A        uiHandler = new Handler(Looper.getMainLooper());
 %0A    %7D%0A%0A    
@@ -1428,16 +1428,16 @@
  data%22,%0A
-
         
@@ -1483,16 +1483,679 @@
 y data%0A%0A
+%0A                // use one of following way to update UI%0A                runOnUiThread(new Runnable() %7B%0A                    @Override%0A                    public void run() %7B%0A                        textView.setText(String.format(Locale.getDefault(), %22EditText value is : %25s%22 , editText.getText().toString()));%0A                    %7D%0A                %7D);%0A%0A//                uiHandler.post(new Runnable() %7B%0A//                    @Override%0A//                    public void run() %7B%0A//                        textView.setText(String.format(Locale.getDefault(), %22EditText value is : %25s%22 , editText.getText().toString()));%0A//                    %7D%0A//                %7D);%0A%0A
         

add UI update sample in MainActivity.