Update viewmodel from a different classWhat exactly is the difference between Android View Model and a Singleton classStop EditText from gaining focus at Activity startupWhat is the difference between “px”, “dip”, “dp” and “sp”?What is the difference between match_parent and fill_parent?Getting an exception when app startsGoogle map API v2Can someone show me a simple working implementation of PagerSlidingTabStrip?How to read Heart rate from Android WearAdding Social Media Share Logic From Firebase in AndroidThis use Navigation Drawer, and use Tab, and use Fragment. how communication between FragmentActivity and Fragment?How to add child(Product) under a child(Store) in Firebase Database using RecyclerView

How to import .txt file with missing data?

In Pandemic, why take the extra step of eradicating a disease after you've cured it?

What class is best to play when a level behind the rest of the party?

What do I need to do, tax-wise, for a sudden windfall?

When editor does not respond to the request for withdrawal

Dedicated bike GPS computer over smartphone

In The Incredibles 2, why does Screenslaver's name use a pun on something that doesn't exist in the 1950s pastiche?

Boss making me feel guilty for leaving the company at the end of my internship

Is fission/fusion to iron the most efficient way to convert mass to energy?

Placement of positioning lights on A320 winglets

Am I allowed to determine tenets of my contract as a warlock?

What does BREAD stand for while drafting?

How can religions without a hell discourage evil-doing?

Keeping track of theme when improvising

How do I properly use a function under a class?

What is Gilligan's full name?

What is the theme of analysis?

Is plausible to have subspecies with & without separate sexes?

Is it good practice to create tables dynamically?

Is it a good security practice to force employees hide their employer to avoid being targeted?

Can you open the door or die? v2

Must I use my personal social media account for work?

How can I find out about the game world without meta-influencing it?

Changing the PK column of a data extension without completely recreating it



Update viewmodel from a different class


What exactly is the difference between Android View Model and a Singleton classStop EditText from gaining focus at Activity startupWhat is the difference between “px”, “dip”, “dp” and “sp”?What is the difference between match_parent and fill_parent?Getting an exception when app startsGoogle map API v2Can someone show me a simple working implementation of PagerSlidingTabStrip?How to read Heart rate from Android WearAdding Social Media Share Logic From Firebase in AndroidThis use Navigation Drawer, and use Tab, and use Fragment. how communication between FragmentActivity and Fragment?How to add child(Product) under a child(Store) in Firebase Database using RecyclerView






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to understand ViewModel and LiveData.



In MainActivity, I am observing LiveData
In MyTask, I am setting data on the LiveData, that should be displayed in the activity.



Problem is data set in MyTask is not getting updated on the UI.



MainActivity



public class MainActivity extends AppCompatActivity 

private MyViewModel viewModel;
private TextView tv2;

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

tv2 = findViewById(R.id.textView2);

viewModel = ViewModelProviders.of(this).get(MyViewModel.class);

findViewById(R.id.button).setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
viewModel.setNameData("Button clicked");
new MyTask(getApplication()).execute();

);

viewModel.getNameData().observe(this, new Observer<String>()
@Override
public void onChanged(@Nullable String s)
tv2.setText(s);

);





ViewModel class



public class MyViewModel extends AndroidViewModel 

private MutableLiveData<String> nameData = new MutableLiveData<>();

public MutableLiveData<String> getNameData()
return nameData;


public void setNameData(String name)
nameData.postValue(name);



public MyViewModel(@NonNull Application application)
super(application);




MyTask class



public class MyTask extends AsyncTask<Void, Void, Void> 

private MyViewModel viewModel;

public MyTask(Application application)
viewModel = new MyViewModel(application);


@Override
protected Void doInBackground(Void... voids)

try
Thread.sleep(2000);
catch (InterruptedException e)
e.printStackTrace();


return null;


@Override
protected void onPostExecute(Void aVoid)
super.onPostExecute(aVoid);

viewModel.setNameData("Done task");












share|improve this question






















  • Don't create a new instance of MyViewModel in your task, pass in the one you obtained in your Activity

    – EpicPandaForce
    Mar 25 at 0:35











  • @EpicPandaForce Is there a way I can create an instance in task without passing? I know it's not a good idea to have singleton ViewModel class

    – dcanh121
    Mar 25 at 0:38











  • Just do new MyTask(viewModel)

    – EpicPandaForce
    Mar 25 at 0:42











  • Yes, I am trying to explore other ways, in which I do not want to pass any activity reference.

    – dcanh121
    Mar 25 at 0:44











  • You're not passing the Activity reference, you're passing the ViewModel reference. 🤔

    – EpicPandaForce
    Mar 25 at 1:01

















0















I am trying to understand ViewModel and LiveData.



In MainActivity, I am observing LiveData
In MyTask, I am setting data on the LiveData, that should be displayed in the activity.



Problem is data set in MyTask is not getting updated on the UI.



MainActivity



public class MainActivity extends AppCompatActivity 

private MyViewModel viewModel;
private TextView tv2;

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

tv2 = findViewById(R.id.textView2);

viewModel = ViewModelProviders.of(this).get(MyViewModel.class);

findViewById(R.id.button).setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
viewModel.setNameData("Button clicked");
new MyTask(getApplication()).execute();

);

viewModel.getNameData().observe(this, new Observer<String>()
@Override
public void onChanged(@Nullable String s)
tv2.setText(s);

);





ViewModel class



public class MyViewModel extends AndroidViewModel 

private MutableLiveData<String> nameData = new MutableLiveData<>();

public MutableLiveData<String> getNameData()
return nameData;


public void setNameData(String name)
nameData.postValue(name);



public MyViewModel(@NonNull Application application)
super(application);




MyTask class



public class MyTask extends AsyncTask<Void, Void, Void> 

private MyViewModel viewModel;

public MyTask(Application application)
viewModel = new MyViewModel(application);


@Override
protected Void doInBackground(Void... voids)

try
Thread.sleep(2000);
catch (InterruptedException e)
e.printStackTrace();


return null;


@Override
protected void onPostExecute(Void aVoid)
super.onPostExecute(aVoid);

viewModel.setNameData("Done task");












share|improve this question






















  • Don't create a new instance of MyViewModel in your task, pass in the one you obtained in your Activity

    – EpicPandaForce
    Mar 25 at 0:35











  • @EpicPandaForce Is there a way I can create an instance in task without passing? I know it's not a good idea to have singleton ViewModel class

    – dcanh121
    Mar 25 at 0:38











  • Just do new MyTask(viewModel)

    – EpicPandaForce
    Mar 25 at 0:42











  • Yes, I am trying to explore other ways, in which I do not want to pass any activity reference.

    – dcanh121
    Mar 25 at 0:44











  • You're not passing the Activity reference, you're passing the ViewModel reference. 🤔

    – EpicPandaForce
    Mar 25 at 1:01













0












0








0








I am trying to understand ViewModel and LiveData.



In MainActivity, I am observing LiveData
In MyTask, I am setting data on the LiveData, that should be displayed in the activity.



Problem is data set in MyTask is not getting updated on the UI.



MainActivity



public class MainActivity extends AppCompatActivity 

private MyViewModel viewModel;
private TextView tv2;

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

tv2 = findViewById(R.id.textView2);

viewModel = ViewModelProviders.of(this).get(MyViewModel.class);

findViewById(R.id.button).setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
viewModel.setNameData("Button clicked");
new MyTask(getApplication()).execute();

);

viewModel.getNameData().observe(this, new Observer<String>()
@Override
public void onChanged(@Nullable String s)
tv2.setText(s);

);





ViewModel class



public class MyViewModel extends AndroidViewModel 

private MutableLiveData<String> nameData = new MutableLiveData<>();

public MutableLiveData<String> getNameData()
return nameData;


public void setNameData(String name)
nameData.postValue(name);



public MyViewModel(@NonNull Application application)
super(application);




MyTask class



public class MyTask extends AsyncTask<Void, Void, Void> 

private MyViewModel viewModel;

public MyTask(Application application)
viewModel = new MyViewModel(application);


@Override
protected Void doInBackground(Void... voids)

try
Thread.sleep(2000);
catch (InterruptedException e)
e.printStackTrace();


return null;


@Override
protected void onPostExecute(Void aVoid)
super.onPostExecute(aVoid);

viewModel.setNameData("Done task");












share|improve this question














I am trying to understand ViewModel and LiveData.



In MainActivity, I am observing LiveData
In MyTask, I am setting data on the LiveData, that should be displayed in the activity.



Problem is data set in MyTask is not getting updated on the UI.



MainActivity



public class MainActivity extends AppCompatActivity 

private MyViewModel viewModel;
private TextView tv2;

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

tv2 = findViewById(R.id.textView2);

viewModel = ViewModelProviders.of(this).get(MyViewModel.class);

findViewById(R.id.button).setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
viewModel.setNameData("Button clicked");
new MyTask(getApplication()).execute();

);

viewModel.getNameData().observe(this, new Observer<String>()
@Override
public void onChanged(@Nullable String s)
tv2.setText(s);

);





ViewModel class



public class MyViewModel extends AndroidViewModel 

private MutableLiveData<String> nameData = new MutableLiveData<>();

public MutableLiveData<String> getNameData()
return nameData;


public void setNameData(String name)
nameData.postValue(name);



public MyViewModel(@NonNull Application application)
super(application);




MyTask class



public class MyTask extends AsyncTask<Void, Void, Void> 

private MyViewModel viewModel;

public MyTask(Application application)
viewModel = new MyViewModel(application);


@Override
protected Void doInBackground(Void... voids)

try
Thread.sleep(2000);
catch (InterruptedException e)
e.printStackTrace();


return null;


@Override
protected void onPostExecute(Void aVoid)
super.onPostExecute(aVoid);

viewModel.setNameData("Done task");









android android-livedata android-viewmodel






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 0:10









dcanh121dcanh121

3,00273075




3,00273075












  • Don't create a new instance of MyViewModel in your task, pass in the one you obtained in your Activity

    – EpicPandaForce
    Mar 25 at 0:35











  • @EpicPandaForce Is there a way I can create an instance in task without passing? I know it's not a good idea to have singleton ViewModel class

    – dcanh121
    Mar 25 at 0:38











  • Just do new MyTask(viewModel)

    – EpicPandaForce
    Mar 25 at 0:42











  • Yes, I am trying to explore other ways, in which I do not want to pass any activity reference.

    – dcanh121
    Mar 25 at 0:44











  • You're not passing the Activity reference, you're passing the ViewModel reference. 🤔

    – EpicPandaForce
    Mar 25 at 1:01

















  • Don't create a new instance of MyViewModel in your task, pass in the one you obtained in your Activity

    – EpicPandaForce
    Mar 25 at 0:35











  • @EpicPandaForce Is there a way I can create an instance in task without passing? I know it's not a good idea to have singleton ViewModel class

    – dcanh121
    Mar 25 at 0:38











  • Just do new MyTask(viewModel)

    – EpicPandaForce
    Mar 25 at 0:42











  • Yes, I am trying to explore other ways, in which I do not want to pass any activity reference.

    – dcanh121
    Mar 25 at 0:44











  • You're not passing the Activity reference, you're passing the ViewModel reference. 🤔

    – EpicPandaForce
    Mar 25 at 1:01
















Don't create a new instance of MyViewModel in your task, pass in the one you obtained in your Activity

– EpicPandaForce
Mar 25 at 0:35





Don't create a new instance of MyViewModel in your task, pass in the one you obtained in your Activity

– EpicPandaForce
Mar 25 at 0:35













@EpicPandaForce Is there a way I can create an instance in task without passing? I know it's not a good idea to have singleton ViewModel class

– dcanh121
Mar 25 at 0:38





@EpicPandaForce Is there a way I can create an instance in task without passing? I know it's not a good idea to have singleton ViewModel class

– dcanh121
Mar 25 at 0:38













Just do new MyTask(viewModel)

– EpicPandaForce
Mar 25 at 0:42





Just do new MyTask(viewModel)

– EpicPandaForce
Mar 25 at 0:42













Yes, I am trying to explore other ways, in which I do not want to pass any activity reference.

– dcanh121
Mar 25 at 0:44





Yes, I am trying to explore other ways, in which I do not want to pass any activity reference.

– dcanh121
Mar 25 at 0:44













You're not passing the Activity reference, you're passing the ViewModel reference. 🤔

– EpicPandaForce
Mar 25 at 1:01





You're not passing the Activity reference, you're passing the ViewModel reference. 🤔

– EpicPandaForce
Mar 25 at 1:01












2 Answers
2






active

oldest

votes


















0














Instead of creating a new instance just pass the created instance of viewmodel



public MyTask(MyViewModel myViewModel) 
viewmodel = myViewModel;



And then try to update the Ui




To update the observer the viewmodel needs the activity context ..inside which the livedata is observed.. you are creating a separate instance of the viewmodel inside the AsyncTask..







share|improve this answer

























  • It's already there in the MainActivity. I am creating using viewModel = ViewModelProviders.of(this).get(MyViewModel.class); In MyTask, I am using new keyword.

    – dcanh121
    Mar 25 at 0:16











  • You are using application context ...that's not the right way ... In the contractor you should pass activity context...

    – Santanu Sur
    Mar 25 at 0:18











  • @dcanh21 please check the update

    – Santanu Sur
    Mar 25 at 0:21











  • I want to use AndroidViewModel which uses the application. To set the data in LiveModel, why will I need activity?

    – dcanh121
    Mar 25 at 0:22











  • Please check the update

    – Santanu Sur
    Mar 25 at 0:27


















0














According to https://medium.com/androiddevelopers/viewmodels-and-livedata-patterns-antipatterns-21efaef74a54




"Instead of trying to solve this with libraries or extensions to the
Architecture Components, it should be faced as a design problem. We
recommend you treat your events as part of your state."




We should not share the livedata or viewmodel instance.



Activity -> Viewmodel -> Repository


Activity should contain instance of a viewModel. If the button is clicked, it should be notified to the viewModel which shall start the task. After getting response in viewmodel, update the livedata. It will automatically get notified in the Activity.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55329800%2fupdate-viewmodel-from-a-different-class%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Instead of creating a new instance just pass the created instance of viewmodel



    public MyTask(MyViewModel myViewModel) 
    viewmodel = myViewModel;



    And then try to update the Ui




    To update the observer the viewmodel needs the activity context ..inside which the livedata is observed.. you are creating a separate instance of the viewmodel inside the AsyncTask..







    share|improve this answer

























    • It's already there in the MainActivity. I am creating using viewModel = ViewModelProviders.of(this).get(MyViewModel.class); In MyTask, I am using new keyword.

      – dcanh121
      Mar 25 at 0:16











    • You are using application context ...that's not the right way ... In the contractor you should pass activity context...

      – Santanu Sur
      Mar 25 at 0:18











    • @dcanh21 please check the update

      – Santanu Sur
      Mar 25 at 0:21











    • I want to use AndroidViewModel which uses the application. To set the data in LiveModel, why will I need activity?

      – dcanh121
      Mar 25 at 0:22











    • Please check the update

      – Santanu Sur
      Mar 25 at 0:27















    0














    Instead of creating a new instance just pass the created instance of viewmodel



    public MyTask(MyViewModel myViewModel) 
    viewmodel = myViewModel;



    And then try to update the Ui




    To update the observer the viewmodel needs the activity context ..inside which the livedata is observed.. you are creating a separate instance of the viewmodel inside the AsyncTask..







    share|improve this answer

























    • It's already there in the MainActivity. I am creating using viewModel = ViewModelProviders.of(this).get(MyViewModel.class); In MyTask, I am using new keyword.

      – dcanh121
      Mar 25 at 0:16











    • You are using application context ...that's not the right way ... In the contractor you should pass activity context...

      – Santanu Sur
      Mar 25 at 0:18











    • @dcanh21 please check the update

      – Santanu Sur
      Mar 25 at 0:21











    • I want to use AndroidViewModel which uses the application. To set the data in LiveModel, why will I need activity?

      – dcanh121
      Mar 25 at 0:22











    • Please check the update

      – Santanu Sur
      Mar 25 at 0:27













    0












    0








    0







    Instead of creating a new instance just pass the created instance of viewmodel



    public MyTask(MyViewModel myViewModel) 
    viewmodel = myViewModel;



    And then try to update the Ui




    To update the observer the viewmodel needs the activity context ..inside which the livedata is observed.. you are creating a separate instance of the viewmodel inside the AsyncTask..







    share|improve this answer















    Instead of creating a new instance just pass the created instance of viewmodel



    public MyTask(MyViewModel myViewModel) 
    viewmodel = myViewModel;



    And then try to update the Ui




    To update the observer the viewmodel needs the activity context ..inside which the livedata is observed.. you are creating a separate instance of the viewmodel inside the AsyncTask..








    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 25 at 0:42

























    answered Mar 25 at 0:15









    Santanu SurSantanu Sur

    4,2573831




    4,2573831












    • It's already there in the MainActivity. I am creating using viewModel = ViewModelProviders.of(this).get(MyViewModel.class); In MyTask, I am using new keyword.

      – dcanh121
      Mar 25 at 0:16











    • You are using application context ...that's not the right way ... In the contractor you should pass activity context...

      – Santanu Sur
      Mar 25 at 0:18











    • @dcanh21 please check the update

      – Santanu Sur
      Mar 25 at 0:21











    • I want to use AndroidViewModel which uses the application. To set the data in LiveModel, why will I need activity?

      – dcanh121
      Mar 25 at 0:22











    • Please check the update

      – Santanu Sur
      Mar 25 at 0:27

















    • It's already there in the MainActivity. I am creating using viewModel = ViewModelProviders.of(this).get(MyViewModel.class); In MyTask, I am using new keyword.

      – dcanh121
      Mar 25 at 0:16











    • You are using application context ...that's not the right way ... In the contractor you should pass activity context...

      – Santanu Sur
      Mar 25 at 0:18











    • @dcanh21 please check the update

      – Santanu Sur
      Mar 25 at 0:21











    • I want to use AndroidViewModel which uses the application. To set the data in LiveModel, why will I need activity?

      – dcanh121
      Mar 25 at 0:22











    • Please check the update

      – Santanu Sur
      Mar 25 at 0:27
















    It's already there in the MainActivity. I am creating using viewModel = ViewModelProviders.of(this).get(MyViewModel.class); In MyTask, I am using new keyword.

    – dcanh121
    Mar 25 at 0:16





    It's already there in the MainActivity. I am creating using viewModel = ViewModelProviders.of(this).get(MyViewModel.class); In MyTask, I am using new keyword.

    – dcanh121
    Mar 25 at 0:16













    You are using application context ...that's not the right way ... In the contractor you should pass activity context...

    – Santanu Sur
    Mar 25 at 0:18





    You are using application context ...that's not the right way ... In the contractor you should pass activity context...

    – Santanu Sur
    Mar 25 at 0:18













    @dcanh21 please check the update

    – Santanu Sur
    Mar 25 at 0:21





    @dcanh21 please check the update

    – Santanu Sur
    Mar 25 at 0:21













    I want to use AndroidViewModel which uses the application. To set the data in LiveModel, why will I need activity?

    – dcanh121
    Mar 25 at 0:22





    I want to use AndroidViewModel which uses the application. To set the data in LiveModel, why will I need activity?

    – dcanh121
    Mar 25 at 0:22













    Please check the update

    – Santanu Sur
    Mar 25 at 0:27





    Please check the update

    – Santanu Sur
    Mar 25 at 0:27













    0














    According to https://medium.com/androiddevelopers/viewmodels-and-livedata-patterns-antipatterns-21efaef74a54




    "Instead of trying to solve this with libraries or extensions to the
    Architecture Components, it should be faced as a design problem. We
    recommend you treat your events as part of your state."




    We should not share the livedata or viewmodel instance.



    Activity -> Viewmodel -> Repository


    Activity should contain instance of a viewModel. If the button is clicked, it should be notified to the viewModel which shall start the task. After getting response in viewmodel, update the livedata. It will automatically get notified in the Activity.






    share|improve this answer



























      0














      According to https://medium.com/androiddevelopers/viewmodels-and-livedata-patterns-antipatterns-21efaef74a54




      "Instead of trying to solve this with libraries or extensions to the
      Architecture Components, it should be faced as a design problem. We
      recommend you treat your events as part of your state."




      We should not share the livedata or viewmodel instance.



      Activity -> Viewmodel -> Repository


      Activity should contain instance of a viewModel. If the button is clicked, it should be notified to the viewModel which shall start the task. After getting response in viewmodel, update the livedata. It will automatically get notified in the Activity.






      share|improve this answer

























        0












        0








        0







        According to https://medium.com/androiddevelopers/viewmodels-and-livedata-patterns-antipatterns-21efaef74a54




        "Instead of trying to solve this with libraries or extensions to the
        Architecture Components, it should be faced as a design problem. We
        recommend you treat your events as part of your state."




        We should not share the livedata or viewmodel instance.



        Activity -> Viewmodel -> Repository


        Activity should contain instance of a viewModel. If the button is clicked, it should be notified to the viewModel which shall start the task. After getting response in viewmodel, update the livedata. It will automatically get notified in the Activity.






        share|improve this answer













        According to https://medium.com/androiddevelopers/viewmodels-and-livedata-patterns-antipatterns-21efaef74a54




        "Instead of trying to solve this with libraries or extensions to the
        Architecture Components, it should be faced as a design problem. We
        recommend you treat your events as part of your state."




        We should not share the livedata or viewmodel instance.



        Activity -> Viewmodel -> Repository


        Activity should contain instance of a viewModel. If the button is clicked, it should be notified to the viewModel which shall start the task. After getting response in viewmodel, update the livedata. It will automatically get notified in the Activity.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 1 at 18:12









        dcanh121dcanh121

        3,00273075




        3,00273075



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55329800%2fupdate-viewmodel-from-a-different-class%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript