By an array, when I press a button show new text in a textview (scrollable).
So, if a read the text in a textview until half page and press the button, new textview show me new text NOT from start of it but with same position of last textview.
How I resolve this problem?
thanks!
Going to take a wild stab in the dark that when you mention scrolling text view, you are referring to a EditText view. If this is the case, you can set the position of the cursor in an EditText by using the setSelection function. To return to the start, you would use setSelection(0).
Related
I have added two textview(id, name), two edittext and two buttons(edit,save) in every row of listview, When edit button is clicked both edittext appears in that row(visibility is set to gone in XML) now all I want to do is allow user to add some contents in edittext and on pressing save button those contents will be reflected in textview and edittext will be disappeared again.
On edit buttons click view two edittext are appearing as expected but as soon as I type in any of the edittext they are getting refreshed. In debug mode I have found out that as soon as I am typing in Edittext getView() method called again & again and that's the reason behind refresh.
I have implemented empty onclicklistner on edittext so that when it get touched and typed it will not call getView but thats not working and I know that's a stupid attempt to solve problem.
Please tell what to do so that when I click or type in edittext it will not call getView().
You have to off focus from xml of edittext and button
I have a custom list row which has two TextView and one EditText .
I want to clear the text typed in EditText of all the list rows on a Button click which is a reset button.
The Button is in an Activity
Can anyone suggest me a way I can achieve this.
Well your question is not clear at first, if you mean a system like listview or scroller when you say custom list row, then while on click of button do the following
Get all the child from the view
loop through each child, finding EditText inside each child view
Simply setText to empty.
I hope got your question right, else please put some code here.
You can use this to clear the editText
YourEditText.setText("");
I have four edit text. And one button .
First:On Click of button I want to set the Button Text to EditText in which cursor is blinking.
Second: After reaching MaxLength character of Edit text automatically set focus to next edit text.
Any Idea how to do that?
Make a list of all TextEdit, then search for selected:
http://developer.android.com/reference/android/view/View.html#isSelected()
I am setting a text in textview.And it is marquee text.Not just the text, it is an array of text concatenated one after another and added to textview.I want that if i will click any text then that text(or word) will be shown in a dialog box.First of all is it Possible anyhow.I tried to use Spannable from this link first answer.but it's not working as per my requirement as i have marqueeing text.
Why wouldn't you replace the marque with something more useful? :) You may wrap your textView into a horizontal scroll view. Then you have a thread (AsyncTask) that scrolls the text, using ScrollView.setScrollX() just as marquee does.
Can you guess, what comes next? Use spans, as suggested by the link, you quoted!
I am developing an application for Android, and for that I am trying to make a ListView act in such a way, that when a user presses an empty entry, he can start typing text directly into that empty entry, and that when the user touches any other part of the screen, it is saved. Is there a way to do this? I was thinking of using onClick somehow, but I have no concrete approach.
Here is one basic, general approach:
For each row of the ListView, create a layout that has a visible TextView and a EditText with the visibility set to gone.
Use an onClickListener for each row to swap the visibilities of the TextView and EditText (respectively, gone and visible) when the row is selected.
Track the active row for clicks to another row or background.
When the active row changes, set the value of the EditText to the TextView and return them to their original visible states.
Other approach that could be taken is using the View.OnFocusChangeListener and the TextWatcher you can get more detail about them here http://developer.android.com/reference/packages.html