I am using a AutoCompleteTextView in a Fragment...
but when I use a method which refreshes the Suggestions for AutoCompleteTextView, the App crashes with Null Object Reference
here's the method -
private ArrayList<String> sugs = new ArrayList<String>();
public void refreshSugs()
{
((AutoCompleteTextView) getView().findViewById(R.id.editText1)).setAdapter(new ArrayAdapter(getActivity(), 17367050, this.sugs));
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState)
{
//Inflating the Layout
View rootView = inflater.inflate(R.layout.home_fragment, container, false);
Button buttongo = (Button) rootView.findViewById(R.id.button1);
EditText et1 = (EditText) rootView.findViewById(R.id.editText1);
Button buttonsave = (Button) rootView.findViewById(R.id.button2);
bar = (ProgressWheel) rootView.findViewById(R.id.progressBar1);
i = (ImageView) rootView.findViewById(R.id.imageView1);
background2 = (TextView) rootView.findViewById(R.id.textView1);
background3 = (TextView) rootView.findViewById(R.id.textView2);
readSugs();
refreshSugs();
return rootView;
}