Thanks Kostya...

2011/10/7 Kostya Vasilyev <kmans...@gmail.com>

> The compiler is right - your curly braces are not matching up.
>
> The code you highlighted should be inside onCreate, not like it is now.
>
> --
> Kostya Vasilyev
> 07.10.2011 9:04 пользователь "KK" <dioxide.softw...@gmail.com> написал:
>
> > Hi All,
> > I'm trying a sample code available on the web, in which I'm trying to
> test
> > AutoCompleteView. When trying to call setAdapter() method in following
> > lines:
> >
> > * autoCompTxt.setAdapter(arrayAdapter);*
> > * autoCompTxt.setThreshold(3);*
>
> >
> > I'm getting the following errors;
> >
> > *Multiple markers at this line*
> > * - Syntax error on token "arrayAdapter", VariableDeclaratorId expected
> > after *
> > * this token*
> > * - Syntax error on token(s), misplaced construct(s)*
>
> >
> > The code for the main Activity is as below:
> >
> > *package com.demo.autocomp;*
> > *
> > *
> > *import android.app.Activity;*
> > *import android.os.Bundle;*
> > *import android.widget.ArrayAdapter;*
> > *import android.widget.AutoCompleteTextView;*
> > *
> > *
> > *public class AutoCompleteDemoActivity extends Activity {*
> > * private final static String[] presidents = { "Dwight D. Eisenhower",
> "John
> > F. Kennedy",*
> > * "Lyndon B. Johnson", "Richard Nixon", "Gerald Ford",*
> > * "Jimmy Carter", "Ronald Reagan", "George H. W. Bush",*
> > * "Bill Clinton", "George W. Bush", "Barack Obama" };*
> > *
> > *
> > * /** Called when the activity is first created. */*
> > * @Override*
> > * public void onCreate(Bundle savedInstanceState) {*
> > * super.onCreate(savedInstanceState);*
> > * setContentView(R.layout.main);*
> > * }*
> > *
> > *
> > * AutoCompleteTextView autoCompTxt = (AutoCompleteTextView)
> > findViewById(R.id.autoCompleteTextView1);*
> > * ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(*
> > * getApplicationContext(),*
> > * android.R.layout.simple_dropdown_item_1line, presidents);*
> > * autoCompTxt.setAdapter(arrayAdapter);*
> > * autoCompTxt.setThreshold(3);*
> > *}*
>
> >
> >
> > The corresponding res/layoute/main.xml is as below(there is no errors in
> > main.xml, just posting for reference purposes):
> >
> > *<?xml version="1.0" encoding="utf-8"?>*
> > *<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android
> "*
> > * android:orientation="vertical" android:layout_width="fill_parent"*
> > * android:layout_height="fill_parent">*
> > * <TextView android:layout_width="fill_parent"*
> > * android:layout_height="wrap_content" android:text="@string/president"
> />*
> > * <AutoCompleteTextView android:layout_width="match_parent"*
> > * android:id="@+id/autoCompleteTextView1"
> > android:layout_height="wrap_content"*
> > * android:text="AutoCompleteTextView">*
> > * <requestFocus></requestFocus>*
> > * </AutoCompleteTextView>*
> > *</LinearLayout>*
>
> >
> > Would appreciate if someone can point me what is wrong here or how to fix
> > the error and make the code work.
> >
> > Thanks,
> > KK
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to