textview

SharedPreferences save a text entered in an EditText and display it in a TextView in another activity

有些话、适合烂在心里 提交于 2020-02-02 13:56:53
问题 I'm beginner in Android development and I have an issue with save changement with some texts display in some TextViews. But one is more difficult for me. For explain simple, I have 2 activities, Activity1 is the main, Activity2 is the user informations. In Activity1 (Main) the user clic the button ("login") then he go on Activity2 here user can enter his personal informations and he click on a button ("save data") then I add his datas on a database (SQLite), then when the user click on

Android TextView: Getting “W/StaticLayout: maxLineHeight should not be -1. maxLines:1 lineCount:1” when setting text

巧了我就是萌 提交于 2020-01-31 06:21:15
问题 I'm setting some text on a TextView every 0.5 seconds based on a timer. Everytime, when the timer runs and the text is set, I'm getting this warning message being spammed in my console. W/StaticLayout: maxLineHeight should not be -1. maxLines:1 lineCount:1 XML Code: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout

Invalidate is not redrawing the screen. Android

▼魔方 西西 提交于 2020-01-30 07:25:06
问题 BufferedReader hl = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.lines))); while(hl.ready()){ showLines.append(hl.readLine()+"\n"); showLines.invalidate(); Thread.sleep(10); } That is my code but it is not redrawing when I tell it to. It is supposed to redraw after every line that is added to textview, but it still only redraws at the end? Can someone please help me, I can't figure it out. 回答1: That is bacause your invalidate() is in a thread while loop and is

TextView won't break text

若如初见. 提交于 2020-01-29 09:50:21
问题 I am having trouble with textView not breaking line before ICS. In ICS (i belive honeycomb works as well but i havent tried it tho) the text inside textView breaks nicely but in gingerbread and below text just keeps going in one line. Any ideas how to fix this? I am using a viewpager and this is the layout for each screen. I am using custom textView just to add custom font, hope thats not the problem. pager_item.xml:` <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

Android: How to wrap text by chars? (Not by words)

╄→гoц情女王★ 提交于 2020-01-28 03:35:35
问题 For instance: This is foo text for wrapping text in TextView The way that TextView wraps is: This is foo text for wrapping text in ... I want this: This is foo text for wr apping text in TextView 回答1: It's a bit hacky, but you could replace spaces with the unicode no-break space character (U+00A0). This will cause your text to be treated as a single string and wrap on characters instead of words. myString.replace(" ", "\u00A0"); 回答2: As I know, there is no such property for TextView. If you

How to paginate long text into pages in Android?

五迷三道 提交于 2020-01-25 20:20:11
问题 I know this question has been asked on stackoverflow, (Link To Original Question) I was following the solution provided there, and got a few errors. (I wanted to ask in comment there only, but think I don't have enough reputation to ask in comment of a marked answer) My original question is same, i.e. "I want to paginate long text" Errors encountered in the provided answer(link posted above) - 1. After telling about PageSplitter class, solution provider (mixel) stated this - ...Then by using

WebView vs TextView for displaying html content

為{幸葍}努か 提交于 2020-01-25 19:58:33
问题 I have a number of html pages as Strings in my android app. So you might visualize it as List<String> myWebPages where each webpage is an html page equipped with css and javascript and html body. What is the best way to display these web pages to user? Should I use WebView or should I use a TextView? Notice that I don't have urls for the WebView; how would I pass the String? As for the TextView, can it handle full web pages with css and javascript? Update When I use webView.loadData(Html

WebView vs TextView for displaying html content

不问归期 提交于 2020-01-25 19:57:08
问题 I have a number of html pages as Strings in my android app. So you might visualize it as List<String> myWebPages where each webpage is an html page equipped with css and javascript and html body. What is the best way to display these web pages to user? Should I use WebView or should I use a TextView? Notice that I don't have urls for the WebView; how would I pass the String? As for the TextView, can it handle full web pages with css and javascript? Update When I use webView.loadData(Html

lateinit property homeViewModel has not been initialized

陌路散爱 提交于 2020-01-25 08:34:07
问题 I have a problem, I added three textView (textView, textView2, textView3) and imageView to fragment_home.xml and when I try to run the application on the emulator in Android Studio I get the error lateinit property homeViewModel has not been initialized . homeFragment.kt class homeFragment : Fragment() { private lateinit var homeViewModel: homeViewModel override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { homeViewModel =

Android. How to display large emoji? (Font size too large to fit in cache)

家住魔仙堡 提交于 2020-01-25 04:22:27
问题 For moderators: I already found similar questions (one, two), but none of them solves my problem. Please do not mark as duplicate. Problem: I have a device on Android 7 (API 25) on which I need to show a large emoji in TextView. If font size below 256 emojis are displayed without problems, but at a size above 256 emojis are not displayed: ERROR/OpenGLRenderer: Font size to large to fit in cache. What I tried: Disabling the hardware acceleration for a specific Activity Disabling the hardware