Skip to content

Instantly share code, notes, and snippets.

@burhanrashid52
Created November 14, 2017 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burhanrashid52/cada565831f28ef2f1687233257ef756 to your computer and use it in GitHub Desktop.
Save burhanrashid52/cada565831f28ef2f1687233257ef756 to your computer and use it in GitHub Desktop.
import android.arch.lifecycle.ViewModelProviders;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import com.burhan.arch.room.R;
public class RotationActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rotation);
TextView txtRotation = findViewById(R.id.txtRotate);
MyViewModel myViewModel = ViewModelProviders.of(this).get(MyViewModel.class);
txtRotation.setText("Rotations : " + myViewModel.getRotationCount());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment