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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:06:25+00:00 2026-05-31T22:06:25+00:00

I have a problem with a function ( setLayerType(LAYER_TYPE_NONE, null) ) available in api

  • 0

I have a problem with a function (setLayerType(LAYER_TYPE_NONE, null)) available in api >=11, and my code should run on android 1.6 (API level 4) too.
I have tried to use reflection like this:

try {

        Method method = View.class.getMethod("setLayerType", Integer.TYPE, null);
        method.invoke(LAYER_TYPE_NONE, null);
        view.setLayerType(LAYER_TYPE_NONE, null);
    } catch (Throwable e) {
        Log.e("_________________test", "Function not found");
    }

but my app crash at view.setLayerType with java.lang.VerifyError….

Does anybody have any idea how can I workaround this crash and get a backward compatibility with this function in lower level api?

Thanks,
Arkde

  • 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-31T22:06:27+00:00Added an answer on May 31, 2026 at 10:06 pm

    Just remove

    view.setLayerType(LAYER_TYPE_NONE, null);
    

    and you should be fine, for security reasons, Java/Android would first verify that it has at least a shot of running a given class before proceeding, and on older Android OS it doesn’t know how to execute “view.setLayerType(LAYER_TYPE_NONE, null);”, it would throw a hard Error before any code from that class could be run.

    Since you’ve run the code using reflection, you shouldn’t need that line of code anyway.

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

Sidebar

Related Questions

I have problem with fancybox. I want to write a function that will run
I have problem with validation such code function show_help_tip(event, element) { var $e =
I have problem with code. I have written a function for extracting a parameter,
I have problem with basic VIM function:(I tried googling and cannot find the answer)
I have a problem open: function($type) { //Some code document.getElementById($type).addEventListener(click, l.close($type), false); }, close:
I have problem with ajax and php.I have next code $(form).submit(function() { var poruka
I have problem with deserialize document to object using XmlSerializer class. Code my function
Hi i have problem with some things Here is the code function get_char_val(merk) {
I have a problem using a function when there should not be any problem.
I have a problem with the function str_replace(). I have this code: $headImageName =

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.