Android Tutorial Material Design 2 - Using the AppCompat library

Discussion in 'Tutorials & Examples' started by corwin42, Dec 19, 2014.

  1. ernschd

    ernschd Active Member Licensed User

    When i'm trying to compile one of the example apps, the compiler displays the following lines:

    Parsing code.  0.00
    Compiling code.  
    Compiling layouts code.  
    Generating R 
    file.  Error
    75: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
    C:\Programme\Android\android-sdk\extras\android\support\v7\appcompat\res\values-v21\styles_base.xml:79: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'.
    191: error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'.
    Am i missing something?
  2. corwin42

    corwin42 Expert Licensed User

    You have to compile with at least API 21 android.jar. Configure it in the Tools/Configure Paths menu in the B4A IDE.
  3. Peter Simpson

    Peter Simpson Expert Licensed User

    Thanks and enjoy the pint you deserve it, I'll give it a go later.
    corwin42 likes this.
  4. Theera

    Theera Well-Known Member Licensed User

    Hi Corwin42 or others,
    I like your the example #2. If I need to add status of swith ON/OFF (in Thai too) ,How do I edit it?

    and I would like you add hint method as same as this for AcEditText too.
    Last edited: Jan 12, 2015
  5. alexwekell

    alexwekell Member Licensed User

    Edit: Is there any update on adding the navigation drawer with this?
    Last edited: Jan 20, 2015
  6. corwin42

    corwin42 Expert Licensed User

    Wait for the next update of the AHNavigationDrawer library. Will be released soon.
  7. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    I change android api version to 21
    and run project but get error below
    ..\resource\values\themes.xml:6: error: Error: No resource found that matches the given name: attr 'colorAccent'.
    ..\resource\values\themes.xml:4: error: Error: No resource found that matches the given name: attr 'colorPrimary'.
    ..\resource\values\themes.xml:5: error: Error: No resource found that matches the given name: attr 'colorPrimaryDark'.
    what is it?
  8. chrjak

    chrjak Active Member Licensed User

    I get an error:

    javac 1.7.0_40
    src\com\my\app\ error: package does not exist
    public class main extends implements B4AActivity{
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    1 error

    I downloaded newest support package!?
  9. corwin42

    corwin42 Expert Licensed User

    Have you changed this line to point to the correct path of your SDK installation?
    #AdditionalRes: C:\Android\android-sdk\extras\android\support\v7\appcompat\res,
    And have you copied the android-support-v7-appcompat.jar to your custom libs folder?
  10. chrjak

    chrjak Active Member Licensed User

    Sorry I didn't because i haven't found the file... Thanks :D
  11. chrjak

    chrjak Active Member Licensed User

    Unfortunately the app stopped

    My manifest is like this:
    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21"/>
    <supports-screens android:largeScreens="true"
    SetApplicationAttribute(android:icon, "@drawable/icon")
    'End of default text.
    SetApplicationAttribute(android:theme, "@style/MyAppTheme")

    All # codes are in the app code and theme.xml is in values. what is going wrong? o.o

  12. corwin42

    corwin42 Expert Licensed User

    Stack trace of the error you get? Maybe you will only see it in the unfiltered logs.
  13. chrjak

    chrjak Active Member Licensed User

    I have filter off + connected to my phone. it shows nothing...
  14. chrjak

    chrjak Active Member Licensed User

    i tried again with empty activity_start and _resume but it keeps crashing!?
  15. corwin42

    corwin42 Expert Licensed User

    If you get the message "unfortunately the app stopped" ther MUST be a stack trace of an exception. Without it I can't help you.
  16. chrjak

    chrjak Active Member Licensed User

    But there is none.... LogCat shows nothing (See my Screenshot)

    If you like we can meet over teamviewer and you can look over all my files etc...
  17. corwin42

    corwin42 Expert Licensed User

    Which screenshot?
  18. shashkiranr

    shashkiranr Active Member Licensed User

    Hi All,

    I am currently using the below code to hide the buttons on the actionbar when the navigation drawer is open. Is there any better way of doing it?

    Sub Drawer_DrawerOpened (DrawerGravity As Int)
    Log("Drawer Opened: ")
        isDrawerOpened = 
    For i = 0 To ActionBar.Menu.Size-1
    Dim act As ACMenuItem = ActionBar.Menu.GetItem(i)
            act.Visible = 
    End Sub
  19. corwin42

    corwin42 Expert Licensed User

    It's Ok how you have done it.
    Maybe you can put this code in a sub with an "enable" Parameter. Then you can use the same sub for enabling and disabling the action items.
    shashkiranr likes this.
  20. migrec

    migrec Member Licensed User

    Can't compile your Toolbar example, I get this (and yes, all paths are correct):

    Parsing code.                           0.03
    Compiling code.                         
    Compiling layouts code.                 
    Generating R 
    file.                      0.50
    Compiling generated Java code.          Error
    17: error: cannot access SupportParentable
    public class main extends implements B4AActivity{
    file for$SupportParentable not found
    Note: Some messages have been simplified; recompile with -Xdiags:verbose 
    to get full output
    1 error
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice