-
Notifications
You must be signed in to change notification settings - Fork 4.4k
The layout is not the same as one from the end of lesson 1? #109
Comments
Does the onCreate method of your ForecastFragment contain the statement setHasOptionsMenu(true); ? |
It looks like I do not. Where should I add this? package com.dev.bao.sunshine; import android.os.AsyncTask; import java.io.BufferedReader;
|
You are trying to have the the fragment add an item to the overflow menu, yes? In the ForecastFragment class override the onCreate method and write the statement setHasOptionsMenu(true); . |
Hi, sorry I am honestly not sure. I am completely new to android This is the section I tried the above and debugged, I still did not see the menu option. Thank You, On Sat, Dec 26, 2015 at 2:50 PM, Kasijjuf notifications@github.com wrote:
|
What's in your forecastfragment.xml file? If you upload your code to a public repository in your GitHub account, I can give you better help. |
Sorry, I am not home right now. Will you be free in 3 or 4 hours?
|
I should be. |
I am still messing around with GitHub trying to figure out how to upload
|
OK, I think I figured out why the menu isn't displaying. You've added the XML that defines the menu, but the code that actually reads and implements that definition hasn't been added yet. That's the job of the next step: |
Hmmm, I did that, and I still do not see it. package com.dev.bao.sunshine;
|
Both your onCreate method and your onCreateView method contain the |
You are running this on an actual device or on the emulator and not just looking at what appears in the Design view, right? |
Yes, I am running it on an emulator. I attempted to delete the toolbar from main_activity.xml, it's gone, but the option settings bar is still nowhere. I'm just honestly messing around and see what is the problem.
|
I am using SDK 16 in case you wondered. |
As your minSdkVersion? |
Yes
|
If you upload your code to a public repository in your GitHub account, I can give you better help. Until then I'm stumped. |
May you guide me with this? I am trying to use the desktop version. On Mon, Dec 28, 2015 at 11:20 PM, Kasijjuf notifications@github.com wrote:
|
Oooooh, I think I got it now, which files do you need from my android See if you can check this git hub https://github.com/exocore123/sunshine On Mon, Dec 28, 2015 at 11:24 PM, Bao Thai baothaijunk@gmail.com wrote:
|
Sorry for the delayed response, In Android Studio open your project, then in the menu bar select VCS -> Import into Version Control -> Share Project on GitHub. |
Ok I think I figured it out for real this time. First, compiling and running the code as you have it in your initial commit on your GitHub repository produces an app with no action bar. To add the action bar back simply remove the attribute android:theme="@style/AppTheme.NoActionBar" from line 14 of your AndroidManifest.xml file (link). Now I am hypothesizing that when you created your Android Virtual Device, you selected either the Nexus One or the Nexus S as the base template. Both of these devices are pre-Honeycomb and thus have the pre-Honeycomb-style navigation buttons, i.e. Back, Menu, Home, and Search. By default when an app is run on such a device, the menu options are accessed via the Menu button rather than via an overflow button in the action bar. I'm fairly certain there is a way to override this behaviour, but I am unaware of what that way is. When I ran your app in an Android Virtual Device using the Galaxy Nexus as the base template, the overflow button appeared in the action bar as expected (after performing the operation described in paragraph two, of course). Did I get it right this time? |
Wow, you got it! So selecting an android device emulator does matter? Do On Thu, Dec 31, 2015 at 10:55 PM, Kasijjuf notifications@github.com wrote:
|
Thanks for the challenge and glad I could help. Keep in touch. |
@Kasijjuf This helped me too. Thank u brother |
@Laksh05 Glad to hear it |
my app is crashing what does container mean in this code? I am getting error in R.id.container public class MainActivity extends ActionBarActivity {
|
@pri10 The specific view that will hold the |
Okay thanks :) @elmargomez |
Hi, I am not sure what I did wrong, I basically copied and paste the code from the lesson when I was doing my project. The turn out of my code does not look like what the class has so far? Is it the version of my simulation? I am currently doing this in Jelly Bean, while the lesson is using Gingerbread. My simulation does not have settings implemented when I already have done what the code should be?
This is my MainActivity.java
The text was updated successfully, but these errors were encountered: