| | |
| | | import android.os.Bundle; |
| | | import android.support.annotation.NonNull; |
| | | import android.support.annotation.Nullable; |
| | | import android.util.Log; |
| | | import android.widget.Toast; |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | |
| | | MyLog.i(TAG,"onCreate"); |
| | | MainViewModel mainViewModel = ViewModelProviders.of(this).get(MainViewModel.class); |
| | | mainViewModel.getJson().observe(this, new Observer<String>() { |
| | | @Override |
| | | public void onChanged(@Nullable String json) { |
| | | Toast.makeText(MainActivity.this, json, Toast.LENGTH_SHORT).show(); |
| | | MyLog.i(TAG,"json=========="+json); |
| | | MyLog.i(TAG,"json=========="+Thread.currentThread().getName()); |
| | | MyLog.i(TAG,"json=========="+json+" ThreadName:"+Thread.currentThread().getName()); |
| | | |
| | | } |
| | | }); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | Log.i(TAG, "onDestroy: "); |
| | | } |
| | | |
| | | @Override |
| | | protected void onResume() { |