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.

4

0 回答 0