google-developer-training / first-android-app

Repository for Build Your First Android App codelabs (Java and Kotlin)
7 stars 6 forks source link

First Android App codelab: #189

Open bengt-a opened 2 years ago

bengt-a commented 2 years ago

Sorry, but this must have been written for some earlier version of Android Studio? It simply isn't working. Step 8, when it starts to get interesting, contains so many things which Android Studio doesn't recognize. And for instance, the onCreateView and onViewCreated thingies don't even look remotely the same as in the tutorial.

For instance, in task 8 step 2 item 3, in the example it says: view.findViewById(R.id.toast_button).setOnClickListener(new View.OnClickListener() {

but in Android studio it looks like Objects.requireNonNull(binding.toastButton).setOnClickListener(new View.OnClickListener() {

So, totally different. However, that works. But when it comes to adding the line View fragmentFirstLayout = inflater.inflate(R.layout.fragment_first, container, false); in step 4 item 2, everything goes haywire and A.S. doesn't want to recognize the line at all. There is a "red bulb" suggesting I delete the whole line.

I like to learn by example, but here I am totally stuck since I am fairly new to Java and definitely to programming apps...