1

I'm making an app based on this Youtube video and I'm having problems with the whole thing despite copying everything 1:1, haven't missed a thing. So, my problem is, that at the 15:30 point, the poster compiles the app and after clicking into the search area, he gets redirected to another page. I have everything coded, so that page should work for me too, but instead, the app crashes, and I think I've found the reason, but not the solution:

The java code is:

package com.example.name.translator.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.name.translator.R;

public class FragmentDefinition extends Fragment {
    public FragmentDefinition() {

    }

    @Override
    public View OnCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_definition,container,false);

        return view;
    }
}

and the xml code behind it:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <TextView
            android:id="@+id/textViewD"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Some Text"
            android:textAlignment="center"
            android:layout_margin="15dp"
            android:lineSpacingExtra="5dp"
            android:textIsSelectable="true"
            />

    </LinearLayout>

</android.support.v4.widget.NestedScrollView>

To run this code, I have to eliminate @Override, otherwise it won't start at all, throwing exception "Method does not override method from its superclass" (which I think I understand, guess because I can't Override something that is not even being used).

I need your help in finding out what's causing the trouble. Any advice / help is welcome.

Thank you all for your time.

adr
  • 15
  • 6
  • can you share the crash log as well – Usman Zafer Mar 30 '20 at 09:51
  • 2
    You have a typo. `OnCreateView` needs to start with a lowercase-`o`. – Mike M. Mar 30 '20 at 09:53
  • Indeed: https://youtu.be/grHxqKhUgZU?t=714 (also, JavaScript is an entirely separate language; please don't tag Java questions with the JavaScript tag) –  Mar 30 '20 at 09:56
  • @MikeM. Thank you, you're right, app's still crashing so I will have to keep looking, but that was the problem in the part I asked! How can I mark your answer as the solution? – adr Mar 30 '20 at 09:58
  • @ChrisG Sorry, and thank you for modding it! – adr Mar 30 '20 at 09:59
  • 1
    This will probably get closed as a typo, which is no big deal. Thank you, though, for the offer. If you want to [edit] your question to add the complete [stack trace from the crash](https://stackoverflow.com/a/23353174), I can take a look at it real quick. – Mike M. Mar 30 '20 at 10:07
  • 1
    @MikeM. Got it sorted out, forgot to include the activity into manifest. Thank you again for pointing out the typo, it really helped me a lot! – adr Mar 30 '20 at 13:09

0 Answers0