Android Tutorial Material Design 2 - Using the AppCompat library

ernschd

Active Member
Licensed User
Longtime User
When i'm trying to compile one of the example apps, the compiler displays the following lines:

B4X:
Parsing code.  0.00
Compiling code.  0.06
Compiling layouts code.  0.02
Generating R file.  Error
C:\Programme\Android\android-sdk\extras\android\support\v7\appcompat\res\values-v21\styles_base.xml: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'.
...
C:\Programme\Android\android-sdk\extras\android\support\v7\appcompat\res\values-v21\themes_base.xml:191: error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'.

Am i missing something?
 

corwin42

Expert
Licensed User
Longtime User

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

Theera

Well-Known Member
Licensed User
Longtime 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:

alexwekell

Member
Licensed User
Longtime User
Edit: Is there any update on adding the navigation drawer with this?
 
Last edited:

corwin42

Expert
Licensed User
Longtime User
Edit: Is there any update on adding the navigation drawer with this?

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

omidaghakhani1368

Well-Known Member
Licensed User
Longtime User
Hi.
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?
 

chrjak

Active Member
Licensed User
Longtime User
I get an error:

javac 1.7.0_40
src\com\my\app\main.java:16: error: package android.support.v7.app does not exist
public class main extends android.support.v7.app.ActionBarActivity 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!?
 

corwin42

Expert
Licensed User
Longtime User

Have you changed this line to point to the correct path of your SDK installation?
B4X:
#AdditionalRes: C:\Android\android-sdk\extras\android\support\v7\appcompat\res, android.support.v7.appcompat


And have you copied the android-support-v7-appcompat.jar to your custom libs folder?
 

chrjak

Active Member
Licensed User
Longtime User
Sorry I didn't because i haven't found the file... Thanks
 

chrjak

Active Member
Licensed User
Longtime User
Unfortunately the app stopped

My manifest is like this:
AddManifestText(
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label,"@string/app_name")
'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

Sorry
 

corwin42

Expert
Licensed User
Longtime User
Stack trace of the error you get? Maybe you will only see it in the unfiltered logs.
 

chrjak

Active Member
Licensed User
Longtime User
I have filter off + connected to my phone. it shows nothing...
 

chrjak

Active Member
Licensed User
Longtime User
i tried again with empty activity_start and _resume but it keeps crashing!?
 

corwin42

Expert
Licensed User
Longtime User
i tried again with empty activity_start and _resume but it keeps crashing!?

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.
 

chrjak

Active Member
Licensed User
Longtime 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...
 

shashkiranr

Active Member
Licensed User
Longtime 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?

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

Regards,
SK
 

corwin42

Expert
Licensed User
Longtime 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.
 

migrec

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

B4X:
Parsing code.                           0.03
Compiling code.                         0.41
Compiling layouts code.                 0.08
Generating R file.                      0.50
Compiling generated Java code.          Error
javac 1.8.0_25
src\de\amberhome\appcompat\toolbarexample1\main.java:17: error: cannot access SupportParentable
public class main extends android.support.v7.app.ActionBarActivity implements B4AActivity{
       ^
  class file for android.support.v4.app.TaskStackBuilder$SupportParentable not found
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…