Hello All,

Im new to Android.
Trying to run the 'notepad' application on my local system (building
using ANT)

Getting following errors... tried by best to sort this prob .. but
unable to

for the SimpleCursorAdapter symbol found error .. i even imported the
base class file i.e 'import android.widget.CursorAdapter' ... but
still the same error.

Source code is listed below...

kindly help me out...thanks in advance.


-----------------------------------------------------------------------------------------
[javac] /home/vikram/java-android/android-sdk/vik-apps/devGuide/
Notepadv1/src/com/tutorials /Notepadv1.java:69: cannot find symbol

    [javac] symbol  : class SimpleCursorAdapter
-----------------------------------------------------------------------------------------
 [javac] /home/vikram/java-android/android-sdk/vik-apps/devGuide/
Notepadv1/src/com/tutorials/Notepadv1.java:37: cannot find symbol
    [javac] symbol  : variable menu_insert
    [javac] location: class com.tutorials.R.string
    [javac]         menu.add(0, INSERT_ID, 0, R.string.menu_insert);
-----------------------------------------------------------------------------------------



Notepadv1.java file
============

package apt.tutorials;

import com.tutorials.R;
import android.app.*;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase;
import android.widget.CursorAdapter;



public class Notepadv1 extends ListActivity {
        private int mNoteNumber = 1;
        private NotesDbAdapter mDbHelper;
   public static final int INSERT_ID = Menu.FIRST;


    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mDbHelper = new NotesDbAdapter(this);
        mDbHelper.open();
        fillData();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        boolean result = super.onCreateOptionsMenu(menu);
        menu.add(0, INSERT_ID, 0, R.string.menu_insert);
        return result;
    }

    @Override
   public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case INSERT_ID:
            createNote();
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    private void createNote() {
        String noteName = "Note " + mNoteNumber++;
        mDbHelper.createNote(noteName, "");
        fillData();
    }

        // Binding the layout text field to the Database Cursor

                            private void fillData() {
                                // Get all of the notes from the
database and create the item list
                                Cursor c = mDbHelper.fetchAllNotes();
                                startManagingCursor(c);

                                String[] from = new String[]
{ NotesDbAdapter.KEY_TITLE };
                                int[] to = new int[] { R.id.text1 };

                                // Now create an array adapter and set
it to display using our row
                                SimpleCursorAdapter notes = new
SimpleCursorAdapter(this, R.layout.notes_row, c, from, to);
                                setListAdapter(notes);
                            }
}


-------------------------------------------------------------------------

res/layout/main.xml
====================

<?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"
    >
 <ListView android:id="@android:id/list"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

  <TextView android:id="@android:id/empty"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/no_notes"/>
</LinearLayout>


----------------------------------------------------------------------
notes_row.xml
=============
<?xml version="1.0" encoding="utf-8"?>
<TextView android:id="@+id/text1"
    xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to