Algolia Android initial search is really slow - android

I recently implemented Algolia on my app successfully just like the examples.
But the initial search takes about 5 to 7 seconds and I couldn't find a way to make it faster after checking the whole library code and documentation. After the initial search, search becomes very fast.
There is nothing unusual in my implementation but maybe you can see something that I don't. The following code is from the activity where I initialize Algolia:
Searcher searcher = new Searcher(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY, ALGOLIA_INDEX_NAME);
searcher.setQuery(new Query("word").setExactOnSingleWordQuery(Query.ExactOnSingleWordQuery.ATTRIBUTE));
searcher.addNumericRefinement(new NumericRefinement("CountryId", NumericRefinement.OPERATOR_EQ, 1));
InstantSearch helper = new InstantSearch(this, searcher);
helper.setSearchOnEmptyString(false);
helper.search();
And this is the related xml layout:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp"
android:paddingRight="10dp"
android:paddingLeft="1dp"
android:paddingTop="6dp">
<com.algolia.instantsearch.ui.views.SearchBox
android:id="#+id/searchBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:queryHint="#string/search_text_hint"
algolia:searchIcon="#drawable/icn_search_big"
algolia:closeIcon="#drawable/icn_clear_filled_big"
android:queryBackground="#drawable/sarch_query_shape"
android:background="#drawable/search_shape"
algolia:autofocus="true"
algolia:submitButtonEnabled="false" />
</FrameLayout>`
<com.algolia.instantsearch.ui.views.Hits
android:id="#+id/hits"
android:layout_width="match_parent"
android:layout_height="match_parent"
algolia:autoHideKeyboard="true"
algolia:hitsPerPage="6"
android:layout_below="#+id/searchBarParentLayout"
algolia:infiniteScroll="false"
algolia:itemLayout="#layout/search_item_algolia_row"/>
Do you have any idea what can be the issue here?

I'm glad that the issue disappeared when you switched to another wifi.
For future readers that may encounter network issues with InstantSearch Android:
First of all, build and run one of our demo applications
If you see no problem running the example application, you can try using a proxy like Charles to investigate what's happening between your app and the network
If your problem persists when running the examples, or if you are following the documentation, send an email to support#algolia.com describing the issue with a sample of your code!

Related

Android studious autoLink = map not working with Latvian addresses

So I'm making business card for one local bar and I have run into problem with autoLink.
For some reason, map autoLink does not work with Latvian addresses. I tested same approach with US address (copied the formatting google gave me) and it worked just fine. When I do the same with Latvia addresses autoLink won't respond to it.
Here is my xml code:
<TextView
android:id="#+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/address"
android:autoLink="map"
android:textSize="16sp"
android:layout_below="#id/about"
android:layout_toRightOf="#id/loc"
android:layout_marginTop="6dp"
/>
And strings code:
<string name="address">Kalēju iela 51, Centra rajons, Rīga, LV-1050, Latvija </string>
I tried writing address in US like format "51 Kaleju Street Riga, LV-1050", but it didn't work. I also tried bunch of other variations that came in my mind, but all unsuccessful.
Maybe someone has experience with this or just knows how to fix this? Maybe some java code is needed?
Thanks in advance,
Sandra.
I'm stuck with the same problem.
But what I found:
"They haven't optimized the android:autoLink maps to India still. Works with US addresses only."
I guess the same goes for Latvia as for India - still doesn't work.
I think we have to use Intents ;(

Android studio throws "Too much output to process error" on debug

Android studio throws "Too much output to process error" on debug.
I just started working on android development and trying to debug using my nexus 5 as a connected device.
Being a novice, I thought it was a memory issue and even closed all the background applications. In my single activity I am just displaying a background image and a button.
Please have a look at the layout xml...
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/backgroundimage"
android:weightSum="5"
android:orientation="vertical">
<LinearLayout
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:background="#C9BDBD"
android:padding="5dp">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="20dp"
android:background="#6C7B8B"
android:textColor="#000000"
android:text="Become An Android Developer"
android:onClick="Congratulations!!! You are now initiated.."/>
</LinearLayout>
your Button's android:onClick should be a method in the Java code.
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="20dp"
android:background="#6C7B8B"
android:textColor="#000000"
android:text="Become An Android Developer"
android:onClick="Congratulations!!! You are now initiated.."/>
something like
android:onClick="doSomthing"/>
and in the Java code:
public void doSomthing(View v){
...
...
...
}
As far as "too much output..." issue is concerned, you can mostly ignore it. Still it would make sense if you remove some of the really unnecessary Log lines from your code, especially from methods that are called repeatedly and frequently.
Another thing, i believe you want to show a text "Congratulations!!! You are now initiated.." when user clicks on button.
So change your xml's android:onClick to android:onClick= "myButtonClicked"
In the activity, implement this function
public void myButtonClicked(){
}
Finally, show the text "Congratulations!!! You are now initiated.." either via dialog (e.g. alertDialog) or in some textView
You may have selected "No Filters" in android monitor which causes "Too much output to process error", Change it to "Show only selected Application" then all other Log line are filtered and will not show in Logcat.

Phone number formatting in EditText

I have been trying to get
XML File
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/phoneEditText"
android:layout_marginTop="10dp"
android:padding="16dp"
android:inputType="phone"/>
Java
etContact = (EditText)findViewById( R.id.phoneEditText );
etContact.addTextChangedListener(new PhoneNumberFormattingTextWatcher() );
To successfully format the number entered by the user but it fails to perform the formatting on my Nexus 5 test device, while on lower API levels it does work. I am not sure if this has been changed of phased out since KitKat but it refuses to work now. Is there a work around or additional calls to enable this to work on KitKat?

Issue with ParallaxScroll ( from nirhart ) in Android

I've been looking for an easy to implement Parallax animation, although I've seen chrisjenx alternative, nirhart's is more the thing im looking for.
My problem is that I download the repository , then use Import on eclipse and it doesn't work. This is the list of errors:
I re-downloaded the ADT from the official webpage and updated it. I'm compiling with SDK API 16 ( Android JB )
I'm kinda new to android, but I guess its throwing error for things like these
<com.nirhart.parallaxscroll.views.ParallaxScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res/com.nirhart.parallaxscrollexample"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:parallax_factor="1.9" <-------------------------
tools:context=".MainActivity" >
I would live some help, thank you!

Android XML Error - First App - NetBeans

I've just started this evening into developing my first Android app and have come across an error that for the life of me I can't see where is coming from
When i launch my test app in the emulator it force closes with the error "The application Test App (psrocess Test.App) has stopped unexpectedly. Please try again."
So far I've checked: The Android Development output - nothing untoward,launches fine and locates activity and intent
The Emulator output - nothing reported at all
The TestApp debug - reports BUILD SUCCESSFUL
I proceeded to then examine the main.xml used for the layout and on validation in NetBeans it reports "cvc-elt.1: Cannot find the declaration of element 'LinearLayout'"
My main.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="vertical" >
<Button
android:id="#+id/used_cars"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/used_cars" />
<Button
android:id="#+id/used_vans"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/used_vans" />
<Button
android:id="#+id/dealers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/dealers" />
</LinearLayout>
I've trawled for info on how to fix this and can't find an answer
Could someone be kind enough to please advise if i'm missing something fundamental?
Thanks in advance
Barry
I've went through the logcat info and found nothing so i decided to create a new app from scratch and copy over the info and it runs fine
If i do find any other info on what caused the issue i'll be sure to post it up
I can only put it down to a config error atm
Kind Regards
Barry

Categories

Resources