• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Action Bar - Missing Menu  RSS feed

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


As I am new to Android Studio I have one question to ask here and I hope You guys don't mind.

So I created action menu that should have 3 doots at right upper end and that should call menu. Anyway here is my menu:



In my main activity I am able to see menu but I am not able to see title and 3 doots.

Code of my LocationInit.java class:



AndroidManifest.xml:



app_bar.xml:






activity_main.xml:



I posted this problem in Stack Overflow first, but that community is more for finding typos than helping with problem and I am not even sure why I am still posting there.

 
Bartender
Posts: 1856
81
Android Chrome IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quick follow up questions:
  • Have you tried the same project with different versions of Android and did you get the same result?
  • Which version(s) have you noticed behave this way?
  • Are you able to try on a physical devices? If so what version Android are they using?
  • Are you following along with a tutorial which you've found online? If so please share the URL so that we can put this follow along and see it in it's original context.
  • Please share your Gradle files as well as these contain dependencies and you may have chosen an incorrect version/dependency.
  •  
    Josip Skako
    Ranch Hand
    Posts: 74
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Pete Letkeman wrote:Quick follow up questions:

  • Have you tried the same project with different versions of Android and did you get the same result?
  • Which version(s) have you noticed behave this way?
  • Are you able to try on a physical devices? If so what version Android are they using?
  • Are you following along with a tutorial which you've found online? If so please share the URL so that we can put this follow along and see it in it's original context.
  • Please share your Gradle files as well as these contain dependencies and you may have chosen an incorrect version/dependency.


  • Thank You on Your answer.

    I tried on 2 virtual devices - Google NEXUS 5X API 28 and PIXEL 2 API 23. I also tried with 2 real devices, one with Android version 6.0 and one with 7.0.
    I don't think that they have physical button for menu as some people state that it might be problem, I also tried to bypass that.

    This is tutorial that I followed as I found that as great one:


    Here is my gradle file (app):



    Gradle file (project)




     
    Pete Letkeman
    Bartender
    Posts: 1856
    81
    Android Chrome IntelliJ IDE Java MySQL Database
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Following along, I was able to get this to work for an API 22 device.
    I'm now downloading API 28 so that I can try it out.
     
    Josip Skako
    Ranch Hand
    Posts: 74
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Pete Letkeman wrote:Following along, I was able to get this to work for an API 22 device.
    I'm now downloading API 28 so that I can try it out.



    What have You done to get it work on API 22?

    Do You want me to share source in PM if that would be easier for You?

    Thank You!
     
    Pete Letkeman
    Bartender
    Posts: 1856
    81
    Android Chrome IntelliJ IDE Java MySQL Database
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I'll post a GitHub link after I'm able to get it to work with API 28 and then maybe we can find out what the issue is.
     
    Pete Letkeman
    Bartender
    Posts: 1856
    81
    Android Chrome IntelliJ IDE Java MySQL Database
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I was able to get the solution to work with API 26. Appear to be experiencing some issues with API 28, downloading API 27 right now, however I suspect it will work.
    In the mean time, is there a reason that you are trying API 28 and would you be okay with the app working with API 26 or API 27?
    Also, are you using the newest version of Android Studio and are you SDK images up to date?
     
    Josip Skako
    Ranch Hand
    Posts: 74
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Pete Letkeman wrote:I was able to get the solution to work with API 26. Appear to be experiencing some issues with API 28, downloading API 27 right now, however I suspect it will work.
    In the mean time, is there a reason that you are trying API 28 and would you be okay with the app working with API 26 or API 27?
    Also, are you using the newest version of Android Studio and are you SDK images up to date?



    Sorry to ask this but I am new and this might sound stupid question.

    It doesn't matter to me if the API is 27 or 26 to me, but i think that my API is 25 if I am watching it correctly:



    I think my SDK is up to date, but I have to check it, I guess I run Android Manager?

    Yeah, I am using Android Studio 3.1.3.
     
    Pete Letkeman
    Bartender
    Posts: 1856
    81
    Android Chrome IntelliJ IDE Java MySQL Database
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Yes, it does appear as though you are using API 25, which should run fine with new APIs.
    You can update the SDK using the SDK manager inside of Android Studio.

    Sorry for the delay, issues with github posting
     
    Josip Skako
    Ranch Hand
    Posts: 74
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Pete Letkeman wrote:Yes, it does appear as though you are using API 25, which should run fine with new APIs.
    You can update the SDK using the SDK manager inside of Android Studio.

    Sorry for the delay, issues with github posting



    Ah don't worry about it.

    I am on this problem since 04:00 and now is 20:50, thinking about burn PC and go outsite.

    Whatever I do I can't get action bar to work.
     
    Pete Letkeman
    Bartender
    Posts: 1856
    81
    Android Chrome IntelliJ IDE Java MySQL Database
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Here you go https://github.com/letkemanpete78/actionbar
    This project works for me
     
    Josip Skako
    Ranch Hand
    Posts: 74
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Pete Letkeman wrote:Here you go https://github.com/letkemanpete78/actionbar
    This project works for me



    First of all thank You for everything.

    Anyway I tried your application and it indeed work.
    But I am not sure how can I get it to work in mine.

    I do this:



    Now I am getting error while building app:







     
    Josip Skako
    Ranch Hand
    Posts: 74
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Somehow I posted image in code:

     
    Josip Skako
    Ranch Hand
    Posts: 74
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Well I get it build with but still nothing of app-bar

    apply plugin: 'com.android.application'

    android {
       compileSdkVersion 26
       buildToolsVersion '27.0.3'
       defaultConfig {
           applicationId "com.worldexplorer.error"
           minSdkVersion 16
           targetSdkVersion 26
           versionCode 1
           versionName "1.0"
           testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
           multiDexEnabled true
           vectorDrawables.useSupportLibrary = true
       }
       buildTypes {
           release {
               minifyEnabled false
               proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
           }
       }
    }

    dependencies {
       compile fileTree(dir: 'libs', include: ['*.jar'])
       compile 'com.android.support:support-v4:25.4.0'
       compile 'com.android.support:support-vector-drawable:25.4.0'
       compile 'com.google.android.gms:play-services-maps:15.0.1'
       androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
           exclude group: 'com.android.support', module: 'support-annotations'
       })
       implementation 'com.android.support:appcompat-v7:26.1.0'
       androidTestImplementation 'com.android.support.test:runner:1.0.2'
       androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
       compile 'com.android.support:cardview-v7:25.3.1'
       compile 'com.google.android.gms:play-services-location:15.0.1'
       implementation 'com.android.support.constraint:constraint-layout:1.1.2'
       testCompile 'junit:junit:4.12'

       compile 'com.jakewharton:butterknife:8.5.1'
       annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
    }

    configurations.all {
       resolutionStrategy.eachDependency { DependencyResolveDetails details ->
           def requested = details.requested
           if (requested.group == 'com.android.support') {
               if (!requested.name.startsWith("multidex")) {
                   details.useVersion '25.3.0'
               }
           }
       }
    }


     
    Pete Letkeman
    Bartender
    Posts: 1856
    81
    Android Chrome IntelliJ IDE Java MySQL Database
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You are welcome for the sample. Unfortunately minutes ago my house lost power. But as soon I get power again I'll look into your code. You don't have to worry about the test stuff yet as you are just beginning your learning journey.
     
    Josip Skako
    Ranch Hand
    Posts: 74
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Pete Letkeman wrote:You are welcome for the sample. Unfortunately minutes ago my house lost power. But as soon I get power again I'll look into your code. You don't have to worry about the test stuff yet as you are just beginning your learning journey.



    Ah, I can't express how grateful I am to You.

    Is there a way that there is a problem in layouts? But I doubt as I see app-bar background.


     
    Pete Letkeman
    Bartender
    Posts: 1856
    81
    Android Chrome IntelliJ IDE Java MySQL Database
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    One thing that you can try it replacing the 24.5 values to the same as the 26.1 values in your gradle files. However keep track of were those 25s are just in case you need to revert back to them.
     
    Josip Skako
    Ranch Hand
    Posts: 74
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Pete Letkeman wrote:One thing that you can try it replacing the 24.5 values to the same as the 26.1 values in your gradle files. However keep track of were those 25s are just in case you need to revert back to them.



    Tried, download new image of android emulator, still nothing

     
    Pete Letkeman
    Bartender
    Posts: 1856
    81
    Android Chrome IntelliJ IDE Java MySQL Database
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I suggest that you post the project as a whole to GitHub or some place similar then post a link back here do that when someone or me try the project out locally on their system. I do have power again, but now internet connection is down so I'm just using my cell.
     
    Josip Skako
    Ranch Hand
    Posts: 74
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Pete Letkeman wrote:I suggest that you post the project as a whole to GitHub or some place similar then post a link back here do that when someone or me try the project out locally on their system. I do have power again, but now internet connection is down so I'm just using my cell.



    Well I am not able to post it on GIT as  I am working for someone and plagiarism checker might detect it on GIT.

    But anyway, here it is: https://files.fm/u/8mfagzg9

    I am dying to know what is going on with act_bar and why it is not showing up
     
    Pete Letkeman
    Bartender
    Posts: 1856
    81
    Android Chrome IntelliJ IDE Java MySQL Database
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Working on it. In the mean time have you noticed that there are a number of warning in Gradle about things being deprecated?
    You may want to update these before too long as they could be a problem later on.
     
    Pete Letkeman
    Bartender
    Posts: 1856
    81
    Android Chrome IntelliJ IDE Java MySQL Database
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Unfortunately it does not look like I'll be able to help you out with this as I'm not too sure what exactly is going on.
    After looking at the code I do have a few ideas as to how it can be improved upon to make it easier to follow for those who are working with the code.
    While this would help I think that there are still some lines which may need to be remove/rewritten to work with the action bar.

    If you want I can provide those hints/ideas. Did you want these ideas?
     
    Josip Skako
    Ranch Hand
    Posts: 74
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Pete Letkeman wrote:Unfortunately it does not look like I'll be able to help you out with this as I'm not too sure what exactly is going on.
    After looking at the code I do have a few ideas as to how it can be improved upon to make it easier to follow for those who are working with the code.
    While this would help I think that there are still some lines which may need to be remove/rewritten to work with the action bar.

    If you want I can provide those hints/ideas. Did you want these ideas?




    Sorry that I didn't answer you sooner, I was on out of town for a while.

    Anyway, Thank You that You take Your free time and try everything to help me, if I find out why I couldn't call action bar I'll post it here.
    I am always opened for ideas and hints so I can't see reason why not
    I'll try to start fresh project and make something more usefull, as this was my first app in Android Studio.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!