Android Tutorial on reading / writing simple files?

by superjet91 » Thu, 12 Mar 2009 10:22:32 GMT


Sponsored Links
 Does anyone know of a tutorial that explains how to do basic file
reading / writing in Android? Its hard getting back to OO programming
from matlab/perl!

All I want to do, in two parts:
1. Read a file from the SD card, and store the values into variables.
2. Read a file from a website, and store the values into variables.

Thanks for ANY help! :)

sj

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. webview in tabs

Hi! I've just started to create monodroid applications. So I'm in
trouble about my project. I want to create 2 tabs and when clicks each
open a web site. Is it possible ? Here is my code. Tabs already work
but when I click nothing happens.


[Activity(MainLauncher = true, Label = "@string/app_name", Theme =
"@android:style/Theme.NoTitleBar")]
    public class HelloTabWidget : TabActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            TabHost.TabSpec spec;     // Resusable TabSpec for each
tab
            Intent intent;            // Reusable Intent for each
tab

            // Create an Intent to launch an Activity for the tab (to
be reused)
            intent = new Intent(this, typeof(ArtistsActivity));
            intent.AddFlags(ActivityFlags.NewTask);

            // Initialize a TabSpec for each tab and add it to the
TabHost
            spec = TabHost.NewTabSpec("artists");
            spec.SetIndicator("Artists",
Resources.GetDrawable(Resource.Drawable.ic_tab_artists));
            spec.SetContent(intent);
            TabHost.AddTab(spec);

            // Do the same for the other tabs
            intent = new Intent(this, typeof(AlbumsActivity));
            intent.AddFlags(ActivityFlags.NewTask);

            spec = TabHost.NewTabSpec("albums");
            spec.SetIndicator("Albums",
Resources.GetDrawable(Resource.Drawable.ic_tab_artists));
            spec.SetContent(intent);
            TabHost.AddTab(spec);

            TabHost.CurrentTab = 1;
        }
    }

    [Activity(Label = "deneme2", MainLauncher = true)]
    public class AlbumsActivity : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            TextView textview = new TextView(this);
            textview.Text = "This is the Albums tab";
            SetContentView(textview);

        }
    }

   [Activity(Label = "deneme2", MainLauncher = true, Theme =
"@android:style/Theme.NoTitleBar")]
    public class ArtistsActivity : Activity
    {
        //int count = 1;
        WebView web_view;
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);
            web_view = new WebView(this);
            web_view = FindViewById<WebView>(Resource.Id.webview);
            web_view.Settings.JavaScriptEnabled = true;
            web_view.LoadUrl("http://www.google.com");
            web_view.SetWebViewClient(new HelloWebViewClient());

        }

        private class HelloWebViewClient : WebViewClient
        {
            public override bool ShouldOverrideUrlLoading(WebView
view, string url)
            {
                view.LoadUrl(url);
                return true;
            }
        }
    }

-- 

2. Android Source code build error "Permission error"

Dear All,
I am using ubuntu 10.10 that i have installed inside windows 7. I had
downloaded android source code. When i try to build it an error comes.

The output is
ka...@ubuntu:~/work/android$ make
/bin/bash: prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
gcc: Permission denied
/bin/bash: prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
gcc: Permission denied
/bin/bash: build/core/find-jdk-tools-jar.sh: Permission denied
============================================
PLATFORM_VERSION_CODENAME=AOSP
PLATFORM_VERSION=AOSP
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv5te
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=OPENMASTER
============================================
/bin/bash: build/tools/findleaves.py: Permission denied
/bin/bash: out/target/product/generic/clean_steps.mk: Permission
denied
/bin/bash: out/target/product/generic/clean_steps.mk: Permission
denied
/bin/bash: out/target/product/generic/previous_build_config.mk:
Permission deniedDear All,
I had do
/bin/bash: build/tools/findleaves.py: Permission denied
frameworks/policies/base/PolicyConfig.mk:22: *** No module defined for
the given PRODUCT_POLICY (android.policy_phone). Stop.

I have tried to build it from root as well but this error is still
same. I have read in some forums that modifying the /build/tools/
findleaves.sh can remove this error but this file named findleaves.sh
does not exist in my case. Kindly help to solve this problem. I will
really appreciate any of your help.

-- 

3. OOT: Listen Now Master Wu Interview di djwirya.com

4. android mapview maximum zoom level only 19

5. WT Help Inject Smart Lepas setelah Master Reset

6. aplikasi garmin

7. AlertDialog.Builder question