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 4019586
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:07:22+00:00 2026-05-20T10:07:22+00:00

I have never gotten this error before so I am not sure what to

  • 0

I have never gotten this error before so I am not sure what to do or what it means

Unhandled exception type OperationApplicationException

It occurs in this code:

public void putSettings(SharedPreferences pref){
    ArrayList<ContentProviderOperation> ops =
          new ArrayList<ContentProviderOperation>();

    ops.add(ContentProviderOperation.newUpdate(Data.CONTENT_URI)
    .withSelection(Data.RAW_CONTACT_ID + "=?", new String[]{String.valueOf(pref.getString(SmsPrefs.ID, ""))})
    .withValue(Data.MIMETYPE,"vnd.android.cursor.item/color")
    .withValue("data1",nColor).build());
    getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops); //error


    ops.add(ContentProviderOperation.newUpdate(Data.CONTENT_URI)
    .withSelection(Data.RAW_CONTACT_ID + "=?", new String[]{String.valueOf(pref.getString(SmsPrefs.ID, ""))})
    .withValue(Data.MIMETYPE,"vnd.android.cursor.item/vibrate")
    .withValue("data1", nVibrate).build());
    getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops); //error

    ops.add(ContentProviderOperation.newUpdate(Data.CONTENT_URI)
    .withSelection(Data.RAW_CONTACT_ID + "=?", new String[]{String.valueOf(pref.getString(SmsPrefs.ID, ""))})
    .withValue(Data.MIMETYPE, "vnd.android.cursor.item/sound")
    .withValue("data1", ringTonePath).build());
    getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);//error
}

It gives me 2 options “add throws declaration” and “surround with try/catch”.

What do I have to do and 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-20T10:07:22+00:00Added an answer on May 20, 2026 at 10:07 am

    It means a method you’re calling is declared with the throws directive for an exception derived from the Exception class. When a method is declared in this way, you are forced to deal with the exception using a try/catch block or add an identical throws (for the same exception or a super type) statement to your method declaration.

    An example.

    I want to call some method foo inside my method bar.

    Here is foo‘s definition:

    public static void foo(String a) throws Exception {
        // foo does something interesting here.
    }
    

    I want to call foo. If I simply do this:

    private void bar() {
        foo("test");
    }
    

    …then I’ll get the error you are experiencing. foo declares to the world that it really might decide to throw an Exception and you had better be ready to deal with it.

    I have two options. I can change bar‘s definition as follows:

    private void bar() throws Exception {
        foo("test");
    }
    

    Now I’ve publicized my own warning that my method or some method I call could throw an Exception that the user of my method should deal with. Since I’ve deferred responsibility to my method’s caller, my method doesn’t have to deal with the exception itself.

    It’s often better to deal with the exception yourself, if you can. That brings us to the second option, the try/catch:

    private void bar() {
        try {
            foo("test");
        } catch(Exception e) {
            Log.wtf("MyApp", "Something went wrong with foo!", e);
        }
    }
    

    Now I’ve dealt with the potential Exception thrown by foo that the compiler was complaining about. Since it’s been dealt with, I don’t need to add a throws directive to my bar method.

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

Sidebar

Related Questions

Before you answer this I have never developed anything popular enough to attain high
I have never worked with web services and rails, and obviously this is something
I have never hand-coded object creation code for SQL Server and foreign key decleration
I have never used octal numbers in my code nor come across any code
I have never seen a way to do this nicely, i would be interested
i have never done embedded (i dont know if thats what you call this)
I have never really thought about this until today, but after searching the web
I have never programmed in C and have not programmed in C++ for a
I have never been good at playing with pointers in C. But this time
I have never worked on programming languages before. I am learning C and unix

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.