I want a feedback when click on links like google+:
Im using Linkify right now.
How can I do this?
Thanks
For this you need the spannable textview in order to handle the click event on specific part of textview. How you can handle the span is defined in this and this
answer.
I develop a solution to this problem.
GitHub Link
Related
I am new to android and I am trying to contribute for an android project. There is listview of messages and when a user clicks and a specific message, another view opens and shows the details as shown in below image(android view).
All these information is being fetched from web and parsed. and link is not clickable on web view also as shown in below figure (webview),
It is not shown as hyperlink on webview. I think that is the reason its not showing as a link in android app too.
Can anybody help me with this? The code related to this can be found at : source
related files are:
\scraper\MessagesScraper.java ,
\scraper\SingleMessageScraper.java ,
\ui\messages.java
\ui\SingleMessage.java
Any help would be great. thanks in advance.
In your XMl wherever you define that particular TextView add the following to that TextView
android:linksClickable="true"
Also see How do I make links in a TextView clickable? if you want to for example hide the URL and just show some text for the link.
Edit: From what I can tell...
MessageScraper is using ThreeLineAdapter - https://github.com/pradeepb6/TuCanMobile/blob/master/src/com/dalthed/tucan/adapters/ThreeLinesAdapter.java You can see all the TextViews here and then go to the res folder and change them accordingly.
SingleMessageScraper seems to be just using standard ArrayAdapter and Androids Simple_list_Item_1 for the layout. http://developer.android.com/reference/android/R.layout.html#simple_list_item_1 So if you need to you'll need to make your own list_item layout for this if it doesn't make sense to use one that was already created.
I don't think the UI classes need any changing.
Re: Comment - A single message (shown in your picture) is a listview of TextViews. You could also have a listview of custom views if you want more things in each cell, which is what the ThreeLineAdapter is handling.
If you are using TextView in your ListView's getView function,
you can use Linkify to convert the link to URL
TextView textView = (TextView) findViewById(R.id.textView);
textView.setText("http://www.example.com");
Linkify.addLinks(textView, Linkify.WEB_URLS);
WebView.getSettings().setJavaScriptEnabled(true);
I should html content load on textview its ok and display well but how to handle multiple underline word getting onclick dynamically.
How can i getting click like as Phnom Penh, Siem Reap & so on etc..????
Thanks in advance
See snapshot
Just put below line in your code:
textview.setMovementMethod(LinkMovementMethod.getInstance());
It will open link which is attached to that word in html.
I'm so happy bcos I should find out answer for this quesiton, which i need to it dynamically solutions.
Just, go on this link for blog and step by step which is our need to dynamically solution there.
SuN Blog
http://suniljp.blogspot.in/search/label/TextView_%20%20underline%20text%20click
:)
i am learning android dev...i am facing an issue.i have searched a lot but couldn't find the answer so posting here.
http://cnic.sims.pk/
Above website is a utility.i want to give the input to it from editText field of my app and when i press the submit button it should query the website and then i will display the result in a WebView. Right now i am displaying whole thing in a WebView that is input and result.
Can any one help me how to implement this...i just want a hint....Thanks in advance.
#Rashid Hussain i believe you need to show url when you click submit button am i right? if so add a textfield and button to layout and add onClick to submit button
I would like to make my application ask the user some informations via something similar to VB.NET's inputbox. How can I do this??? I don't want to have a permanent control on the screen, I just want to make it appear when I need it. Actually, just as an inputbox.
dude see this link u will get use of EditText http://mobile.tutsplus.com/tutorials/android/android-user-interface-design-edittext-controls/
Use an edittext box, very similar to a textview. examples can be easily found
I am working in android. i am trying to display name of university using listView.
my list view is looking like this.
Now i want to add a search bar on the top of this list view. if i press A in search bar then this list view should display all the name of university start with A, if i press some other character then according university name must be displayed.
Please tell me how can implement this. Is any way to make search bar in android. I have seen in iPhone, it works very efficiently in iPhone. Please help me how can make this search bar ?
Thank you in advance...
This may be the long way. but this is just an idea..
I think you have to create a layout xml file with one EditText and ListView. Inside activity you have to listen for textChange in EditText and then probably you have to filter your ListAdapterbased on the text entered by the user and bind it with ListView.
See the complete example here : http://www.androidpeople.com/android-listview-searchbox-sort-items
You can use setTextFilterEnabled(true) on your list view.
I think this may help you to get an idea. http://developer.android.com/resources/tutorials/views/hello-autocomplete.html