Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapter View #11

Closed
abaxxx opened this issue Dec 10, 2015 · 12 comments
Closed

Adapter View #11

abaxxx opened this issue Dec 10, 2015 · 12 comments

Comments

@abaxxx
Copy link

abaxxx commented Dec 10, 2015

Dude, I love your work man. I was using the AutoCompleteTextView, created custom adapter ext,. and working all these days.

I started using yours and love it, the only problem is my earlier AutoCompleteTextView was showing many suggestions (like 8-10) as soon as i begin typing a place name. But yours shows only 2 ... Kindly help.

@sddamico
Copy link
Member

@abaxxx It's going to be hard to have answers for you without a little bit of debugging help, by default the view will only show historical results until you cross the 3 character threshold. Also remember that the popup window with the results is a scroll view and there could be content below the fold.

Otherwise, please try to proxy the network traffic to the google maps API (traffic through maps.googleapis.com) to see what results are coming from the network...

@abaxxx
Copy link
Author

abaxxx commented Dec 14, 2015 via email

@tuanth89
Copy link

Hi @abaxxx , Can show your custom adapter code for me ? I want create custom adapter but don't know how.
Thanks

@abaxxx
Copy link
Author

abaxxx commented Dec 15, 2015

@tuanth89 brother, Im not using a custom adapter, Im using default one.

@tuanth89
Copy link

@abaxxx okay thanks.
@sddamico , Can you create a custom adapter demo for the library. I found custom adapter in your demo app but not used.
Thanks.

@sddamico
Copy link
Member

@tuanth89 the demo app does use the custom adapter, one of "features" of the PATV is that you're able to set the adapter from xml: https://github.com/seatgeek/android-PlacesAutocompleteTextView/blob/master/demo-app/src/main/res/layout/activity_places_autocomplete.xml#L19

@tuanth89
Copy link

@sddamico , Thanks
But when I run app, it crash because unable to find valid constructor with params Context, PlacesApi...

Here is my xml

com.seatgeek.placesautocomplete.PlacesAutocompleteTextView
                            android:id="@+id/places_autocomplete"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:background="@null"
                            android:hint="Address"
                            android:paddingBottom="5dp"
                            android:paddingTop="5dp"
                            android:singleLine="true"
                            android:textColor="@color/text_gray_4"
                            android:textColorHint="@color/text_gray_3"
                            android:textSize="15sp"
                            app:pacv_googleMapsApiKey="@string/API_server_key"
                        app:pacv_adapterClass="adapter.TestPlacesAutocompleteAdapter"

Here is log.

Caused by: android.view.InflateException: Unable to find valid constructor with params Context, PlacesApi, AutocompleteResultType, and DefaultAutocompleteHistoryManager for specified adapterClass: com.teusoft.sirved.adapter.TestPlacesAutocompleteAdapter
                                           at com.seatgeek.placesautocomplete.PlacesAutocompleteTextView.adapterForClass(PlacesAutocompleteTextView.java:225)
                                           at com.seatgeek.placesautocomplete.PlacesAutocompleteTextView.init(PlacesAutocompleteTextView.java:127)
                                           at com.seatgeek.placesautocomplete.PlacesAutocompleteTextView.(PlacesAutocompleteTextView.java:78)
                                           at java.lang.reflect.Constructor.newInstance(Native Method) 
                                           at java.lang.reflect.Constructor.newInstance(Constructor.java:288) 
                                           at android.view.LayoutInflater.createView(LayoutInflater.java:607) 
                                           at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) 
                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
                                           at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378) 
                                           at android.app.Activity.setContentView(Activity.java:2145) 
                                           at com.teusoft.sirved.ProfileActivity.onCreate(ProfileActivity.java:151) 
                                           at android.app.Activity.performCreate(Activity.java:5990) 
                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 
                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
                                           at android.app.ActivityThread.access$800(ActivityThread.java:151) 
                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                           at android.os.Looper.loop(Looper.java:135) 
                                           at android.app.ActivityThread.main(ActivityThread.java:5254) 
                                           at java.lang.reflect.Method.invoke(Native Method) 
                                           at java.lang.reflect.Method.invoke(Method.java:372) 
                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
                                        Caused by: java.lang.NoSuchMethodException:  [class android.content.Context, class com.seatgeek.placesautocomplete.PlacesApi, class com.seatgeek.placesautocomplete.model.AutocompleteResultType, class com.seatgeek.placesautocomplete.history.DefaultAutocompleteHistoryManager]
                                           at java.lang.Class.getConstructor(Class.java:531)
                                           at java.lang.Class.getConstructor(Class.java:495)
                                           at com.seatgeek.placesautocomplete.PlacesAutocompleteTextView.adapterForClass(PlacesAutocompleteTextView.java:216)
                                           at com.seatgeek.placesautocomplete.PlacesAutocompleteTextView.init(PlacesAutocompleteTextView.java:127) 
                                           at com.seatgeek.placesautocomplete.PlacesAutocompleteTextView.(PlacesAutocompleteTextView.java:78) 
                                           at java.lang.reflect.Constructor.newInstance(Native Method) 
                                           at java.lang.reflect.Constructor.newInstance(Constructor.java:288) 
                                           at android.view.LayoutInflater.createView(LayoutInflater.java:607) 
                                           at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) 
                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
                                           at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378) 
                                           at android.app.Activity.setContentView(Activity.java:2145) 
                                           at com.teusoft.sirved.ProfileActivity.onCreate(ProfileActivity.java:151) 
                                           at android.app.Activity.performCreate(Activity.java:5990) 
                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 
                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
                                           at android.app.ActivityThread.access$800(ActivityThread.java:151) 
                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                           at android.os.Looper.loop(Looper.java:135) 
                                           at android.app.ActivityThread.main(ActivityThread.java:5254) 
                                           at java.lang.reflect.Method.invoke(Native Method) 
                                           at java.lang.reflect.Method.invoke(Method.java:372) 
                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 

@sddamico
Copy link
Member

@tuanth89 can you please create a separate issue for this? The problem you are experiencing is not related to this thread.

@tuanth89
Copy link

@sddamico Thank, i created a issue

@abaxxx
Copy link
Author

abaxxx commented Dec 17, 2015

Brother, the app is not crashing, but im getting this exception. If i setHistoryfile(null).

E/MapsPlacesAutoComplete: Unable to load history from history file
E/MapsPlacesAutoComplete: java.io.FileNotFoundException: History file does not exist
E/MapsPlacesAutoComplete: at com.seatgeek.placesautocomplete.history.DefaultAutocompleteHistoryManager$1.executeInBackground(DefaultAutocompleteHistoryManager.java:68)
E/MapsPlacesAutoComplete: at com.seatgeek.placesautocomplete.history.DefaultAutocompleteHistoryManager$1.executeInBackground(DefaultAutocompleteHistoryManager.java:64)
E/MapsPlacesAutoComplete: at com.seatgeek.placesautocomplete.async.BackgroundExecutorService$2.run(BackgroundExecutorService.java:43)
E/MapsPlacesAutoComplete: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/MapsPlacesAutoComplete: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/MapsPlacesAutoComplete: at java.lang.Thread.run(Thread.java:818)

Is this correct behaviour, just asking..
Thanks

@sddamico
Copy link
Member

Hmm, that doesn't seem right. Though, it does mean that it is respecting you request to turn history off...

I've created #14

@sddamico
Copy link
Member

@abaxxx I can't reproduce this, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants