Android :: SD Card - How To Detect Remaining Space?
May 8, 2009Is there any way to detect remaining space on the sdcard through the API? I prefer not to make native or shell calls.
View 4 RepliesIs there any way to detect remaining space on the sdcard through the API? I prefer not to make native or shell calls.
View 4 RepliesI 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.
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>
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.
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>
I have ported android successfully on imx31 pdk board, when I go in android menu in music , it is not able to detect SD card placed in board, significantly I haven't seen any device like "/dev/mmcxxx" in /dev under android shell , if there are pointers to this issue it would be a great help for me.
View 4 Replies View RelatedI am new to android and I got myself a Micromax A110 running on android ics with 2 gb of internal SD card memory the internal memory just isn't enough for installing heavy games and storing and downloading large videos and music, so I added a 32 gb external micro SD card.. the card shows in my file manager and its contents are accessible, most apps like ttpod, ttorrent, vlc, chrome etc don't detect my external card. They only access the contents of my internal SD card, download to it.. I can't set the default directory to the external card...
When I installed nfs most wanted to my phone, it asked me to free up data in my SD card or insert another one as there was no space left due to obvious reasons of my internal SD card being filled with other apps.. I uninstalled and reinstalled it after setting the default storage location to the external storage... I found that the game installed in the internal storage this time and on startup, it gave the same message..
Is it a common problem or a limitation to the OS? Does my phone needs to be rooted for the purpose?
is it possible to check, how much free space is available in android sd card through android programming..... i am storing some images in sd card but before that want to check how much free space is available.....
View 1 Replies View RelatedWhat is an effective way to determine how much free space is on the SD card?
View 3 Replies View RelatedI have installed navigon as I use it on a standalone device. Problem its though, during the download of map and sound data it had an error as I didn't have enough space on my memory card.The program works but I do not have the UK maps. I have tried reinstalling the app but it still will not get the missing maps.Does anyone know where the program itself installs so I can completely remove it and get the maps again?There is a folder on the SD card but nothing in there about the actual application other than the map and sound folders.
View 3 Replies View RelatedI want to fetch the IMSI number so that I could keep it in memory and detect whenever SIM card changes. Is it actually possible? Is there anyone who can guide me a bit?
View 4 Replies View RelatedI recently bought a a second-hand Magic, nothing wrong with it but it won't detect my SD card! I plug it in, but nothing happens!
What's wrong with it?!
I can't take pictures, listen to music or watch my videos!
Apps amount limited by sd card size or number of pages for apps?
View 1 Replies View RelatedMy application allow to download files and store them on the external card. To avoid filling it, I've implemented a safety check so it prevents downloading when the free space is less than 20MB. The computation of the free space is done by:
public synchronized long getFreeSpace() { if (statFs == null) { statFs = new StatFs(getExternalStorageDirectory().getAbsolutePath()); }
return statFs.getAvailableBlocks() * statFs.getBlockSize(); }
which I presume is correct. In fact, it works in all my tests and for what I can say for the 99% of users. But a single user notified me that my app is constantly giving the "card full" message, as if the above method didn't work. He also told me that the problem went away after a while, and returned after upgrading a new release of my app. The user seems an advanced one, and I think he's able to check and correctly manage the contents of his external card. He reported that the card has more than 1.4GB free on the card. Are you aware of any specific issue or bug? The smartphone of the user is a Dell Streak with Android 1.6.
I did a few searches and couldn't find anything, so I decided to be lazy and start a new post on this. Has anyone found an application that will move all applications to the SD card to save phone space and speed everything else up?
View 16 Replies View RelatedHow do I check to see how much MB or GB is left on the android device ? I am using JAVA and android SDK 2.0.1.
Is there any system service that would expose something like this?
I have read and read and read. I want to take the leap soon. I hear it goes fast but I want to set aside am entire evening or afternoon. How much space so I need to have on my SD card? Mine is almost full. Which means I'll probably get a bigger one soon. I want more music.
View 4 Replies View RelatedToday my phone (Galaxy S Blaze) randomly could not detect my sim card. I checked it to see if it had moved out of place and I restarted the phone but to no fix. I know that the sim card is working because I tried it in a friend's Galaxy S 4G and it worked fine. I tried to hold the sim against the contacts to see if it wasn't making contact but it still didn't work.
View 1 Replies View RelatedGot an error saying that my SD card storage was low on space...So I started removing some pictures, and uninstalling some older apps that I don't use...and not a single mb of storage has freed up.
View 1 Replies View RelatedI am using SGS2 i9100g.
I have flashed from CM10.0, JB4.1.2 to pacman 3.00, JB4.2.2
ISSUES:
1. error mounting emmc and cannot detect external sd card
2. When i want to use camera or gallery, there is an error saying "No external storage available"
Attempted solutions:
I have tried the following but it does not solve my problem
1. re-flash the custom rom and gapps. (full wipe with wipe cache and dalvik cache)
2. reformatted my sd card to fat32.
3. went to recovery to unmount and remount my external sd card
4. tried to mount emmc in recovery but returns an error "error mounting emmc"
5. off and on and also rebooted my smartphone
6. tried these codes shown at the bottom(to manual remount)
- I have a storage folder which has sdcard0 which contains nothing, sdcard1 which contains my file in my external sd card and a usbdisk0 contains nothing also.
- Now i am not sure which is the cause of the problem where i cannot use my camera phone and gallery
Does it make the phone more laggy? Because I've used about 7GB of my 8GB, and was wondering would it speed up my phone as its become a bit lagggy at time. I was planning to take about 4GB away of music but I really don't want to. Just seeing if it would be worth it?
View 1 Replies View RelatedWhen nandroid does a back-up, it does not error out or warn if the card runs out of space. It will go through all of the back up steps and even produce an MD5 parity check, but it is checking the file created- NOT the actual targeted files as part of its verification process (only the parity of the final file created). I discovered this (almost) the hard way, but noticed that my card showed zero space. The back-up should have been about 850mb, but was 395mb. I removed some files from my sd card and repeated the process and then did a titanium back up of apps.
Shortly after backing up, I tried to install the King #2 kernel and my Inc got stuck in a boot loop. Had I not caught the Nandroid back-up issue, I would have been in a rough situation. The sad thing is I have a 32gb card, but is loaded with PSX games, other game roms and MP3's. Even without this stuff and a smaller card, several nandroid back-ups can accumulate and take up more space than you expect. added: I am not sure if Titanium also does not verify the targeted files after a back-up. In summary: Check you card for space before backing up stuff!
Low on space icon is up top the phone but I have a 16gb sd and says 15,268mb available but phone memory only 12mb available. Why isn't phone using the SD or do I have to enable something to make it use the card.
View 2 Replies View RelatedI am trying to download a ringtone onto my phone (which apparently gets downloaded to my sd card under download) but its saying I have no available space. Its a 2 gig mem card and i have 1.7 gigs left on it thats completely free. And my phone has 99mb of internal memory free. So a few hundred kb ringtone should not be saying this.
View 2 Replies View RelatedI have a 4fb SD card fitted yet I keep getting a message saying I'm running low on phone storage space. Can I manage this on the SD card?
View 4 Replies View RelatedI was running apps2sd them upgraded to xrtrom 4.2 with cach2cach. So i was wondering how do i remove all the apps saved on my sd card so that i can free up that space.
View 1 Replies View RelatedI have an issues and hopefully somebody can help. Ok I have an Evo and it wont read SD cards. Whne I put in an SD card the option to mount or format the card are grayed out and it shows not available space as if there is no card in there.
So I figure its a bad slot so I take it to a close by repair center and the guy lets me try a card he had in another android phone (hero I think) and it it was recognized by my phone. So I go it must be that my card bad.
I go home and put the card in my laptop and format it and it formats fine. When I put it in the Evo still not recognized. I put the card in my PS3, it's recognized so I format it there too. I put it in the Evo still not recognized.
I can't be the slot in my evo cause I put the guys card in myself, turned it on myself and saw for myself that it recognized the card. Anybody know whats up with this? I have official 2.2 but this was going on BEFORE I updated to froyo. Can anybody help?
So I rooted my phone, did a nanodroid back-up, and added a custom Rom. At first I flashed MoCaDo onto the phone but I had a lot of force closes. So I flashed Fresh .5 over MocaDo 1.1 and the force closes stop. The phone feels a lot zipper. I have WiFi tether. Spare parts is great. Now how do I move apps to the sd card to free up more space?
View 5 Replies View RelatedI'm not very familiar with Android OS, I recently purchased a NOBIS 9, 1.5GHz Cortex A9 Dual-Core processor, 1GB DDR2 of system memory, and 8GB of internal storage running on Android 4.1. So far I have only downloaded and installed exactly 7 apps from Google Play and all my pictures and videos are in my SD card and I suddenly have no storage room. When I go to settings/storage, I see that there are 2 partitions to the tablet's storage both named INTERNAL STORAGE. Apparently all the apps are being installed in one of the partitions, the one with only 661 MB of space. I was able to go into the APPS setting and move 4 off the apps to the SD card, but the rest of the apps do show the MOVE TO SD CARD option but are not allowing me to press it.
Is there any way to somehow move the apps to the other partition or the SD card? Or is there a setting that I can change to allow all new apps to be installed in the SD card?
Alright.. I had a Motoq9M for a couple of years.. and such a bad experience.. I was skeptical about EVER buying another motorola again.. Alas.. I refuse to give up my verizon coverage.. and bought a Droid.. aand Im ALMOST hopeless with some of this stuff. The first week everything worked great, then as I started adding apps, things have gotten hinky.
Problem 1:
I set up a "lock pattern" and my screen's timeout time is 30sec. Whenever I'd make a call even after I'd unlock it.. or I've answered the phone and unlocked it.. literally 2-3 secs later.. the phone would blackout and lock again.. WTF? soo.. i disabled the lock option.. problem solved.. but now I don't want to re-lock it if it's going to bug up again.
Problem 2:
I seem to have an unremovable facebook app... can't delete it from settings, and I can't delete it with an un-install app it doesn't even show up to look at in app management in settings.. uhh Help.. because
I USED to be able to go to a friends photos, and choose the "set as" option as a contact photo or a wallpaper.. it started to only do it once in a while .. and now I can't do it at all.. I REALLY want that ability back.
Problem 3:
half the time I go into my task killer, and apps I've never even touched to activate are randomly running in the background.. and when i go to look at my SD card space availability and its says unavailable..