<https://lh3.googleusercontent.com/-KPe3L7VTs0I/V71h0t1fkpI/AAAAAAAAAG8/SHemmkoHjPQSfPxb00PKXbu7KtVT0IhNQCLcB/s1600/Screenshot%2B%2528207%2529.png>
Let me summarize my error.If i Use AutoCompleteTextView on 
MainActivity.java it works perfectly 
Now the problem i am having is i am using Android Navigation Drawer 
Here's my Code for Home_Fragment.xml 

package com.example.nghandler;


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


public class Fragment_Home extends Fragment {
  AutoCompleteTextView autoCompleteTextView;
    String[] countries = {
            "Uyo",
            "hehe",
            "lol"
    };


    public Fragment_Home() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_home, container, false);
        autoCompleteTextView = 
(AutoCompleteTextView)getView().findViewById(R.id.autoCompleteTextView);
        ArrayAdapter arrayAdapter = new ArrayAdapter<>(getActivity(), 
android.R.layout.select_dialog_item, countries);
        autoCompleteTextView.setThreshold(1);
        autoCompleteTextView.setAdapter(arrayAdapter);

        return view;
    }

}


Fragment_home.XML 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android";
    xmlns:tools="http://schemas.android.com/tools";
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="50sp"
    android:id="@+id/nav_home"
    android:orientation="horizontal"
    tools:context="com.example.nghandler.Fragment_Home">

    <!-- TODO: Update blank fragment layout -->


    <AutoCompleteTextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/autoCompleteTextView"
        android:layout_marginTop="180dp"
        android:textAlignment="center"
        android:textSize="24sp"
        android:background="@color/colorAccent"
        android:textStyle="normal|bold"
        android:hint="Type just 3 letters"
        android:layout_alignParentTop="true"
        android:layout_alignParentStart="true" />
</RelativeLayout>


On running the App, it crashes, Help me please cos i am stucked

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/8b3f1bce-3349-46c0-b460-be7dbe5807f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to