The answer is in the last post here:
http://groups.google.com/group/android-beginners/browse_thread/thread/affc088e8843feb5

Since there can be several emulators open at a time, you also have to
open the "devices" list, and click on your emulator to activate the
logcat output.

Peli

On Oct 13, 10:25 am, JavaAndroid <[EMAIL PROTECTED]> wrote:
> Hi Peli,
> Thanks for ur Valuable response. I m not aware of this logcat tab in
> eclipse. Is that present in any Window??
>
> Thanks
> JavaAndroid
>
> On Oct 13, 12:42 pm, Peli <[EMAIL PROTECTED]> wrote:
>
> > You have to use logcat to see the debugging statements.
>
> > Either from Eclipse open the logcat tab and choose the device from the
> > devices list.
> > Or in a shell enter "adb logcat".
>
> > Peliwww.openintents.org
>
> > On Oct 13, 2:49 am, JavaAndroid <[EMAIL PROTECTED]> wrote:
>
> > > Hi All,
> > > I m a novice in Google Android.. Just started with couple of tutorials
> > > present in Google Android Documentation page.
> > > I have modified the NotePad application present there. I have four
> > > textfields namely, employeeName,employeeAge,
> > > employeeQualification, employeeDept.
> > > I could insert a new record and delete an existing record, but i m
> > > facing problem in editing an existing record. When i click a record it
> > > says, the Application EmployeeInformation has stopped unexpectedly.
> > > Here is my EmployeeInfo class
> > > package com.dreamapp.employeeinfo.activity;
>
> > > import android.app.ListActivity;
> > > import android.content.Intent;
> > > import android.database.Cursor;
> > > import android.os.Bundle;
> > > import android.util.Log;
> > > import android.view.Menu;
> > > import android.view.MenuItem;
> > > import android.view.View;
> > > import android.widget.ListView;
> > > import android.widget.SimpleCursorAdapter;
>
> > > import com.dreamapp.employeeinfo.util.EmployeeDAO;
>
> > > public class EmployeeInfo extends ListActivity {
> > >        private static final int ACTIVITY_CREATE =0;
> > >        private static final int ACTIVITY_EDIT =1;
>
> > >        private static final int INSERT_ID = Menu.FIRST;
> > >        private static final int DELETE_ID = Menu.FIRST+1;
>
> > >        private EmployeeDAO employee;
> > >        private Cursor mCursor;
>
> > >        private static final String TAG="EmployeeInfo";
> > >    /** Called when the activity is first created. */
> > >   [EMAIL PROTECTED]
> > >    public void onCreate(Bundle savedInstanceState) {
> > >        super.onCreate(savedInstanceState);
> > >        setContentView(R.layout.employee_list);
> > >        employee = new EmployeeDAO(this);
> > >        employee.open();
> > >        fillData();
> > >    }
>
> > >    public void fillData(){
> > >        mCursor = employee.fetchAllEmployeeInformation();
> > >        startManagingCursor(mCursor);
>
> > >        String[] from = new String[] {EmployeeDAO.EMP_NAME};
>
> > >        int[] to = new int[] {R.id.text1};
> > >        SimpleCursorAdapter employeeList =
> > >                new SimpleCursorAdapter(this, R.layout.employee_row,
> > > mCursor,from, to);
> > >        setListAdapter(employeeList);
> > >    }
>
> > >    public boolean onCreateOptionsMenu(Menu menu){
> > >        super.onCreateOptionsMenu(menu);
> > >        menu.add(0, INSERT_ID, 0, R.string.menu_insert);
> > >        menu.add(0, DELETE_ID, 0, R.string.menu_delete);
> > >        return true;
> > >    }
>
> > >    public boolean onMenuItemSelected(int featureId, MenuItem item){
> > >        switch(item.getItemId()){
> > >        case INSERT_ID:
> > >                insertEmployeeInformation();
> > >                return true;
> > >        case DELETE_ID:
> > >                employee.deleteEmployeenformation(getListView().
> > >                                 getSelectedItemId());
> > >                fillData();
> > >                return true;
> > >        }
> > >        return super.onMenuItemSelected(featureId, item);
> > >    }
>
> > >    public void insertEmployeeInformation(){
> > >        Intent i = new Intent(this,EmployeeEdit.class);
> > >        startActivityForResult(i, ACTIVITY_CREATE);
> > >    }
>
> > >    protected void onListItemClick(ListView l, View v, int position,
> > > long id){
> > >        super.onListItemClick(l, v, position, id);
> > >        Cursor c = mCursor;
> > >        Log.w(TAG, "Position in the List "+position);
> > >        c.moveToPosition(position);
> > >        Intent i = new Intent(this,EmployeeEdit.class);
> > >        i.putExtra(EmployeeDAO.KEY_ROW_ID, id);
> > >        i.putExtra(EmployeeDAO.EMP_NAME, c.getString(
>
> > > c.getColumnIndexOrThrow(EmployeeDAO.EMP_NAME)));
> > >        i.putExtra(EmployeeDAO.EMP_AGE, id);
> > >        i.putExtra(EmployeeDAO.EMP_QUALIFICATION, c.getInt(
>
> > > c.getColumnIndexOrThrow(EmployeeDAO.EMP_QUALIFICATION)));
> > >        i.putExtra(EmployeeDAO.EMP_QUALIFICATION, c.getString(
>
> > > c.getColumnIndexOrThrow(EmployeeDAO.EMP_QUALIFICATION)));
> > >        i.putExtra(EmployeeDAO.EMP_DEPT, c.getString(
>
> > > c.getColumnIndexOrThrow(EmployeeDAO.EMP_DEPT)));
> > >        startActivityForResult(i, ACTIVITY_EDIT);
> > >    }
>
> > >    protected void onActivityResult(int requestCode, int resultCode,
> > >                           Intent intent){
> > >        super.onActivityResult(requestCode, resultCode, intent);
> > >        Bundle extras = intent.getExtras();
> > >        switch(requestCode){
> > >        case ACTIVITY_CREATE:
> > >                String employeeName =
> > > extras.getString(EmployeeDAO.EMP_NAME);
> > >                int employeeAge = extras.getInt(EmployeeDAO.EMP_NAME);
> > >                String employeeQualification =
> > > extras.getString(EmployeeDAO.EMP_QUALIFICATION);
> > >                String employeeDept =
> > > extras.getString(EmployeeDAO.EMP_DEPT);
> > >                employee.insertEmployeeInformation(employeeName,
> > > employeeAge,
> > > employeeQualification, employeeDept);
> > >                fillData();
> > >                break;
> > >        case ACTIVITY_EDIT:
> > >                Long rowId = extras.getLong(EmployeeDAO.KEY_ROW_ID);
> > >                if(rowId != null){
> > >                        String updateEmployeeName =
> > > extras.getString(EmployeeDAO.EMP_NAME);
> > >                        int updateEmployeeAge =
> > > extras.getInt(EmployeeDAO.EMP_NAME);
> > >                        String updateEmployeeQualification =
> > > extras.getString(EmployeeDAO.EMP_QUALIFICATION);
> > >                        String updateEmployeeDept =
> > > extras.getString(EmployeeDAO.EMP_DEPT);
> > >                        employee.updateEmployeeInformation(rowId,
> > > updateEmployeeName,
> > >                                         updateEmployeeAge,
> > > updateEmployeeQualification,
> > > updateEmployeeDept);
> > >                        fillData();
> > >                        break;
> > >                }
> > >        }
>
> > >    }
>
> > > }
>
> > > and My EmployeeEdit class
>
> > > package com.dreamapp.employeeinfo.activity;
>
> > > import com.dreamapp.employeeinfo.util.EmployeeDAO;
>
> > > import android.app.Activity;
> > > import android.content.Intent;
> > > import android.os.Bundle;
> > > import android.view.View;
> > > import android.widget.Button;
> > > import android.widget.EditText;
> > > import android.util.Log;
>
> > > public class EmployeeEdit extends Activity {
>
> > >        public EditText mEmployeeName;
> > >        public EditText mEmployeeAge;
> > >        public EditText mEmployeeQualification;
> > >        public EditText mEmployeeDept;
> > >        public Long mRowId;
>
> > >        public static final String TAG = "EmployeeEdit";
>
> > >        protected void onCreate(Bundle savedInstanceState){
> > >                super.onCreate(savedInstanceState);
> > >                setContentView(R.layout.employee_edit);
> > >                Log.w(TAG, "OnCreate Method in EmployeeEdit Class");
> > >                mEmployeeName = (EditText) findViewById(R.id.name);
> > >                mEmployeeAge = (EditText) findViewById(R.id.age);
> > >                mEmployeeQualification = (EditText)
> > > findViewById(R.id.qualification);
> > >                mEmployeeDept = (EditText) findViewById(R.id.dept);
>
> > >                Button confirmButton = (Button)
> > > findViewById(R.id.confirm);
> > >                mRowId = null;
> > >                Bundle extras = getIntent().getExtras();
> > >                if(extras !=null){
> > >                        String name =
> > > extras.getString(EmployeeDAO.EMP_NAME);
> > >                        int age = extras.getInt(EmployeeDAO.EMP_AGE);
> > >                        String qualification =
> > > extras.getString(EmployeeDAO.EMP_QUALIFICATION);
> > >                        String dept =
> > > extras.getString(EmployeeDAO.EMP_DEPT);
> > >                        mEmployeeName.setText(name);
> > >                        mEmployeeAge.setText(age);
> > >                        mEmployeeQualification.setText(qualification);
> > >                        mEmployeeDept.setText(dept);
> > >                        Log.w(TAG, "Preparing the View");
> > >                }
>
> > >                confirmButton.setOnClickListener(new
> > > View.OnClickListener(){
>
> > >                        public void onClick(View v) {
> > >                                Log.w(TAG, "OnClick Button Listener");
> > >                                Bundle bundle = new Bundle();
> > >                                bundle.putString(EmployeeDAO.EMP_NAME,
> > > mEmployeeName.getText().toString());
> > >                bundle.putString(EmployeeDAO.EMP_AGE,
> > > mEmployeeAge.getText().toString());
> > >            
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to