Showing posts with label notepad. Show all posts
Showing posts with label notepad. Show all posts

Thursday, October 31, 2013

NotePad

In this post, you will learn to create a simple NotePad app for Android. The NotePad app can be used to view files that contain text inside. These files can be txt, html, xml, and java files. You can open the app and then browse for a file to open or alternatively you can select a file from Android to open. The current document can be edited and saved. The user can create a new file by clicking the new document icon from the action bar. The new file will be stored in the notes directory of external card of the device.

NotePad for Android


To start developing the NotePad app, now you need to create a new project. The project name will be NotePad. There are two activities in this app. The first one is the MainActivity that firstly runs when the NotePad opens. This activity represents the interface that allows the user to select a file to open.

NotePad browse for file


This MainActivity will list files and folders in the external card of the device. Below is the content of the activity_main.xml file. In this file, one ListView component is defined. The ListView will display the list of files and folders for selection.

activity_main.xml file

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <ListView
            android:id="@+id/files_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingBottom="5dp"
            android:paddingTop="5dp"
     
            />

</RelativeLayout>


Each row or item of the ListView displays both image and text. The image will be the file icon image or directory image. Thus it must be customized to work in this way. When customizing the ListView, as i mentioned in the previous posts, you need to define the layout file of the list and the data source of the list. Here is the content of the listlayout.xml file of the list.

listlayout file

<?xml version="1.0" encoding="utf-8"?>
<!--  Single List Item Design -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="5dip" >

<ImageView
    android:id="@+id/icon"
    android:layout_width="30dp"
    android:layout_height="30dp"
    android:padding="5sp"
    android:contentDescription="icon_image"
 />

<TextView
    android:id="@+id/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="10sp"
        android:textSize="20sp"
        android:textColor="#0000ff"
        android:textStyle="bold" >
</TextView>
</LinearLayout>


The data source of the list will be an instance of the class that extends the ArrayAdapter class. I call it ListAdapterModel class. You can download the ListAdapterModel.java file from here.
To get explanation about customizing the data source of the ListView, you might want to read the File Chooser post.

When a file is selected from the list, another activity will open and the content of the file is shown there. The data to be sent from the MainActity of the second activity (NoteActivity) is the full path of the file. The openNoteActivity method of the MainActivity class will be called to send the path file to the NoteActivity. Click the MainActivity to download the MainActivity.java file.
On the NoteActivity, you will see the content of the selected file. The EditText component is used to display the file content and allow the user to edit the content. Below is the layout file of the NoteActivity.

activity_note.xml file

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"  
    android:background="#dfdfdf"    
     >

 <EditText
     android:id="@+id/txt_view"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:scrollbars="vertical"  
     android:textColor="#000000"
     android:gravity="top"
     android:inputType="text"
     android:textSize="16sp" />

</RelativeLayout>

You can download the NoteActivity.java file from here. The NoteActivity has an action bar. To support the old Android versions, the NotePad app uses the SherlockActionBar library to set up the action bar. You might want to read TexViewer to learn how to import this library in to your project. On the action bar, there are four items. The first item represented by the new document icon will be clicked to call the createNew method so that a new blank document will open. The second item allows you to save the edited document by calling the saveWork document. The third and forth items allow you to zoom in or zoom out the content of the current document by calling the zoomin and zoomout methods.. The items of the action bar are defined in the note.xml file that is stored in the menu folder of the project.

note.xml file

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/Theme.Sherlock"
    >
 
    <item
        android:id="@+id/newitem"
        android:icon="@drawable/new_icon"
        android:title="new"
        android:showAsAction="always"
        style="@style/Theme.Sherlock"
     
    />
    <item
        android:id="@+id/saveitem"
        android:title="save"
        android:showAsAction="always"
        android:icon="@drawable/save_icon"
        style="@style/Theme.Sherlock"
    />
    <item
        android:id="@+id/zoomin"
        android:title="zoomin"
        android:showAsAction="always"
        android:icon="@drawable/zoomin"
        style="@style/Theme.Sherlock"
    />

    <item
        android:id="@+id/zoomout"
        android:title="zoomout"
        android:showAsAction="always"
        android:icon="@drawable/zoomout"
        style="@style/Theme.Sherlock"
    />

</menu>

Before running the NotePad app, you need to edit the AndroidManifest file of the project to allow the app to use the external sdcard and to register the app in the list of avaiable apps to open the selected file. Here is the content of the AndroidManifest.xml file.

AndroidManifest.xml file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.notepad"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/note_icon"
        android:label="@string/app_name"
        android:theme="@style/Theme.Sherlock.Light.DarkActionBar" >
        <activity
            android:name="com.example.notepad.MainActivity"
            android:configChanges="orientation"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.intent.action.PICK" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="file" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.txt" />
                <data android:host="*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="file" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.rtf" />
                <data android:host="*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="file" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.java" />
                <data android:host="*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="file" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.xml" />
                <data android:host="*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="file" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.html" />
                <data android:host="*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.PICK" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="file" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.txt" />
                <data android:host="*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.PICK" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="file" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.rtf" />
                <data android:host="*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.PICK" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="file" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.java" />
                <data android:host="*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.PICK" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="file" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.xml" />
                <data android:host="*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.PICK" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="file" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.html" />
                <data android:host="*" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.example.notepad.NoteActivity"
            android:label="@string/title_activity_note"
            android:configChanges="orientation"
            android:parentActivityName="MainActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="MainActivity" />
        </activity>
    </application>

</manifest>


Download the apk file of the NotePad app

Saturday, December 3, 2011

ColorNote Notepad Notes v3.6.6 - Download APK

ColorNote Notepad Notes v3.6.6
ColorNote Notepad Notes v3.6.6


Description

Color Note is a notepad app which give you a better note editing experience.

Color Note is a simple notepad app. It give you a quick and simple notepad editing experience when you write notes, memo, email, message, shopping list and todo list. Color Note makes taking a note easier than any other notepad and memo apps.

**Notice**
If you cannot find widget, please read below FAQ. It is not a bug.

**Features**
-Organize notes by color
-Sticky Note Widget
-Checklist for ToDo & Shopping list
-Organize your schedule in calendar
-Protect your notes by passcode
Password Lock note
-Secured backup notes to sd storage
-Supports online back up and sync. You can sync notes between phone and tablet.
-Reminder on status bar
-List/Grid View
-Search notes
-Notepad supports ColorDict Add-On
-Powerful Reminder : Time Alarm, All day, Repetition.(lunar calendar)
-Quick memo / notes
-Wiki link : [[Title]]
-Share notes via SMS, email, twitter
-Use color to categorize notes.

** Online backup and sync cloud service **
-Notes will be encrypted before uploading using the AES standard, which is the same encryption standard used by banks to secure customer data.
-It does not send any of your notes to server without your signing up.

*** About Permissions ***
-Internet Access : For online backup & sync
-Modify/delete SD card contents : For backup to sdcard
-Prevent phone from sleeping, control vibrator, automatically start at boot : For reminder

**FAQ**
Q : How do you put sticky notes on the home screen?
A : Goto home screen and long press empty space and choose widget, Color Note will be there for sticking on page.

Q : How come the widget and the alarm and remider functions don't work?
A : If the app is installed on the SD card, your widget, reminder and etc. will not work properly because Android doesn't support them! If you have already moved app to SD card, but you want those features, you have to move it back to device and reboot you phone.

Settings - Applications - Manage Applications - ColorNote - Move to Device

Q : Where is backed up notes data at sdcard?
A : /data/colornote on sdcard

Q : I had to reinstall color notes notepad and there is an automatic backed up notes data that was stored but it requires a password and I hadn't set one up in the past. How do I retrieve that information?
A : Try default password '0000' (numbers)

Q: I forgot my master password, how can I change it?
A: Menu -> Settings -> Master Password -> Menu Button-> Clear Password. You will lose current locked notes when you clear password!

** Product Description **
Color Note notepad features two basic note taking formats, a lined-paper styled text option and a traditional checklist option. Add as many as you want to your master list, which appears on the app's home screen each time the program opens. This list may be viewed in traditional ascending order, in a grid format, or by the color of the note.

- Taking a Note -
Serving as a simple word processing program, the text option allows for as many characters as you're willing to type with your device's virtual or physical keyboard. Once saved, you can edit, share, set a reminder, check off or delete the note through your device's menu button. When checking off a text note, the app places a slash through the list's title, a mark that shows on the main menu.

- Making a ToDo List -
In the checklist mode, you can add as many items as you'd like and move their order around with the up and down buttons activated in the edit mode. After the list is finished and saved, you may check, and uncheck, each line on your list (from grocery store items to household chores) with a quick tap that generates a line slash. If all items have been checked, the list's title is slashed as well.

When you're finished using the notepad, an automatic save command preserves your individual note before returning you to Color Note's home screen.