This is a simple example that shows how many bytes are free in your SDCard.
Inorder to run this example, you have to create an SDCard and start the emulator with the SDCard.
Now create a fresh project and name it “FreeSpaceActivity.java” and copy the following code to it.
The main.xml file
AndroidManifest file
Please leave your comments if the post was useful.
Inorder to run this example, you have to create an SDCard and start the emulator with the SDCard.
Now create a fresh project and name it “FreeSpaceActivity.java” and copy the following code to it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| package pack.coderzheaven.check_space; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.os.Environment; import android.os.StatFs; import android.widget.TextView; public class FreeSpaceActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView(R.layout.main); StatFs stat_fs = new StatFs(Environment.getExternalStorageDirectory().getPath()); double avail_sd_space = ( double )stat_fs.getAvailableBlocks() *( double )stat_fs.getBlockSize(); double GB_Available = (avail_sd_space / 1073741824 ); System.out.println( "Available GB : " + GB_Available); TextView tv = (TextView)findViewById(R.id.tv); tv.setText( "Your SD Card is " + GB_Available + " bytes free." ); tv.setTextColor(Color.GREEN); tv.setTextSize( 20 ); } } |
1
2
3
4
5
6
7
8
9
10
11
12
13
| <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:orientation = "vertical" android:layout_width = "fill_parent" android:layout_height = "fill_parent" > < TextView android:layout_width = "fill_parent" android:layout_height = "wrap_content" android:text = "" android:id = "@+id/tv" /> </ LinearLayout > |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| <? xml version = "1.0" encoding = "utf-8" ?> < manifest xmlns:android = "http://schemas.android.com/apk/res/android" package = "pack.coderzheaven.check_space" android:versionCode = "1" android:versionName = "1.0" > < application android:icon = "@drawable/icon" android:label = "@string/app_name" > < activity android:name = ".FreeSpaceActivity" android:label = "@string/app_name" > < intent-filter > < action android:name = "android.intent.action.MAIN" /> < category android:name = "android.intent.category.LAUNCHER" /> </ intent-filter > </ activity > </ application > </ manifest > |
Hey, such a useful piece of information you are sharing here. Since a long time, I was badly in search of this information. Thanks for sharing it, dude. Also, I would like to share the information in my blog as well, so that, my visitors will also get such wonderful information.
ReplyDeleteXamarin Developers in Frisco | Hire Xamarin Developer
I must say, this is really an awesome post which you have shared in a simple and easy to grasp way. Surely I will share it in my post as we, to deliver the wonderful and well-researched information to my visitors too.
ReplyDeleteonline ordering system for restaurants
Restaurant Website Ordering System
Online Ordering Restaurant POS System
best digital marketing service in Durgapur
ReplyDeleteUsually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job,Keep it up.
ReplyDeleteTry Our Love Spells Removal In Toronto Services and Get All the benefits of it in your life, we make All your Personal problems solved in just minutes.
ReplyDeleteWe are dealing in wide range of spy cameras of topmost quality on lowest prices. Contact us at +91 9999332499 Spy Camera in Delhi
Thanks for sharing such a amazing post
ReplyDeleteSearch and Rescue Equipment
Hey, good day
ReplyDeleteThanks for sharing such valuable information.i want more these type of informatiove blogs, really
seo mississauga
Amazing post..Thanks for sharing.
ReplyDeleteBuy property online india
Buy Farm Fresh seasonal Mango Fruits online at best price. Send Mangoes to all Pakistan like Karachi, Lahore, Islamabad, Rawalpindi, Peshawar, Multan, Faisalabad, Hyderabad and Jhelum on door step fruitoyepk.
ReplyDeletepublic static float megabytesAvailable(File f) {
ReplyDeleteStatFs stat = new StatFs(f.getPath());
long bytesAvailable = 0;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2)
bytesAvailable = (long) stat.getBlockSizeLong() * (long) stat.getAvailableBlocksLong();
else
bytesAvailable = (long) stat.getBlockSize() * (long) stat.getAvailableBlocks();
return bytesAvailable / (1024.f * 1024.f);
}
Custom Cosmetic Boxes
I find this post very accurate and informative. One topic that always interests me is Web Hosting in Lahore. So when I came across this post, I was excited to find out more about it and I am glad I did.
ReplyDeletemovers and packers in dubai | noorahmedtransports Noor Ahmad Transport is a Mover and Packer service provider in Dubai Marina. Pickup Truck Rental Dubai 1/3 Ton - 7/10 Ton Truck with Tail Lift. Home/Office Shifting, Man with van service in Dubai. Call: 050 651 2943
ReplyDeleteThe reasons comprise infective contagion, viral infection and, less typically, chemical irritation. Treatment normally includes antibiotics, painkillers and anti-inflammatory treatment. Full retrieval can take place in just a few days. Early Analysis of Epididymitis means early Epididymitis cure. Make sure you get a remedial diagnosis and Natural Remedies for Epididymitis.
ReplyDeletePeyronie's disease is where plaques (segments of flat scar tissue) form under the skin of the penis. These plaques can cause the penis to bend or become indented during erections. The plaques can often be felt through the skin and can be painful, use Natural Treatments for Peyronie's Disease relief a painful disorder.
ReplyDeleteHerbs Solutions by Nature offer Herbal Supplement for Health and Skin Diseases. Natural Herbal Treatment really does help you recover from your health condition.
ReplyDeleteNatural Treatment for Granuloma Annulare that can help manages this condition naturally. Herbal Supplement can decrease itching and the occurrence of skin lesions.
ReplyDeleteBuy Herbal Product for Benign Essential Tremor to treat the voice, head, jaw, lips, and face. Herbal Supplement really takes hold and treats the condition naturally.
ReplyDeleteWe have mentioned some information about each diet plan at the beginning of each diet plan for which you will have to click the diet plan you want more information. You will first find some information on the diet plan and then the healthy diet charts will appear day-wise or week wise. Hope it is of some help to you all! Team “Natural Health News” Healthy Diet Charts Department.
ReplyDeleteNatural Treatment for Actinic Keratosis is to prevent the lesions from turning into skin cancers. Herbal Supplement used to treat or reduce the symptoms.
ReplyDeleteA hydrocele is an uncomfortable testicle problem that inconveniences males. In hydrocele, liquid gathers in the scrotum (sac around the testicles). Herbal Products for Hydrocele helps in testicle condition of the collection of liquid in the scrotum, by applying Natural treatment gets assistance from inflamed and seems extended and assist in How to hydrocele treat At Home.
ReplyDeleteThis avocado is probably a good Herbal Supplement for Granuloma Annulare because that works on granuloma annulare which is packed with vitamin E. You can also take a daily tablespoon of apple cider vinegar verbally or apply it to your skin as they are a Granuloma Annulare Natural Treatment. Coconut oil absorbs into the skin and penetrates very effectively - Granuloma Annulare Coconut Oil will help relieve any itching and inflammation from your rash.
ReplyDeleteNatural Treatment for Granuloma Annulare that can help manages this condition naturally. Herbal Supplement can decrease itching and the occurrence of skin lesions.
ReplyDeleteYou should drink green tea on a regular basis because this can effective in the Natural Remedies for Granuloma Annulare natural recovery. There is another way to use green tea and that is to apply the green tea bags to your skin directly. Green Tea has anti-inflammatory and antioxidant properties which can help in the healing process.
ReplyDeleteNatural Remedies for Peyronie's Disease aid in the removal of scar tissue caused by Peyronie's Disease, as well as provide relief from penile discomfort. Herbal Supplement for Peyronie's Disease is acceptable and maybe a feasible scar therapy (of the skin). Herbs Solutions by Nature provides the most up-to-date Peyronie's infection treatment options.
ReplyDeleteHerbal Supplement for Health and Skin Diseas to help improve the appearanceHome Remedies for Granuloma Annulare, grape seed extract is one of my favorite ingredients. In medical science, grape seed extractNatural Remedies for Granuloma Annulare is Vitamin E oil.— Herbal Supplement for Granuloma Annulare which may help explainHerbal Remedies for Granuloma Annulare for soothing your skin and reducing inflammation.
ReplyDeleteHerbal Supplement for Actinic Keratosis is highly recommended to all people suffering from these diseases as they offer positive results at an affordable price. Herbal Remedies for Actinic Keratosis, It immediately reduced redness.The extract of olive leaf has been used for thousands of years to treat various skin conditions. Herbal Remedies for Actinic Keratosis, It immediately reduced redness.
ReplyDeleteThe typical symptom of Hydrocele is enlargement or swelling around a testicle.The Natural Remedies for Hydrocele involves surgery to correct any anatomical defect in your child’s scrotum. These additional Herbal Remedies for Hydrocele include herbal medicine like Celdeton Hydrocele.Natural Cure Zone strongly recommends that you consult with your primary healthcare provider before starting any Herbal Supplements.Herbal Supplement for Hydrocele can be treated naturally with herbal supplements.
ReplyDeleteWhen it comes to Natural Treatment for Granuloma Annulare, nothing beats garlic. It’s a potent antibacterial agent that can stop symptoms like itching and burning almost instantly. Due to its anti-fungal properties, wormwood can be used as a Natural Remedies for Granuloma Annulare.Anecdotal evidence indicates that taking ginger root can be used as a Granuloma Annulare Natural Treatment.One natural treatment option for granuloma annulare is aloe vera extract. This topical Herbal Supplement for Granuloma Annulare is available in gel or ointment form.
ReplyDeleteEmphysema is a disease that makes breathing very difficult. It damages your lungs, so they cannot get as much oxygen in and out of your body. It can be excruciating to live when you have emphysema. Hysmeton is an Herbal Supplement for Emphysema to help with symptoms of emphysema and asthma.There are many different symptoms of emphysema. It is often a silent killer because people with severe emphysema may not have any symptoms.
ReplyDeleteAll of that the Natural Remedies for Abdominal Adhesions is the best option to cure from that type of diseases.But first of all must try Herbal Supplement for Abdominal Adhesions,Abdominal adhesions should be treated as soon as possible after being diagnosed with the problem. An herbal pill called sedeton is the best Alternative Treatment for Abdominal Adhesions for it. The pill from Herbs Solutions By Nature is free of any artificial chemicals. It is made up of a combination of well-researched, helpful herbs that have been mixed together to provide the finest Natural Treatment for Abdominal Adhesions.
ReplyDeleteGinger is used as Natural Remedies for Abdominal Adhesions,Turmeric is a well-known herb and Natural Treatment for Abdominal Adhesions discomfort, which can be caused by a variety of factors.It has antispasmodic, cardioprotective, and heart muscle strengthening effects, and it is also Alternative Treatment for Abdominal Adhesions.Herbal Supplement for Abdominal Adhesions, you should seek medical attention.
ReplyDeleteAfter being diagnosed with the problem, Natural Treatment for Abdominal Adhesions should be started right away. Sedeton, a herbal supplement, is the best treatment for it.But if you are afeared from surgical treatment then must try Herbal Supplement for Abdominal Adhesions.. It's also been shown to help regulate bowel motions and ease stomach pains and cramps, which are signs of partial intestinal obstruction caused by abdominal adhesions. Follow the instructions on the package for the most effective Alternative Treatment for Abdominal Adhesions.
ReplyDelete