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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:13:44+00:00 2026-05-23T21:13:44+00:00

When I check QuickContactBadge in FrameLayout , I found following code: public QuickContactBadge(Context context,

  • 0

When I check QuickContactBadge in FrameLayout, I found following code:

 public QuickContactBadge(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    TypedArray a =
        context.obtainStyledAttributes(attrs,
                com.android.internal.R.styleable.QuickContactBadge, defStyle, 0);

    mMode = a.getInt(com.android.internal.R.styleable.QuickContactBadge_quickContactWindowSize,
            QuickContact.MODE_MEDIUM);

    a.recycle();

    init();

    mBadgeBackground = getBackground();
}

I don’t really catch the meaning of defstyle and 0 parameter in obtainStyledAttributes(). I have looked up reference, but still don’t know what it used for.

  • 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-23T21:13:45+00:00Added an answer on May 23, 2026 at 9:13 pm

    The documentation says:

    defStyleAttr An attribute in the current theme that contains a reference to a style resource that supplies defaults values for the StyledAttributes. Can be 0 to not look for defaults.

    defStyleRes A resource identifier of a style resource that supplies default values for the StyledAttributes, used only if defStyleAttr is 0 or can not be found in the theme. Can be 0 to not look for defaults.

    "Can be 0 to not look for defaults." If you set this to 0 then it’s not going to try to grab default values for the style attributes. It does seem a little counter-intuitive, why overload this method if you can just pass in a 0… but I think it is so you can tell it not to look in defStyleAttr for defaults but do tell it to look in defStyleRes for defaults, and vice versa.

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

Sidebar

Related Questions

Check the following code snippet struct st { struct st { int a ;
Check the below code int add(int a, int b) { return a + b;
Check out the following snippet of HTML/Javascript code: <html> <head> <script type=text/javascript> var alerts
Check out the simple code below : Public Class Form1 Private _items As List(Of
Check this method: public static void Swap(ref int i, ref int j) { int
Check out the following code (written just for fun) namespace N { template<typename T>
check out this Scala-code: def rec(n: Int) { if (n > 1) { val
Check out this test: [TestFixture] public class Quick_test { [Test] public void Test() {
check this out: template <class T> class Test: public T { public: void TestFunc()
Check this code (My Custom Keyboard): -(IBAction) updateTextBackSpace:(id)sender { if([txtview.text length]>0) { NSString *deletedLastCharString

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.