Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 196cb3fd authored by 62160052's avatar 62160052
Browse files

Use LiveData with data binding

parent de9d6151
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,7 @@ android {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
dataBinding = true
}
}
......
......@@ -21,6 +21,7 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import com.example.android.unscramble.R
import com.example.android.unscramble.databinding.GameFragmentBinding
......@@ -48,7 +49,7 @@ class GameFragment : Fragment() {
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
binding = GameFragmentBinding.inflate(inflater, container, false)
binding = DataBindingUtil.inflate(inflater, R.layout.game_fragment, container, false)
Log.d("GameFragment", "Word: ${viewModel.currentScrambledWord} " +
"Score: ${viewModel.score} WordCount: ${viewModel.currentWordCount}")
return binding.root
......
......@@ -14,9 +14,15 @@
~ limitations under the License.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:tools="http://schemas.android.com/tools">
<data>
</data>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
......@@ -118,3 +124,4 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</layout>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment