highlight the word on longpress android - android

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 :/

Related

xml for dropdown text

I have used this forum when I didn't know how to do something, but now I have decided to begin participating in it.
I would like to know how could I do a dropdown text (maybe it has a specific name and that's why I don't find any results on the internet). I mean, I have some tags in the screen (About, Company, Contact, ...). Each of these tags has a down arrow on the right side, and when I click it, it has to display (and hide if it's clicked again).
Here are the links with the images of what I want to do.
http://i45.tinypic.com/4fzoso.png
http://i47.tinypic.com/2u5886q.png
Thank you in advance!
You should use an ExpandableListView component.
There is a tutorial for it here.
Finally I did it with ImageViews and TextViews using the property android:visibility. Now that it's a static version is working properly. I hope that it continues working well when taking the information from the DB

how to hide soft-keyboard behind the View like Gmail app?

I had implemented auto-suggestion functionality using MultiAutoCompleteTextView successfully and everything is working fine except i'm not able to display auto-suggestion list above the soft-keyboard.
Android Gmail app has the same functionality. [see below image]
Question:
I want the exact functionality, want to a display a suggestion list on
the soft-keyboard but i don't have any clue how to achieve this. My
suggestion list is always hidden behind the soft-keyboard.
How to show auto-suggestion list above the soft-keyboard like Gmail
app?
I had tried playing with different android:imeOptions and different xml attributes and did a lot of searching but nothing helped.
Is there any public Api or XML attribute is available to do so?
Does anyone have any clue or idea about how to achieve this.
Code Structure : My fragment opens an AlertDialog which contains MultiAutoCompleteTextView where i'm implementing auto-suggest.
Any help or suggestion which leads to the right direction, would be greatly appreciated.

Android - call TextWatcher for highlighted text

So I'm new to Android development and I'm currently figuring out TextWatcher.
What I'm attempting to do is attach my TextWatcher listener to an EditText widget and after the user has put in some text, say "Hello" and he highlights "llo" and types in r, I display the change in a TextView widget. For the above example it will display "llo --> r".
Now from what I've read and tried, since the textchangelistener is called every time the user types in something, my code ended up crashing when I ran it on my phone.
Is there a way to call the listener only when the highlighted text is changed so as to avoid calling it every time I'm just typing something in the EditText widget? I hope my question makes sense, I've tried looking around before posting here but I couldn't find anything.
Not looking for code, just some pointers so I can figure out how to do this.
Thanks!
Your best bet would be to use a OnEditorActionListener instead of a textwatcher which I didnt know existed until now. It gets called when there is a change to a textview, and since edit text is a textview than it will work perfectly.
Heres some info on the listener
Btw welcome to the android platform, I think you'll find that it is a rich language and definitely worth learning. If you really want some pointers your main point of reference should be this link which has many guidelines and pointers in the develop tab. Good luck

Textview scrollable and clickable

I am working on a notepad application for android and it seems I have a litte problem for a textview. Here's the thing: I have a listview of notes, when I click a note, I open another activity which displays the content of my note into a textview. When I click this textview(representing the text from the note), it opens another activity for editing the text (like most of these apps do). The problem is that some of the notes are really long, so I need to make my textview Scrollable. But since I am having a "setOnclickListener" on it, I cannot do that at the same time. I have searched a lot on google and apparently a lot of folks seem to have this problem. Is there a way to achieve my goal?
Ideas:
Use OnGestureListener or OnTouchListener
Use an 'edit' button
Use long press instead of OnClick

How can implement search bar in android?

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

Categories

Resources