FAQ Database Discussion Community


How to change background of TextView From EditText Text Change?

android,colors,background,android-edittext,textview
I am using Fragment class in which I want to change the color of Text View When text is changed on my edit Text. What are the possible ways to change the background color of TextView When Text is Changed in EditText . My code looks like this : public...

Create custom selector

android,xml,android-layout,textview,drawable
I've got 3 TextView, and I want to create a custom selector drawable which: creates a rectangular border with round corners (done) gets selected when the user presses one of them The TextViews: <LinearLayout android:id="@+id/info" android:layout_marginTop="68dp" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_centerHorizontal="true" android:orientation="horizontal"> <TextView android:id="@+id/tour1" android:paddingLeft="10dp" android:paddingRight="10dp" android:paddingTop="8dp"...

Difficulty generating a textview next to an existing textview on click

java,android,textview
I am trying to make an android app in which you click a button and a new textview is created right next to an existing one with some preset text in the same style/size. The problem is, when the new textview is created the text appears smaller and in a...

Boolean value not being set upon onClickListener

java,android,textview,onclicklistener
I have two classes. I am trying to change a boolean value depending on if the user clicks a checkbox. Then, depending on whether that value is true/false (whether the checkbox was checked or not), I want to display specific text in a textview. Here is the MainActivity class: public...

How to prevent the TextView from being cutoff by the parent container?

android,textview,mpandroidchart
I'm using mpandroidchart to generate a chart on one-third of my device screen. As I move towards the edge of the screen the TextView gets cutoff by the padding on the sides on the parent container. Is there a way to fix it without changing my UI? Towards the edge:...

How do i get information from textview?

android,textview
Ii am trying to figure out how to get the information that a user entered into a textview box which contains userpassword and username. My goal is to display the information from the two fields when the user clicks the button Login. I am stuck trying to display the information....

Change text color of a predefined layout

android,android-layout,textview,textcolor
I searched everywhere but I cannot find a solution for this simple question: I'm using a predefined layout R.layout.simple_list_item_1 but I cannot find the way to modify the text color of the TextViews inside it.

Http data is not showed on my TextView [android]

android,http,textview
I' m trying to get data from google through HTTP request: Main public class MainActivity extends ActionBarActivity { TextView httpStuff; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.httpexample); httpStuff = (TextView) findViewById(R.id.httpText); HTTP test = new HTTP(); String returned = null; try { returned = test.getInternetData(); httpStuff.setText(returned); } catch (Exception...

How can I place Button or TextView at the absolute bottom in RelativLayout?

android,xml,android-layout,textview,relativelayout
There seems to be some hidden padding in the RelativLayout, I'm I right? I've got this TextView: <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="@color/green" android:text="LOG IN"/> in a RelativeLayout. What I cant understand is why android:layout_alignParentBottom="true" doesn't place the TextView all the way down. ref image: Is there any way to remove...

TextView in my getView() inside a adapter class throws null pointer exception

android,listview,textview,listadapter
I'm trying to create a android application, in which I try to setText() for a textview dynamically. But it throws null pointer exception @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder1 holder1; // LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); Log.i("&&&&& convert view is null", "&&&&& convert view is...

Position textView and control its width and height

android,textview
How can I customize the TextView and position it there so that it only covers a selected part of screen as in the link? http://www.mediafire.com/view/0r389nv7ynb3yu0/Screenshot_2015-04-18-23-58-14+-+Copy+%282%29.png# The snapshot is drawn using Paint. I have the x, y coordinates as well of the rectangle shown in the link but how can I...

Update textView in appWidget android doesnt work properly

android,textview,runnable,android-appwidget
i'm trying to create an appWidget with a timer and 2 button,(play and stop). The problem is that when i start the playButton the timerValue doesn't update. Probably is a stupid problem. This is my class Service: @Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStart(intent, startId); productivityDB...

How can I remove the border of a TextView item in a ListView

android,listview,textview,border
I have this bank info list for user to select a bank. I have set textview's background with a drawable file to replace system effect. However, it will show orange borders(system effect) around textview which looks terrible for me .I would like to give you guys some pictures, since my...

Android Studio textview text isn't changing when I use setText in custom method

java,android,android-studio,textview,settext
I'm using the following to change a symbol: private void updateCurrencySymbol() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); String symbol = sharedPreferences.getString("preferences_currency", "$"); Toast.makeText(getApplicationContext(),symbol,Toast.LENGTH_LONG).show(); currencySymbol1 = (TextView) findViewById(R.id.currencySymbol1); currencySymbol2 = (TextView) findViewById(R.id.currencySymbol2); currencySymbol1.setText(symbol); currencySymbol2.setText(symbol); //refreshes the...

Changing the underline color of TextView

android,textview
I am trying to change the color of the underline indicator in a TextView. I know I can underline text like this Spanned htmlString = Html.fromHtml("<u> <font color=\"#FF0000\"> some text </font> </u>") someTextView.setText(htmlString); And like this SpannableString content = new SpannableString(test); content.setSpan(new UnderlineSpan(), 0, test.length(), 0); tvTest.setText(content); But both solutions...

Show price - double as Integer depending on its value in TextView - Android [duplicate]

android,textview,integer,double
This question already has an answer here: How to nicely format floating numbers to String without unnecessary decimal 0? 15 answers I would like to know how can I show in my TextView the price as follows: Price is a double value. a=8.75 and b=9.00 I need display a=8.75...

Create cyclic textview

android,textview,cyclic
I spill a lot of data into TextView and after sometime the first messages are less interesting. Therefore I want to limit max lines to 40 and do the TextView Cyclic, then the 41 line will write at the first line in the 'TextView' I know I can limit max...

accessing children's properties after creating several Views

android,view,textview
Let's assume I have a ScrollView and an Actionbar button which adds Views to the ScrollView. This View holds a simple EditText. A user can add as many Views as he wants to and assigns each View a unique number. Am I able to access each View and read its...

Get textColor attr from what was defined in xml

android,xml,attributes,textview
I am trying to get the android:textColor that was set inside the xml layout in my CustomTextView. How can I get it from the AttributeSet attrs?

How to easily create hyperlink to activity (with intent) in TextView

android,hyperlink,textview,click
I would like to hyperlink any text that goes to imgur.com to open a new activity in my application (with intent). Is this possible? If so, how?

Jsoup select text WITH including html tags

java,android,html,textview,jsoup
I use Jsoup to select some code between <td></td> tags. It looks like this: Document doc = Jsoup.parse(response, "UTF-8"); Element elMotD = doc.select("td.info").first(); String motdText = elMotD.text(); My problem now is that jsoup selects the text like I want but it simply sorts out tags like <br> which are important...

How to align a character vertically in a TextView?

android,textview
I am wanting to align a single character in an Android TextView to the top, similar to a superscript but such that the superscripted character's top matches the rest of the characters' tops. For the sake of simplicity, I have tried accomplishing this with Spannable, however, nothing is standing out...

How do I make a textview fill the height of a linear layout?

android,android-layout,textview
Ok, I've been spending hours trying to solve this or even find a solution online and so far nothing has worked. How can I make the TextView "content_note" fill the available space in this LinearLayout? <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"...

how to display number in textview(activity2) from edittext(activity1) ? Say example phone number

android,eclipse,android-edittext,textview
Activity 1: public class Start extends ActionBarActivity { EditText MobileNo; EditText Name; Button Next; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_start); Next = (Button)findViewById(R.id.Next); Next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub MobileNo = (EditText)findViewById(R.id.MobileNumber); int Data = Integer.parseInt(MobileNo.getText().toString()); Name =...

TextView setText is displaying ints instead of strings

android,textview,settext
I’m new to Android programming and trying to accomplish a seemingly easy task where I display a user’s Android Build version. It took me a while to get past a runtime error where this line wouldn’t display an int, even though there were no compiler issues: int version = Build.VERSION.SDK_INT;...

RecyclerView ambiguos setVisibility function, clicking on one view affects multiple views

android,listview,textview,android-imageview,recyclerview
This is the project I am trying to run. Here is my code for the onBindViewHolder from RecyclerView.Adapter class @Override public void onBindViewHolder(ViewHolder holder, final int position) { TextView title = (TextView) holder.view.findViewById(R.id.title); final TextView desc = (TextView) holder.view.findViewById(R.id.desc); final ImageView imageView = (ImageView) holder.view.findViewById(R.id.imageView); title.setText(pojos.get(position).getTitle()); desc.setText(pojos.get(position).getDesc());...

TextView not showing up on Android device?

android,textview,settext
I have a few views in a Linear Layout. After clicking a button, some math is done. The result is then displayed in a textview. It works fine on the emulator, but it does not on my Android device. Entire Layout file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"...

how to change the background color of TextView if EditText is empty in android?

android,background,android-edittext,textview,textchanged
I am using Fragment class in which I want to change the color of TextView When EditText is empty after text is changed. I am able to change the color of TextView on text change but when the text is clear the TextView background color doesnot change to previous one....

How to scroll text with seekbar?

android,textview,scrollview,seekbar
I am learning Android Studio and I am making program where is very much text so I am trying to make it scrollable with seekbar (also I want it to be vertically scrollable) seekbars 0 amount is top and 100 is bot. I made it so that is scrolls when...

Get Response, Url and Url code in Textview

android,android-asynctask,textview,android-textview
I am trying to make a post request to a url and get the URL, Response Code and Response displayed in a TextView. I am able to get the URL and Response Code in the Logs but Unable to get the response. Please check the code and tell how to...

Prevent word from being broken in TextView

android,textview
How do I prevent a word in a TextViewfrom breaking in half when it doesn't fit on the current line and instead move to the next line. |android goo| |gle kitkat | should instead be |android | |google | |kitkat | The TextView is currently added to a RelativeLayout using...

Android - draw9patch should help me? background of textview

android,view,background,textview,imageview
I need to set background of the TextView without stretching like this: I tried draw9patch but seems that it doesn't do that work. How can I reach this efect? I could also use ImageView, but I don't know how I can add text in ImageView (I cannot use layout or...

XYZ Not working in android

android,html,tags,textview,clickable
i have searched on Stack overflow and followed the solution but still not getting what i want. i am receiving String from server like this <p><a href="http://www.arenafootball.com/sports/a-footbl/aflsrk/mtt/micheaux_robinson_841978.html"><span style="font-size: small;"><strong>AFL Stats</strong></span></a></p> and now i am trying to display it in TextView in android usingtv.setText(Html.fromHtml("")) Code: TextView tv = (TextView) findViewById(R.id.tv);...

Android carriage return inside concatenated string

android,textview,concatenation,carriage-return
A quick question please. I am reading an NFC tag and showing the result on the screen of my device and this is how it appears: The content of the tag is : bla bla bla I want to have 2 lines appearing as this: The content of the tag...

Get the text from a TextView

android,textview
How can I get the text as String from a textview? I tried: myTextView.getText(); but it didn't work....

Multiple clickable link in textview

android,html,textview,android-webview,android-toast
I want to set html text in textview like this: <a href="?id=1>Toast id1</a>hello there <a href="?id=2>Toast id2</a> hello there <a href="?id=3> Toast id3</a> I want to show the different toast after clicking on different link with different id(query string)....

Android - Checking value from an SQLite DB table

android,sqlite,textview
I'm trying to read data from newly deleted SQLite db table row. Basically my program will delete a row when a certain activity is loaded, and I want to check the value inside the row. This is my get code : public String getSlot() { String slots = new String();...

TextView with Html +

android,html,image,textview
I would like to display images (png, gif) stored in a string that has the html tag ( , < im /> ...). Show Html no problem, but the images aren't working. I saw examples on the Internet but only for a string that contains only ONE image without text...

Android: adding programmatically a TextView is not working

android,textview,relativelayout
I have an issue while trying to add a TextView to a RelativeLayout. My code is this one: TextView lectureView = new TextView(this); LayoutParams lp=new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); //lp.setMargins(0,60,0,0); lectureView.setTextColor(0xffffff); lectureView.setBackgroundColor(0x000080); lectureView.setText(lect.getCourse().getName()); ((RelativeLayout)findViewById(R.id.mondayRelativeLayout)).addView(lectureView); ((RelativeLayout)findViewById(R.id.mondayRelativeLayout)).invalidate(); But...

Showing current time in Android and updating it?

android,time,textview
Hey guys I want to display current time and keep it updating, in this format example: 09:41 Hour:Minute. Is it possible to do in TextView, I tried some ways but I'm not getting what I actually want...Thanks in advance!

How to get ListView underneath buttons

android,textview,alignment,android-linearlayout
Right now my listview is to the right of my last button, but I want it to be underneath all three of my buttons (which are all on the same row). How can I get my listview underneath my buttons? Here is my code <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center_horizontal|bottom"...

Characters appear in the order as i click

android,button,textview
For example. There is picture on the top of the screen below that there are some empty boxes and below the boxes there are some buttons. Every button has a character for text("a","c","t"). You click on a button and the button's text appear in the box. You can click them...

Turkish characters are not shown on TextView

android,utf-8,textview
Turkish characters are not shown on TextView. I have read previous questions and did some changes and they are not solved my problem. Here is picture: Here is my changed code: holder.txtGazeteName.setText(Html.fromHtml(gazetelerArrayList.get(position).getName()).toString()); here is input for ArrayList gazete = new GazetelerClass(); gazete.setName("YeniŞafak"); gazete.setAdress("http://www.yenisafak.com.tr/yazarlar/"); gazete.setImage(R.drawable.yenisafak); gazetelerArrayList.add(gazete); ...

Make Hyperlink in Textview android

android,textview
I want to make hyperlink "TERMS" and "PRIVACY POLICY" its not working in my case:- mTermsPPText = (TextView) view.findViewById(R.id.bottom_text); String value = "<html>By joining you agree to our <font color=\"#3C599F\" ><a href=\"http://www.google.com/\">TERMS</a></font> & <font color=\"#3C599F\" ><a href=\"http://www.google.com/\">PRIVACY POLICY</a></font></html>"; mTermsPPText.setText(value); ...

How to get the text onClick on a TextView that is created dynamically?

android,textview,onclicklistener
I have this code so far, to create TextViews with the texts from usernames arrayList. TextView txt_con = null; for(int i=0; i<usernames.size(); i++) { txt_con = new TextView(this); txt_con.setLayoutParams(lparams); txt_con.setPadding(0, 30, 0, 0); txt_con.setText(usernames.get(i)); ll_cont.addView(txt_cont); } and the onClickListener txt_con.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO...

Converting Text view to bitmap returns null

java,android,canvas,bitmap,textview
I am trying to make an image of dynamically added views in my activity. Can you please tell me what I am doing wrong, the bitmap returns null for some reason. Thanks, protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_share); TextView tv = new TextView(this); tv.setText("sadasdsadssad"); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(...

Null Object Preferences Edittext on Android [closed]

android,textview,android-textview,null-object
I am new Android programming. I am at bottleneck. I am trying to chatapp. when I click the item these errors occur : java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.EditText.setInputType(int)' on a null object reference at com.senturk.fatih.chat03.Chat.onCreate(Chat.java:55) and here is line 55 txt.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_FLAG_MULTI_LINE); and I guess I should add...

How to make a TextView multiline programmatically in Android (Java)

java,android,textview,multiline
I want to make my textview multiline. Image : http://s13.postimg.org/y0q78e1yv/Capture.png But how can I make my text multiline ? Which atribut ? TextView txt_tweet = (TextView) View.inflate(this, R.layout.special_textview, null); special_textview <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingLeft="20dp" android:paddingRight="20dp" android:paddingBottom="5dp"...

Android: Can't make small fontsize on programmatic textviews

android,textview,size
I'm using the following method which programatically creates a linearlayout and populates it with two textviews, adds text and then turns it into a drawable that I later use a layer above a shape. However, I've noticed that I can't create a small fontsize - it seems stuck at a...

Gather text-data from html file

java,android,textview
I'm making an app which will display quite a lot of information in text. I would love to be able to change this text without having to do any updates to the app itself and there-fore it would be great to just get the text from a simple HTMl-file...

how to display data from a database into two Textview

android,sqlite,textview
i'am trying develop an application which save points and date in a database but, i want to show into a list the points in green and date in white. The points and the time points are above one another. My code: Class database public class BaseDeDatos extends SQLiteOpenHelper{ public BaseDeDatos(Context...

Android - Re-use TextView showing current date time in multiple activities

android,time,textview
I have some activities displaying the current date and time. I want to make only one text view (layout) txtTime showing time and it will be updated each second by a handler in main activity. Then others views of other activities can re-use the text view txtTime by including. (I...

How can I make a “block” with seekbar and text?

android,textview,seekbar
How can do that How can I put in the same block two text and a seekbar? Can I put them together? This is my current (poor) code: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/activity_libretto" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="vertical" > <TextView android:id="@+id/txt" android:textAllCaps="false" android:layout_width="match_parent" android:layout_height="wrap_content"...

First time programmer confused as to why the EditText and Button fields aren't going where I want them to

android,xml,textview,android-linearlayout,relativelayout
I am coding in XML on android studios, and I am having trouble getting the EditText to be centered at the top and the Button to be centered in the center. I do not know a lot about code so the other things I've read about Relative vs Linear Layout...

Android put 2 textview in same order

android,textview
I got 2 textviews. 1st <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="If you would like to provide feedback on the ehospice app, or report an error or problem, please " android:textColor="#000000"/> 2nd (in my activity i use clicklistener on it and underline it) <TextView android:id="@+id/send_us_an_email" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="send us an email." android:textColor="#000000" />...

how to set textview width wrap_content but limit to 1/3 of parent's width

android,textview,android-layout-weight
Having a TextView, its width should not go over 1/3 of its parent's width. If its width is smaller than 1/3 of parent, it should have wrap_content behavior. Its horizontal sibling will always start next to it. Tried following, it always has hard cut of 1/3 and 2/3, so if...

Percentage symbol in TextView with one decimal point

android,textview,symbol
How can I set the percentage symbol to a TextView with one decimal point in Android? I have tried using the unicode symbol but its not working. textES.setText(String.format("%.1f \u0025",percentage)); ...

To split Strings from a MultiAutoCompleteTextView and set it to different textview

android,textview,multiautocompletetextview
I have a array of strings which is a resultant of options selected from a MultiAutoCompleteTextView using the comma tokenizer. The string appears as below: "India, China, Japan, America, Australia" I need to seperate this values based on the coma positiona and set those values to different textview's. Also I...

Android string with HTML failed

android,html,textview
In my strings.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="informations_links">Read these <b><a href=\"com.android.mobile://ReaderActivity\">general informations</a></b> and <a href=\"com.android.mobile://ReaderActivity\">this main note</a> from this box.</string> </resources> Then I use it like that: mTextView.setText(Html.fromHtml(getString(R.string.informations_links))); It doesn't work. My text is not formatted. But if I write directly this and...

Update TextView in inflated Layout

android,textview,layout-inflater
I have a template layout file called template_dashboard_item.xml its contents are <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/DashboardItemContainer"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/DashboardItem"> <TextView style="@style/DashboardItemText" android:text="Application for Jane Doe has been added" android:textColor="@color/black" /> <TextView...

How to Know What Part of a TextView was Selected

android,android-fragments,textview,onclicklistener
I am populating textviews on the activity dynamically, based on text that is being parsed in from xml articles. The text is formatted using html tags, so I set the text like: textViewBody.setText(Html.fromHtml(content)); The articles are set up to either some text in a body to a website, to another...

android - No Activity found to handle intent action.VIEW

android,exception,android-intent,android-fragments,textview
I got an exception in my android app: 06-18 17:57:39.816 6333-6333/com.appsrox.instachat E/InputEventReceiver﹕ Exception dispatching input event. 06-18 17:57:39.816 6333-6333/com.appsrox.instachat E/MessageQueue-JNI﹕ Exception in MessageQueue callback: handleReceiveCallback 06-18 17:57:39.816 6333-6333/com.appsrox.instachat E/MessageQueue-JNI﹕ android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=href (has extras) } at...

Text.BoringLayout WIDTH is set to 0 (not showing) in Android TextView When I have an non-English text?

android,android-layout,textview,arabic,persian
I have an Android Widget TextView, when I setText with Persian charachters, it just not showing! and I guess the mBoring (Text.BoringLayout property) is responsible, because the width is set 0. there is no problem when I set english + persian strign, and the width set to proper value such...

How can I add a text view for every item in my list?

java,android,textview
I am making a yelp-like app in which users can leave reviews for various places, but I want other users to be able to see all of the reviews left. Currently, I am using a list to store all of my reviews in, but I can't seem to figure out...

Android Get Country Emoji Flag Using Locale

android,textview,emoji
I have seen that since Lollipop, Android has built in Emoji flags for different countries. Is it possible to use the devices locale to retrieve the Emoji flag for that country? I wanted to insert the Emoji flag into a TextView which contains the user's location....

Android TextView: text not shown if setText from HTML and android:singleLine=“true”

android,html,textview
I'm setting a text to a TextView calling tv.setText(Html.fromHtml("<a href=\"" + link + "\">" + text + "</a>")); This text is a web link. This was working fine till I cut the text by myself. Now that I've set: android:singleLine="true" android:ellipsize="end" to the TextView, the text is not visible anymore....

How Display large Text in Page's like Book?

java,android,textview
First let me say that I'm very new to android development and now work in app read .txt file in Cd-card and display it by page need know how I can set the text in page's and Browse it Ex : Page1 <-> Page2 <-> Page3 <-> Page4 <-> ........

Getting strings from `Edittext` thats valid

android,android-edittext,textview
I have 5 Edittexts and a TextView at the end of them to calculate the average of the data in the EditTexts. How can I only divide by the number of EditTexts that only has input in it? Right now I'm dividing by the num of total EditTexts, which is...

How can I set multiline TextView Ellipsis properly in LinearLayout

android,android-layout,textview
I have such a layout hierarchy as following: <LinearLayout android:id="@+id/wrapper" android:layout_width="50dp" android:layout_height="63dp" android:orientation="vertical"> <TextView android:id="@+id/title" android:background="#f00" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="title" /> <TextView android:id="@+id/detail" android:background="#0f0" android:layout_width="wrap_content" android:layout_height="wrap_content"...

Is it possible to know the number of visible words? not full length?

android,textview
Is it possible to know the number of visible words? not full length? I add to textView string from 100 words. But visible only 10 words. How do I know that only 10 words? Log.e("asdas", String.valueOf(messageView.length())); not working Sorry if this question is too complex :((...

NullPointerException when long press on TextView with SpannableString

java,android,textview,spannablestring
I have a TextView with SpannableString because I want the do differnet thing when user click different position of the view. Here is my code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); String str = "ClickMe"; SpannableString spStr = new SpannableString(str); ClickableSpan clickSpan = new...

Custom TextView with icon

android,layout,textview,icons,drawable
I need to obtain some TextView with a custom icon on them, such as these ones: but I've only been able to do this: my 3 TextView: <LinearLayout android:id="@+id/info" android:layout_marginTop="80dp" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerHorizontal="true" android:orientation="horizontal" android:layout_marginEnd="16dp" android:layout_marginRight="16dp" android:layout_marginLeft="16dp" android:layout_marginStart="16dp"> <TextView android:id="@+id/info_totali"...

Make new onclick listeners not overwrite previous ones

java,android,button,android-studio,textview
I want certain buttons to set text on certain textviews when clicked depending on their position in the array, I want the first four cases to make the first textview say "yeah", and the second four to make the second textview say "no". The first four cases worked until I...

TabStopSpan.Standard constructor parameter

android,textview,spannablestring
Does anyone knows what the parameter (where) in the TabStopSpan.Standard constructor represents ? is it pixels ? According to some tests that I did, it doesn't represent pixels, I simply draw gridline and added tab stop to textview, and if for example I set the tab to 200 it doesn't...

TextView animation expand only one line

android,animation,textview
I need to animate a TextView when i click a button. The height of the TextView is wrap_content. This TextView is inside a RecyclerView row and i need to expand it from visibility gone to his real height with content. I used ValueAnimator. private ValueAnimator slideAnimator(int start, int end) {...

Whatsapp Message Layout - How to get time-view in the same row

android,android-layout,textview
I was wondering how WhatsApp handles the time shown in every message. For those who don't know: If the message is very short, the text and time are in the same row. If the message is long, the time is in the bottom right corner - the text wrapped around...

How can I make TalkBack ignore android:text element?

android,xml,textview,accessibility,talkback
I am improving the accessibility for visually impaired in my android app. I have the following TextView in a popover.xml file in my Android project. <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="12dp" android:text="@string/pass_code"/> Whenever I test the app with TalkBack, the app speaks back the string in android:text but in this case I...

Android TextView text updation on receiving data from Inputstream

android,textview,android-bluetooth
I am coding a client-server app to test communication between two Android Bluetooth devices. On my client, I am reading data from the inputstream object. When I checked by printing on the logcat, the data is being read successfully. However when I try to set the data to a TextView,...

Android app theme textViewStyle doesn't work on phone

android,xml,textview,styles,android-theme
I have so specific problem. I'm applying theme for all textviews. It appears on preview but when I run this app on phone I face with unstyled textview. The styles I set for other views are working. only textviewstyle is not working. In this sample textview color is green in...

How can I create a history of previously created TextViews in an Android App? One that the user can access

android,logging,textview,record,history
I have a simple simple app, that simply takes a user's question as input, and creates a long string containing: the original question, and a randomly generated answer. This string then gets displayed as a TextView (I'm sorry if I'm not describing this correctly). What I would like is to...

Android textview adapter is not returning id of particular textview find with tag

java,android,textview,adapter,android-adapter
I am learning android development and working on a small game app. So here is my code which is working, LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View gridViewContent = layoutInflater.inflate(R.layout.game_grid_view_content, null); final TextView tv = (TextView) gridViewContent.findViewById(R.id.g_v_content); tv.setHeight((gridViewHeight/8)+5); tv.setTag(position + 501); tv.setId(position + 1001); tv.setText(String.valueOf(...

XML / Java Could not find method error when Button is used to edit TextView

java,android,xml,button,textview
I am realitavely new to Java coding and am trying to create an android app (I want it to calculate my max one rep max for weightlifting) sp that it will use a button press to update a text view. The code I am currently using is causing my app...

How to enable the animation on textview borders in Android

android,xml,textview,android-animation
I created an XML file that enables the textview border change colour on click. Now I want to add another feather that the border softly fades away. How can I do that? Here's the XML code. <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="true"> <shape android:shape="rectangle"> <solid android:color="@color/textbox" /> <stroke...

How to automatically adjust the TextView height according to the size of the String?

android,textview,size
I want to know how to automatically adjust the size of the TextView according to the length of the String. I am getting some data from another Intent as a String and storing it in a TextView. If I leave it small, the whole text won't fit and only half...

Display complex Html text in android like gmail

android,html,webview,textview,monodroid
Hi i have to display html text with its style property, i tried both textview and webview . when i use textview with Html.fromHtml("html text ") its showing only text without html style and other hand when i use webview the whole content display in single line with horizontal scroll...

Android onLongClick bug with TextView

android,textview,relativelayout
I've a strange bug with TextView in RelativeLayout. After setting OnClickListener to RelativeLayout, when I press relativeLayout for long (that is OnLongClick) there appears a popup with button "paste". After pressing "paste" a text from buffer pastes into textView (which is inside RelativeLayout). I'm confused, is it google's side bug,...

Close app and reopen Continue read text

android,textview,onresume
This is simple code with multi text in one textview, int stringIdList[] = {R.string.text1, R.string.text2, R.string.text3, R.string.text4}; int stringListCounter = 0; TextView text1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button next = (Button) findViewById(R.id.next1); Button previous = (Button) findViewById(R.id.pre1); text1 = (TextView) findViewById(R.id.textView1); next.setOnClickListener(this); previous.setOnClickListener(this); @Override...

Android: TextView with multiples colors and fonts

android,textview,spannablestring
Ok, so I gather that this should be a fairly straightforward process. I've read the following questions: Multiple Typefaces in the same TextView Multiple Typefaces in the same TextView Put in bold some parts of a TextView Making part of a string bold in TextView The advice seems to be...

TextView class error.

android,textview
I have the following error in MainActivity.java: "Cannot resolve symbol mainTextView." why is the error mainTextView occurring? please. I am new to developing android & simply following a tutorial @Override public void onClick(View view) { // Test the Button mainTextView.setText("Button pressed!"); } inside of..... MainActivity.java package com.example.android.omgandroid; import android.os.Bundle; import...

Android TextView invalidate doesn't work

java,android,android-layout,textview
I'm in front of a small invalidation issue on Android. After creating my view on the Activity creation, i'm receiving a Listener Callback ("onSomething" in the example below") to update a TextView, however I'm not able to make it work... Can you help ? Activity onCreate : @Override protected void...

Android text over-enlarging text size

android,textview
I'm new to android and I'm working on this "About" page that is giving me some really weird behavior. It has text that when clicked expands and then collapses when clicked again. The collapsed text is of a larger size than the expanded text. When I click to expand, the...

How to display images in textview from server

android,image,textview
I receive Data from Server text and in the text there is something like this '[LoadImage:ImageLink]' and I want this text to be replaced with the ImageLink I know how to download the image from the link but I don't know how to display it in the textview I have...

Changing text of a TextView throws NullPointer Exception

java,android,exception,textview
I'm just following the basic tutorial on the Android website. However, I'm trying to change a few things just for fun. For instance, instead of creating a runtime TextView (as in the tutorial) within the method onCreate(...) of the DisplayMessageActivty class, I've defined a static TextView in the XML layout...

set items of LinearLayout at center screen programmatically

android,textview,android-linearlayout,relativelayout
I'm trying to create a grid type view where number of textView boxes will appear at the center of the screen(horizontally). I'm only testing for two rows now. This is my xml file: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"...

how to pass NetworkImageView(volley library) content to another actvity?

android,textview,imageview
I've two NetworkImageView elements in ListView, one is visible NetworkImageView element and another invisible NetworkImageView element. And I've implemented a onlickListener to Listview elements which calls a new activity whenever i select the element in the ListView. when calling a new activity i'm passing these two NetworkImageView elements to new...

Animation of android TextView's text size and not the entire TextView

android,android-layout,textview
Is there a way to animate only the TextView's text size without scaling the entire TextView's layout? Am trying to achieve a similar effect, Note the text re-sizes to a single line while its size becomes smaller....

What happened to the markup in EditText?

android,textview
What happened to the markup in EditText? I used 9path for image for background in EditText CODE JAVA: To be honest, I used to, nothing like that happened. And besides, I don't use 9path too often. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#0079e8"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content"...

Create a new random number each time an activity is opened

android,random,textview
I'm doing a simple addition game on android studio. Every time the "addition" activity is opened I was hoping to generate two random numbers in two text boxes. However I can't get it to work and the text box appears blank every time I run the app and open the...

Comparing UI object in ios

ios,objective-c,uitableview,textview
I am making a super class to TableView, I will have static TextView in it and also I have TextView in cells. Then I starting edit my TextView in Cell I assign it to static property of TableView. Now I need go thought cells subviews, compare 2 textView (static and...

Change color Text from CustomTextView

android,textview
By default to change textColor programatically is : textView.setTextColor(Color.RED); I need to have a custom Textview to change typeface and color by default, How can change textcolor from CustomTextView class, here is my code. public class CustomTextView extends TextView { public CustomTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs,...