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 ;(
Related
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!
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?
I am learning Android and the following is part of an assignment.
I need to write some text in an Android layout with the first letter in drop caps, like the following text:
I looked up the web and did not find many answers. Is there a style option or some property that I could use?
At the moment, I am thinking of the following options. Please suggest what is the best way to do such a thing
Use an image for the first letter
Write the first letter separately in a big font.
Any suggestions would be helpful.
You can use a RelativeSizeSpan.
final String someText = "A long time ago in a galaxy far, far away";
final SpannableString ss = new SpannableString(someText);
ss.setSpan(new RelativeSizeSpan(5f), 0, 1, 0);
There's a library written by Novoda in which you can add a DropCap https://github.com/novoda/spikes/tree/master/drop-cap
Here's an image from the demo app:
Please follow GitHub sample app
https://github.com/datanapps/CapTextView
<datanapps.captextview.CapTextView
android:id="#+id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:padding="5dp"
app:layout_constraintTop_toBottomOf="#+id/text1"
app:capsDropNumber="2"
app:capFont="#font/eb_garamond_regular"
app:capTextColor="#color/purple_700"
app:capTextSize="#dimen/cap_text_size"
app:bodyTextColor="#color/purple_700"
app:bodyTextSize="#dimen/body_text_size"
app:bodyTextFont="#font/eb_garamond_regular"
/>
Hope it will help
I have one rails application where I have one model posts. Post model having two attributes - "title" & "content". I am using ckeditor for my content. Here is my ckditor snapshot
When I save something eg- "hi how r u" with bold, itallic, underline etc. Then it save posts content like this <b><i><u>hi how r u</u><i></b>. I know the solution in rails. I am using <%= raw(#posts.content) %> to solve this problem. But Now my problem is different. I want to fetch all the posts content from the database by using json. I am doing like this..
def index
#posts = Post.all
respond_with(#posts) do |format|
format.json { render json: #post_names = {:post => #posts.as_json(:only=> :content)} }
end
end
Now when i go through http://localhost:3000/posts.json then it showing like this
{"post":[{"content":"hi"},{"content":"hi"},{"content":"<img src=\"https://www.ginfy.com/img/logo.png\">"},{"content":"hi"},{"content":"my health is not good. Please pray for me..<br>"},{"content":"my health is not good. Please pray for me<br>"},{"content":"hello"},{"content":"<img src=\"http://www.ibettertechnologies.com/img/logo.png\">"},{"content":"<u><i><b>hi how r u?</b></i></u><br>"},{"content":"sdfsd"},{"content":"i am going to home. Please pray for my safe jouney"},{"content":"job"},{"content":"dsfdfs"},{"content":"fddf"},{"content":"jd dsbdsj djhj dsjhdfjks"},{"content":"ddd gd fgdfdg"},{"content":"dfslkdfskldfskl dskljdfskldf dskljdfskldfjslk"},{"content":"please pray for me"},{"content":"dfdf"},{"content":"cvxvxdfs"},{"content":"hdbhjds dsjks"},{"content":"s"},{"content":"hi"},{"content":"hu"}]}
I want to fetch this json in android. How can I use <%= raw() %> function in json to get correct formatted value.
You have to use Html.fromHtml() function to escape HTML tags. You can do like this ..
<TextView
android:id="#+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_margin="5dp"
android:textColor="#android:color/black"
android:textSize="20sp"
android:textStyle="bold" />
text2.setText(Html.fromHtml(app.getTitle()).toString());
Let's go to the point..
I make an Android application which target is Google APIs (Platform 2.2).
I want to parse the XML File which comes from the REST API.
The XML file likes this:
<title>EARTH WIND & FIRE Live in Concert</title>
I store that output in my String variable, which I can use later and since the output is in XML, I use XML Parser class of course.
And as you can see, since the rule of XML format doesn't allow the naked character, in this case my '&' character, it will show:
<title>EARTH WIND & FIRE Live in Concert</title>
So I change that character with this method: xml.replaceAll("&", "<![CDATA[&]]>");
xml is String and I replace my & with <![CDATA[&]]> tag.
And I follow this: Android how to parse CDATA TAG?
It says that I must use dbf.setCoalescing(true);
Everything goes fine and in my TextView shows the words EARTH WIND & FIRE Live in Concert. The ampersand character (&) is shown in my emulator (Platform 2.2).
But, when I try it in the device (Platform 2.1), it will show only EARTH WIND.
And I make the new emulator Google APIs (Platform 2.1), it shows EARTH WIND too.
Does anyone here face the same problem with me??
Is there any compatibility issue with the XML Parser or the <![CDATA[]]> tag in Android??
Thanks in advance...
In String.xml in resouces folder
<string name="my_string"><![CDATA[Please put Your long text here ]]></string>
if you want to access this string for textview:
<TextView
android:id="#+id/my_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="#string/my_string"
android:textColor="#android:color/white"
android:textSize="14sp"
android:textStyle="bold" />