I know how to open URL links inside the app (I use FinestWebView).
Also, I know how to make URLs in a TextView clickable (android:autoLink="web").
But I want to "combine" these two things, i.e. I want a URL link in a TextView to open inside the app when I click on it.
I didn't find anything on this, so: How can this be achieved?
Do you want the link to be open from the webview!?
Just make it clear . Or provide some of your code stuffs..so that it can be easy to help yu
Related
How do I make it so when a user clicks on my website button, it doesn't add on the the URL bar, for example, when they click on a button it will open a modal box, example.com/index.html#modalopened but I don't want that to show, I want it to only say example.com/index.html instead of the # stuff....
I tried onClick="return false;" but it made it so the button didn't work at all... :(
Any other suggestions?
Also, maybe its just easyer to disable it totally, so that when people visit the site it just says example.com instead of example.com/index.html :)
You can use angular.js to dynamically update page content without changing the URL. https://angularjs.org/
Also by using a .htaccess (depending on what webserver you're using) you can get rid of the /index.html, too and have something like http://example.com/
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 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
This is seems like a pretty simple question, but I'm not sure if there's a solution to it. Is it possible to set a custom action for a text link (those blue texts that are underlined) inside a TextView? In other words, is it possible to have a handler do something on an event like onClick on the link?
You need to set the link in the text, and use the autoLink attribute for it. It will use the marked text as link. Otherwise, the only option is to use an OnClickListener as suggested by nicholas.
You can look at the autoLink attribute doc here: http://developer.android.com/reference/android/widget/TextView.html#attr_android:autoLink
If your text is: "You will find it at http://www.example.com", and you set android:autoLink="web", then the link will be highlighted and a browser will start after clicking it.
If you are working with an EditText or a TextView, they both have an setOnClickListener() method which you could override.
If you are working with a WebView, and the content created is yours, you can use JavaScript to handle click's of links.
If you are working with a WebView and the content you are viewing is not yours, I am not sure if there is a way to intercept those, but you should still be able to call setOnClickListener() on a WebView, as setOnClickListener() is defined in the View class. I am just not sure how you would tell whether or not a link was clicked in that WebView...
I encountered this situation too, where I have autolink set up in TextViews to automatically handle URLs in TextViews. However, the default behavior is to open the web page in an external browser, so how do we make it open in an in-app browser (for example)?
Underneath the hood, this is handled for TextView by LinkMovementMethod. Hence, the suggestion (by one of the answers) to customize onClickListener() of the TextView is not ideal, as it would involve reimplementing much of what LinkMovementMethod handles, so that it could precisely handle clicks/taps on what are identified as URLs.
More recently (years after this post was made), someone has come up with an enhancement over LinkMovementMethod, known as (what else?) BetterLinkMovementMethod, described in more detail this blog post. I can confirm that it did work for me. With just a few lines of code changes, the TextView autolinks now open in the in-app browser (and clearly, all kinds of other behaviors can be customized as desired). I have no affiliation with BetterLinkMovementMethod or its creators, but am just a grateful user.
Hello
In my android application i am using a webview to display apage of contents .
What i require is like if the user longpress on a word then that particular word should be highlighted and should be highlighted even if the user reloads the app again.
Is there any way that i can get this done in android.
Please forward your valuable suggestions.
Thanks in advance:)
Putting it in a WebView is what will make this tricky, if it were just a regular view I would say extend TextView and implement onLongClickListener for it as well. Not sure how to squeeze this into an existing webview though :/