Android :: Text Longer Than Available Space / How To Get Remaining Lines?
Sep 24, 2010
I have a long text and I want it to be displayed with a TextView. The text I have is much longer than the available space. However I don't want to use scrolling, but ViewFlipper to flip to the next page. How can I retrieve the lines from the first TextView that are not shown because the view is to short so that I can paste them into the next TextView?
I simply have to use a custom View with a StaticLayout like this:
public ReaderColumView(Context context, Typeface typeface, String cText) { super(context);
Display display = ((WindowManager)
context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
dWidth = display.getWidth(); dHeight = display.getHeight();
contentText = cText; tp = new TextPaint();
tp.setTypeface(typeface); tp.setTextSize(25);
tp.setColor(Color.BLACK); tp.setAntiAlias(true);
StaticLayout measureLayout = new StaticLayout(contentText, tp, 440, Alignment.ALIGN_NORMAL, 1, 2, true);
Boolean reachedEndOfScreen = false;
int line = 0; while (!reachedEndOfScreen) {
if (measureLayout.getLineBottom(line) > dHeight-30) { reachedEndOfScreen = true;
fittedText = contentText.substring(0, measureLayout.getLineEnd(line-1));
setLeftoverText(contentText.substring(measureLayout.getLineEnd(line-1)));
} line++;
} } protected void onDraw(Canvas canvas) { super.onDraw(canvas);
StaticLayout textLayout = new StaticLayout(fittedText, tp, 440, Alignment.ALIGN_NORMAL, 1, 2, true);
canvas.translate(20,20); textLayout.draw(canvas);
}
Thats not optimized yet but you get the point.
View 1 Replies
May 8, 2009
Is there any way to detect remaining space on the sdcard through the API? I prefer not to make native or shell calls.
View 4 Replies
View Related
Sep 9, 2010
I have the following layout in my xml file:
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout android:id="@+id/logoLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
-- some images </FrameLayout>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:layout_below="@+id/logoLayout">
Button 1
Button 2
Button 3
Button 4
</RelativeLayout>
<RelativeLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:layout_alignParentBottom="true">
Button 5
</RelativeLayout>
<RelativeLayout>
Maybe I didn't do it in the best way. What I want: have the Layout that contains the 4 buttons to use the entire space between the top and bottom layout, and I want to have the button equally arranged in the layout. Something like this:
http://img16.imageshack.us/i/androidq.png/
I add the whole layout code:
<?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:background="@drawable/background">
<!--The header of the page-->
<FrameLayout android:id="@+id/logoLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView android:id="@+id/logoBackground"
android:src="@drawable/logo_background_small"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<ImageView android:id="@+id/logoImage"
android:src="@drawable/logo_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:gravity="center"
android:padding="3dip"/>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/tracks"
android:layout_gravity="center"
android:gravity="right"
android:textSize="22dip"
android:textColor="#ffffff"
android:padding="3dip">
</TextView>
</FrameLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:layout_below="@+id/logoLayout">
<Button android:id="@+id/btn1"
android:layout_height="wrap_content"
android:layout_width="250dip"
android:drawableLeft="@drawable/img_small_btn_look_around"
android:background="@drawable/main_long_menu_button"
android:text="@string/btn1"
android:textSize="18dip"
android:textColor="#ffffff"
android:layout_marginTop="20dip"
android:onClick="btnMyTracksOnClick">
</Button> <Button android:id="@+id/btn2"
android:layout_height="wrap_content"
android:layout_width="250dip"
android:drawableLeft="@drawable/img_small_btn_look_around"
android:background="@drawable/main_long_menu_button"
android:text="@string/btn2"
android:textSize="18dip"
android:textColor="#ffffff"
android:layout_marginTop="20dip"
android:layout_below="@+id/btn1">
</Button>
<Button android:id="@+id/btn3"
android:layout_height="wrap_content"
android:layout_width="250dip"
android:drawableLeft="@drawable/img_small_btn_look_around"
android:background="@drawable/main_long_menu_button"
android:text="@string/btn3"
android:textSize="18dip"
android:textColor="#ffffff"
android:layout_marginTop="20dip"
android:layout_below="@+id/btn2">
</Button>
<Button android:id="@+id/btn4"
android:layout_height="wrap_content"
android:layout_width="250dip"
android:drawableLeft="@drawable/img_small_btn_look_around"
android:background="@drawable/main_long_menu_button"
android:text="@string/btn4"
android:textSize="18dip"
android:textColor="#ffffff"
android:layout_marginTop="20dip"
android:layout_below="@+id/bt3">
</Button> </RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:layout_alignParentBottom="true"
<Button android:layout_width="90dip"
android:layout_height="wrap_content"
android:textSize="20dip"
android:textColor="#ffffff"
android:layout_alignParentLeft="true"
android:background="@drawable/sett_menu_button"
android:text="@string/back"
android:layout_marginLeft="3dip"/>
</RelativeLayout>
</RelativeLayout>
View 2 Replies
View Related
Jun 28, 2010
I was wondering though how people handle being so close to the limit. My problems seem to come when I update my apps. Despite no reason for space increase when I update them I regularly lose space. Today I update a couple of apps and it pushed me over the limit, so I had to go in a find a few I don't use and remove them. That left me with supposed about 15.5mb left, but now it's gone down to 14.95, despite no apps being added, so I can see a warning coming soon. One thing I have noticed is that for some apps removing them completely, and then added them back again seems to gain you some space.
It unfortunately is just blind luck in finding ones that will happen for, or at least it seems to be so to me. Also very annoying is that the space you clear by deleting apps doesn't seem to correspond with what you get back. I just cleared supposedly 1.5mb of cache from the web browser, yet I only got 500kb of space back? Obviously I've been through all the apps and looked for any that I can clear the cache for. One thing I would like to know is why the low space warning has to come at ~15mb? Seems to be I've always got that space just wasted, which is a pain as there are plenty of 200-300kb apps I could add, using just 5mb of the space.
View 11 Replies
View Related
May 13, 2010
In my Android app, I have a tabbed Activity. In one of the tabs I have two TextViews and two EditTexts. The first EditText is only one line, and that's fine. However, I want the other EditText, android:id="@+id/paste_code", to take up the remaining space, but no matter what I do to it, it will only show one line. I don't want to manually set the number of lines, since the number that would fit on the screen differs based on your device.
Here's the relevant code. It's nested inside all the necessary components for a tabbed Activity.
<ScrollView
android:id="@+id/basicTab"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Paste title"
android:layout_weight="0" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/paste_title_hint"
android:id="@+id/paste_title"
android:lines="1"
android:gravity="top|left"
android:layout_weight="0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
adroid:text="Paste text"
android:layout_weight="0" />
<EditText
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:hint="@string/paste_hint"
android:id="@+id/paste_code"
android:gravity="top|left"
android:layout_weight="1" />
</LinearLayout>
</ScrollView>
View 2 Replies
View Related
Jul 29, 2010
I'm wondering how can I split single line text into few lines. I need it for game. I want to make it in canvas. It will be notification popup, but sometimes text is too long (I draw text canvas.drawText()), and I need to split it and draw in few lines in rows. Anyone knows a good solution? I saw methods mPaint.measureText() or TextUtils . split () , but it isn't so good in my case. Is there other method?
View 5 Replies
View Related
Sep 8, 2010
Is there any settings/flags to expand the summary text of a notification to two lines instead of 1? The text I am trying to put is too long and it goes over the visible area? Will try something like (text+"/n"+restOfText) tomorrow but I don't think it's going to work...
View 5 Replies
View Related
Nov 17, 2010
I have an Android TextView displaying some text, and it's multi-line. However, in the text, I sometimes have domain names; how can I stop the TextView from splitting the lines up on the periods in them?
Is there a Unicode non-breaking-period, for example?
View 1 Replies
View Related
Jan 8, 2013
I am wondering if there is a way to draw an image, or edit simple lines in a text box. The entire screen is a textView/ect and i would like to be able to write a sentence then draw an image and write again. By draw i think i would use the Canvas, so basically is there a way to include a canvas in a text view?
Evernote does do this, but to edit an image/draw you need to open another app "Skitch", my goal is to try and do this without any extra apps.
For example:
Hello
(canvas/editable graphical items)
World
View 3 Replies
View Related
Aug 25, 2010
I have an activity that extends ViewFactory. The activity does nothing more than act as documentation for my app, with 5 different 'views'.
Each view is placed inside a ScrollView in a TextSwitcher. The problem that I am facing is that if one of the five views has more text than the next view, there is empty scroll space.
Any ideas on how I can get rid of this space?
View 1 Replies
View Related
Oct 19, 2009
when I send text messages which are longer than one line but less than 100 characters, sometimes the other person texts back that all they see is an empty box. At first I thought it was the other persons phone but several people are telling me the same thing. This does not always happen, but often. One liners seem to have no problems. I called Rogers tech support and they give me the same aswers all the time for different problems.
1. reset the phone to factory settings(which I already did, and same thing happened)
2. If you would like we can send a replacement phone since the problem seems to be hardware related.( I doubt this, since I can send texts and other person receives them, except the times they receive an empty box)
View 1 Replies
View Related
Apr 30, 2010
When i get a text message it vibrate for literally under a second. is there a way to extend this so i cam actualpy notice it?
View 1 Replies
View Related
Sep 8, 2010
How do I get a pic i received via text to stay longer then 5 seconds? I know you can pause it. But is there a different way?
View 2 Replies
View Related
Dec 11, 2009
Can anyone tell me how to send longer video with my Hero? I have tried to shorten the image quality, but no luck yet, there has to be a way...
View 6 Replies
View Related
Sep 19, 2013
why my SMS text messages no longer appear in one thread. I'm running Android 4.2.1 and when I get a reply from a person that I sent an SMS text message to it appears separate and not in same text thread if that makes sense.
There doesn't appear to be any settings to deal with this.
View 4 Replies
View Related
Aug 1, 2010
there was any way to get the LED to flash longer after receiving a text/email/etc. It seems to only go for maybe 10 minutes after the notification is received. Also, did anyone else have any trouble setting up the email on the phone? I have tried to set it and it won't recognize my account.
View 1 Replies
View Related
Jun 8, 2012
I rooted my phone (Samsung Galaxy S Showcase i500) the other day and deleted a lot of the stock apk files, the ones that I thought I didn't need .
One of them was Voice Search (and also voice commands, if that matters). Now, my speech or voice to text in my text messaging program is not working. Whenever I press the mic icon, nothing happens. Through searching I think I've determined it's because I deleted the voice search apk?
Whenever I go to the Market to download Google Voice Search, the Market says its already "installed"...but obviously its not?! I've tried downloading the file from other places but when I try to install it says "There is a problem parsing the package."
Bottom line, how do I get my speech to text back?
View 5 Replies
View Related
Aug 20, 2012
I have a Droid HTC Inspire 4G and have always been able to text images, but I can through email. It just suddenly stopped working through texts. I get the old image can no be sent with exclamation point.
View 3 Replies
View Related
Aug 8, 2010
I was playing around with a friends original Moto Droid and due to the smaller screen size the icons are smaller and it makes the UI look cleaner. Is there any way to make the icons on the EVO smaller to "get more" space out of the screen?
View 2 Replies
View Related
Jul 27, 2010
Everyday this phone gets slower and slower...and it takes longer and longer for me to text someone..not only do i send them gibberish cause the phone lags SO BAD...it sends them so many texts of the same thing. i cant do a darn thing with this. I'm about to throw it. nothing i seem to do is making this thing run faster less leggy.
View 42 Replies
View Related
Feb 13, 2010
how much space do text messages take up? i normally send over 3500txts a month and i just got my hero a couple days ago and really just started texting and wanna know how much space it takes up and if it takes up a lot if there is any way to move them to be stored on SD
View 1 Replies
View Related
Sep 20, 2010
Suddenly the sound doesn't work for my text when I type or swype. I've turned on ALL sounds possible. (It still vibrates.) I can hear all the other sound effects and can hear the typing if I switch to Android Keyboard. But I like Swype!
View 3 Replies
View Related
Jul 23, 2012
Simply disable the text messaging app and it will no longer appear on your unlock screen. Settings, apps, all, text messaging then select disable.
View 1 Replies
View Related
Sep 24, 2010
Have the warning message "phone storage space getting low"
Have 11G of 14 on SD card, but only 25MB free on internal phone storage.
Just got a text message that wouldnt come thru, and it said 'no text message space left'.
Just uninstalled somethings that were 10MB, now giving me 35MB free but
I keep getting texts, the phone vibrates , which it wasn't set to do, and says 'text memory full'. I am assuming it is vibrating to give me a warning.
Can I clear some of the text memory, or must I clear all of it. And if so for either, how do I do this.
I have moved apps to sd card that makes sense.
How can I free up more space.
View 4 Replies
View Related
Feb 9, 2010
Searching old posts reveal that no one knows a way to get the current battery level without using intents. Is this true? There's no method to just return the current battery level?
View 4 Replies
View Related
Jun 29, 2012
I'm looking for an app that would show the battery life remaining in my notification bar (similar to battery life remaining on mac computers), I've searched and searched and searched and cannot seem to find an app that does so. I have found apps that can tell me the time remaining, just not in the top bar of my phone. I'm running a Galaxy S3 w/ ICS.
View 4 Replies
View Related
Jun 30, 2010
So, it definitely blows that this was advertised with 1 gb of ROM, and we only ended up with about 370mb of ROM. But, it is what it is. Now, I know RAM is more important when it comes to making the phone snappy and dealing with all the open apps. But, does it affect the phones performance when the phone gets low on ROM? I'm around 220mb of available ROM, which is still a good amount, but I cant help but check the file size of every app and game i download and cringe if its bigger than average. So, is there a number I should try to stay above? 150mb, 100, 50, or does it really not matter as far as the phone's responsiveness and snappiness is concerned?
View 4 Replies
View Related
Jan 1, 2010
When I first got my HTC Hero before installing any apps from the Market I checked how much memory I have. 148 mb was available, does this sound about right for you guys?? or is it quite low?
View 2 Replies
View Related
Jul 25, 2010
Doesn't the vibrant have 512M of RAM? Where is all of it going? I am using the ATK (advanced task killer) to keep background tasks at a minimum, but I only see around 100M of available memory. Is this good? It doesn't seem like a lot. Can others post them amount of available memory they have remaining?
View 14 Replies
View Related
May 26, 2010
62 hours and 24% battery still remaining. This is after my initial period of hammering on the phone and back to my normal daily usage pattern which is like a blackberry user (some phone calls in and out, lots of email, at least a few every 30 minutes during the day and early evening). What this means for me as a blackberry user is that I can now confidently switch over from blackberry to the Evo as primary phone and get through a normal day (16 hours) without needing a mid-day charge.
Here are settings from my testing experience that I wish I had known when I first got the EVO at Google I/O:
1. Add to home sense screen:
widget: Power Control Android
widget: settings, 4G
widget: settings: Hotspot
2. Install android market apps (free):
Advanced Task Killer
Spare Parts
K-9 Mail
3. Run Advanced Task Killer (some disagree, do what you want. I'll revisit and retest this when 2.2 gets released by HTC for the EVO. I don't need sprint navigation, sprint tv, etc. to ever be running since I will use google navigation. I haven't had time to do another endurance test without using ATK and I'm not planning to do another endurance test)
Deselect things you actually want to keep running in the background, e.g.:
voice dialer
voice search
google voice
calendar
k-9 mail
gmail
....
Kill selected apps
ATK will put a notification up at each boot and remember your selections so it's easy to re-kill off all the sprint and other apps you don't normally want 'running' in the background.
4. Turn off 4G and hotspot on the main page with widgets installed.
Note: I found I don't need to disable gps or bluetooth since with streamlined apps running nothing is using them unless I want it to and I want my bluetooth to automatically pickup when I get in the car.
5. Turn screen brightness to low or medium using widget icon. this disables auto brightness but the lower screen brightness seems fine for me. When outside in the sun just click it up if needed
6. Settings Wireless and Networks, Wi-Fi Settings, <menu button> Advanced, Wi-Fi sleep policy, Never.
It's a bit counterintuitive, but I've tested it out both ways and confirmed the articles that recommend this. The phone uses dramatically less power in this state as opposed to auto sleeping wi-fi which turns on the 3G radio. Dramatic as in without keeping wi-fi alive overnight my battery went from like 70% to almost nothing during earlier tests.
7. <optional> Run the battery from a full charge to completely drained once. I'm not sure if this had an effect or not, just putting it in because I did it once before this current long runtime since charge to make sure the battery was properly profiled. It's easy to do with 4G on and watching HD youtube videos.
8. K-9 versus gmail client. I'm seeing much more cpu usage from gmail client versus K-9. I have work email on a host service that supports imap idle (rackspace). The imap idle push seems to really save on cpu usage and my work email delivers as fast to the Evo as it does to my blackberry. I like the gmail client for my personal mail but may end up switching my gmail.com to deliver via K-9 instead to really save on battery. Needs more exploring but it appears the gmail client 'push' is not as efficient as the imap idle.
9. Summary, when you want to show off your 4G Youtube HD or use the phone as a mobile hotspot, just click on the 4G and away it goes. But normally keep that radio off since you don't actually need it and it's a huge power drain. With the widget installed this becomes an easy habit.
View 49 Replies
View Related