Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6984409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:32:44+00:00 2026-05-27T18:32:44+00:00

Why do i get this error: 12-27 20:37:57.039: E/AndroidRuntime(3798): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null,

  • 0

Why do i get this error:

               12-27 20:37:57.039: E/AndroidRuntime(3798): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=1, data=Intent { (has extras) }} to activity {org.example.dbcontactconsole/org.example.dbcontactconsole.DbContactConsole}: android.database.sqlite.SQLiteException: table contactTest1 has no column named photo: , while compiling: INSERT INTO contactTest1(phone, photo, email, name) VALUES(?, ?, ?, ?);
               12-27 20:37:57.039: E/AndroidRuntime(3798):  at android.app.ActivityThread.deliverResults(ActivityThread.java:2536)
                12-27 20:37:57.039: E/AndroidRuntime(3798):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:2578)
                12-27 20:37:57.039: E/AndroidRuntime(3798):     at android.app.ActivityThread.access$2000(ActivityThread.java:117) 
                   12-27 20:37:57.039: E/AndroidRuntime(3798):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:965)
                  12-27 20:37:57.039: E/AndroidRuntime(3798):   at android.os.Handler.dispatchMessage(Handler.java:99)
                   12-27 20:37:57.039: E/AndroidRuntime(3798):  at android.os.Looper.loop(Looper.java:123)
                   12-27 20:37:57.039: E/AndroidRuntime(3798):  at android.app.ActivityThread.main(ActivityThread.java:3687)
                   12-27 20:37:57.039: E/AndroidRuntime(3798):  at java.lang.reflect.Method.invokeNative(Native Method)
                   12-27 20:37:57.039: E/AndroidRuntime(3798):  at java.lang.reflect.Method.invoke(Method.java:507)
                   12-27 20:37:57.039: E/AndroidRuntime(3798):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
                   12-27 20:37:57.039: E/AndroidRuntime(3798):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
                   12-27 20:37:57.039: E/AndroidRuntime(3798):  at dalvik.system.NativeStart.main(Native Method)
                   12-27 20:37:57.039: E/AndroidRuntime(3798): Caused by: android.database.sqlite.SQLiteException: table contactTest1 has no column named photo: , while compiling: INSERT INTO contactTest1(phone, photo, email, name) VALUES(?, ?, ?, ?);
                   12-27 20:37:57.039: E/AndroidRuntime(3798):  at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
                   12-27 20:37:57.039: E/AndroidRuntime(3798):  at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92)
                     12-27 20:37:57.039: E/AndroidRuntime(3798):    at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:65)
                      12-27 20:37:57.039: E/AndroidRuntime(3798):   at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:83)
                        12-27 20:37:57.039: E/AndroidRuntime(3798):     at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:41)
                   12-27 20:37:57.039: E/AndroidRuntime(3798):  at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1149)
                    12-27 20:37:57.039: E/AndroidRuntime(3798):     at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1569)
                   12-27 20:37:57.039: E/AndroidRuntime(3798):  at android.database.sqlite.SQLiteDatabase.insertOrThrow(SQLiteDatabase.java:1452)
                    12-27 20:37:57.039: E/AndroidRuntime(3798):     at org.example.dbcontactconsole.DbContactConsole.addContact(DbContactConsole.java:175)
                    12-27 20:37:57.039: E/AndroidRuntime(3798):     at org.example.dbcontactconsole.DbContactConsole.onActivityResult(DbContactConsole.java:136)
                    12-27 20:37:57.039: E/AndroidRuntime(3798):     at android.app.Activity.dispatchActivityResult(Activity.java:3908)
                       12-27 20:37:57.039: E/AndroidRuntime(3798):  at android.app.ActivityThread.deliverResults(ActivityThread.java:2532)

its say to me i have no column named photo but i have:

public void onCreate(SQLiteDatabase db) { 
      db.execSQL("CREATE TABLE " + DbConstants.TABLE_NAME + " " +
            "(" + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + 
                  DbConstants.NAME + " TEXT NOT NULL," + 
                  DbConstants.PHONE + " TEXT NOT NULL," +
                  DbConstants.PHOTO + "TEXT NOT NULL," +
                  DbConstants.EMAIL +"TEXT NOT NULL,"+");");
   }

Here is my db constants .java:

    public static final String NAME = "name";
public static final String PHONE = "phone";
public static final String EMAIL = "email";
public static final String PHOTO="photo";

I get the error when I press the save button when I try to add a contact.

This is my .java where I have add method:

 @Override
   public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main); 
      showDatabaseContent();
      lv1 = getListView();

      lv1.setTextFilterEnabled(true);

       lv1.setOnItemClickListener(new OnItemClickListener() {

       public void onItemClick(AdapterView<?> a, View v, int position, long id) { 
           cursor = (Cursor) a.getItemAtPosition(position);
           itemId = cursor.getString(0);
           openOptionsMenu();
           }
       });

       lv1.setOnItemSelectedListener(new OnItemSelectedListener() {

           public void onItemSelected(AdapterView<?> parent, View view, int position, long id){

        }

        public void onNothingSelected(AdapterView<?> arg0) {
            // TODO Auto-generated method stub

        }

       });
   }

   //selected item index from ListView
   public void showDialogItemId(long itemId){
       Toast.makeText(this, "Menu item selected index is" + Long.toString(itemId), Toast.LENGTH_LONG).show();
   }

   @Override
   public boolean onCreateOptionsMenu(Menu menu){
       MenuInflater inflater = getMenuInflater();
       inflater.inflate(R.menu.menu, menu);
       return true;
   }

   @Override
   public boolean onOptionsItemSelected(MenuItem item){
       switch (item.getItemId()){
           case R.id.modifyitem:
               if(null != itemId){
                   Bundle contactToModify = new Bundle();
                   contactToModify.putString("cFirstName", cursor.getString(1));
                   contactToModify.putString("cMobilePhone", cursor.getString(2));
                   contactToModify.putString("cEmail", cursor.getString(3));
                   contactToModify.putString("mod_type", "modifyPerson");
                   Intent intent = new Intent(this, ContactDetails.class);
                   intent.setClass(this, ContactDetails.class);
                   intent.putExtras(contactToModify);
                   startActivityForResult(intent, CONTACT_MODIFIED);
               }else{
                   Toast.makeText(this, "Select Contact to modify", Toast.LENGTH_LONG).show();
               }
               break;
           case R.id.additem:

               Intent i = new Intent(this, ContactDetails.class);
               Bundle bun = new Bundle();
               bun.putString("mod_type", "addPerson");
               i.setClass(this, ContactDetails.class);
               i.putExtras(bun);
               startActivityForResult(i, CONTACT_ADDED);
               break;

           case R.id.removeitem:
               if(null != itemId){
                   removeContact(itemId);
                   showDatabaseContent();
               }
               else{
                   Toast.makeText(this, "Select Contact to delete", Toast.LENGTH_LONG).show();
               }
               break;
           case R.id.search:
               Intent j =new Intent(this,Search.class);
               j.setClass(this, Search.class);
               startActivity(j);
               break;
       }
       return true;
   }

   @Override
   protected void onActivityResult(int requestCode, int resultCode, Intent intent){
       // See which child activity is calling us back.
       switch (resultCode) {
           case CONTACT_ADDED:
               // This is the standard resultCode that is sent back if the
               // activity crashed or didn't doesn't supply an explicit result.
               if (resultCode == RESULT_FIRST_USER){
                   Bundle bundle = new Bundle();
                   bundle = intent.getBundleExtra("contactData");
                   addContact(bundle);
                   showDatabaseContent();
               } 
               else{
                   Toast.makeText(this, "CANCEL CONTACT BUTTON PRESSED", Toast.LENGTH_LONG).show();
               }
               break;
           case CONTACT_MODIFIED:
               if (resultCode == 2){
                   Bundle bundle = new Bundle();
                   bundle = intent.getBundleExtra("contactData");
                   modifyContact(bundle);
                   showDatabaseContent();
               }
               else{
                   Toast.makeText(this, "MODIFY CONTACT FAILED", Toast.LENGTH_LONG).show();
               }
               break;
           default:
               break;
       }
   }

 //method removes item from database
   private void removeContact(String itemId){
       db = contacts.getWritableDatabase();
       db.delete(DbConstants.TABLE_NAME, "_ID=" + itemId, null);

   }

   private void addContact(Bundle bundle) {
          // Insert a new record into the Events data source.
          // You would do something similar for delete and update.
          db = contacts.getWritableDatabase();
          ContentValues vals = new ContentValues();
          vals.put(DbConstants.NAME, bundle.getString("contactFirstName"));
          vals.put(DbConstants.PHONE, bundle.getString("contactMobilePhone"));
          vals.put(DbConstants.EMAIL, bundle.getString("contactEmail"));
          vals.put(DbConstants.PHOTO,bundle.getString("poza"));
          db.insertOrThrow(DbConstants.TABLE_NAME, null, vals);
       }

 //method should modify existing Contact
   private void modifyContact(Bundle bundle){
       db = contacts.getWritableDatabase();
       ContentValues vals = new ContentValues();
       vals.put(DbConstants.NAME, bundle.getString("contactFirstName"));
       vals.put(DbConstants.PHONE, bundle.getString("contactMobilePhone"));
       vals.put(DbConstants.EMAIL, bundle.getString("contactEmail"));
       db.update(DbConstants.TABLE_NAME, vals, _ID+"="+itemId, null);
   }

   private Cursor getContacts() {
          db = contacts.getReadableDatabase();
          cursor = db.query(DbConstants.TABLE_NAME, FROM, null, null, null,
                null,DbConstants.NAME);
          startManagingCursor(cursor);
          return cursor;
   }

   public void showDatabaseContent(){
       contacts = new DbCreate(this); 
       try {
           cursor = getContacts(); 
           showContacts(cursor); 
       } finally {
           contacts.close(); 
           db.close();
       }
   }

   private void showContacts(Cursor cursor) {
       //set up data binding
       SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.item, cursor, FROM, TO);
       setListAdapter(adapter);
       }
}

and this is my .java where i have implemented the method for save button:

protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.contactdetails);
     Button sButton = (Button) findViewById(R.id.button1);
     sButton.setOnClickListener(new OnClickListener() {

          public void onClick(View arg0) {
              // in onCreate or any event where your want the user to
              // select a file
              Intent intent = new Intent();
              intent.setType("image/*");
              intent.setAction(Intent.ACTION_GET_CONTENT);
              startActivityForResult(Intent.createChooser(intent,
                      "Select Picture"), SELECT_PICTURE);
          }
      });

    Bundle incomingActionType = getIntent().getExtras();
    operationType = incomingActionType.getString("mod_type");

    if (operationType.equals("addPerson")){

        nameField = (EditText) findViewById(R.id.contactName); 
        mobilePhoneField = (EditText) findViewById(R.id.contactmobile);
        emailField = (EditText) findViewById(R.id.contactemail);

    }

    else if (operationType.equals("modifyPerson")){

        String modifyFirstName = incomingActionType.getString("cFirstName");
        nameField = (EditText) findViewById(R.id.contactName);
        nameField.setText(modifyFirstName);


        String modifyPhoneNumber = incomingActionType.getString("cMobilePhone");
        mobilePhoneField = (EditText) findViewById(R.id.contactmobile);
        mobilePhoneField.setText(modifyPhoneNumber);

        String modifyEmail = incomingActionType.getString("cEmail");
        emailField = (EditText) findViewById(R.id.contactemail);
        emailField.setText(modifyEmail);    
    }


cancelButton = (Button) findViewById(R.id.cancelcontactbutton);
saveContactButton = (Button) findViewById(R.id.savecontactbutton);

saveContactButton.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {
        Intent resultIntent = new Intent();
        Bundle contactData = new Bundle();

            if (nameField.getText().toString().length() == 0){
                new AlertDialog.Builder(ContactDetails.this).setTitle("Error").setMessage("First name field cannot be empty!").setNeutralButton("Close", null).show();
            } else if (mobilePhoneField.getText().toString().length() == 0){
                new AlertDialog.Builder(ContactDetails.this).setTitle("Error").setMessage("Mobile Phone field cannot be empty!").setNeutralButton("Close", null).show();
            } else if (emailField.getText().toString().length() == 0){
                new AlertDialog.Builder(ContactDetails.this).setTitle("Error").setMessage("Email field cannot be empty!").setNeutralButton("Close", null).show();
            } else{
                contactData.putString("contactFirstName", nameField.getText().toString());
                contactData.putString("contactMobilePhone", mobilePhoneField.getText().toString());
                contactData.putString("contactEmail", emailField.getText().toString());
                contactData.putString("poza",poza.getText().toString());
                resultIntent.putExtra("contactData", contactData);

                if (operationType.equals("addPerson")){
                    setResult(RESULT_FIRST_USER, resultIntent);
                }else if (operationType.equals("modifyPerson")){
                    setResult(RESULT_MODIFY_USER, resultIntent);
                }               
                finish();
            }
    }
});

cancelButton.setOnClickListener(new View.OnClickListener(){


    public void onClick(View v) {
        Intent resultIntent = new Intent();
        setResult(RESULT_CANCELED, resultIntent);
        finish();


    }
});

}
public void onActivityResult(int requestCode, int resultCode, Intent data) {  
       if (resultCode == RESULT_OK) {
           if (requestCode == 1) {
               // currImageURI is the global variable I'm using to hold the content:// URI of the image

Uri          currImageURI = data.getData();
               getRealPathFromURI(currImageURI);

           }
         }
       }


    public String getRealPathFromURI(Uri currImageURI) {
       // can post image
       String [] proj={MediaStore.Images.Media.DATA};
       Cursor cursor = managedQuery( currImageURI,
               proj, // Which columns to return
               null,       // WHERE clause; which rows to return (all rows)
               null,       // WHERE clause selection arguments (none)
               null); // Order-by clause (ascending by name)
       int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
       cursor.moveToFirst();


          poza=(EditText)findViewById(R.id.editText1);
           poza.setText(currImageURI.toString());
          return cursor.getString(column_index);

        }
}

I think error is here:db.insertOrThrow(DbConstants.TABLE_NAME, null, vals);
but dont know why.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:32:45+00:00Added an answer on May 27, 2026 at 6:32 pm
    public void onCreate(SQLiteDatabase db) { 
          db.execSQL("CREATE TABLE " + DbConstants.TABLE_NAME + " " +
                "(" + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + 
                      DbConstants.NAME + " TEXT NOT NULL," + 
                      DbConstants.PHONE + " TEXT NOT NULL," +
                      DbConstants.PHOTO+
                      DbConstants.EMAIL + ");");
    

    You don’t specify a datatype for the photo column (and the followiung email col.) when creating the db. Most likely this leads to errors which will prevent the generation of the column(s). Specify a datatype here and you should be good.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get this error: java.lang.InternalError: name is too long to represent at java.lang.ClassLoader.defineClass1(Native Method)
I get this error: import java.util.scanner never used I'm not sure what I need
I get this error on my UNIX server, when running my java server: Exception
I get this error: --------------------Configuration: <Default>-------------------- C:\Documents and Settings\800508\Desktop\Chpt 8\Labs08\Lab08MATH02\Lab08MATH02st.java:20: 'void' type not allowed
I get this error: Can't locate Foo.pm in @INC Is there an easier way
I get this error on an update panel within a popupControlExtender which is within
I get this error when I do an svn update : Working copy XXXXXXXX
I get this error:- You have an error in your SQL syntax; check the
We get this error in Visual Studio 2005 and TFS very often. Can anyone
i get this error {Method 'System.DateTime ConvertTimeFromUtc(System.DateTime, System.TimeZoneInfo)' has no supported translation to SQL.}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.