In one of the earlier article you have seen how the back button works. The user can navigate through activity history by the back button click.
The up button is different. It allows you to traverse through the Activity hierarchy.
Let’s say you have MainActivity. From MainActivity you navigate to DetailActivity. Now if you have declared MainActivity to be a parent of DetailActivity then you can navigate back to it using an up button.
To illustrate this I have added a DetailActivity to the ThemeDemoApp, as shown in the video.
Please follow the video to understand this better and you can refer to the source code for the example App here.
Watch DRU’s Journey and how its changing Food industry
“If you can explain the WHY of things then that makes a huge difference to People’s Motivation. They understand Purpose. Process of Learning and how it should be. Make it interesting.” – Elon Musk
As Elon Musk has rightly said answer to the above question can be very useful to build and keep your interest to Learn something.
Elon also mentions the use of Gamification to make learning fun.
Here is a video in which Elon Musk talks about this and more at the Khan Academy.
Image and Video Source – Youtube – Khan Academy
I wrote a whole Post on this topic sometime back. You might benefit from reading that.
The Google Lunar XPRIZE is a $30 million competition for the first privately funded team to send a robot to the moon, travel 500 meters and transmit video, images and data back to the Earth.
Deepana Gandhi from India is leading one such team – Team Indus
16 teams are competing for this Prize Money. Here is a a documentary web series about the people competing for the Google Lunar XPRIZE
In this Article you will learn how to add a Share feature to your App.
This will enable users of your app to share content. For instance a user might want to share an image being displayed on the App, using a Messenger or an Email.
In order to do this you need to add an Action Provider to the Action Bar.
Here are the steps:
1. Add a share action provider to the menu xml file.
2. Specify the content to be passed using an intent in your Activity.
Please refer to the code here
If you want to add Menu Items to the Action Bar then you will have to override two methods in your Activity Class.
- onCreateOptionsMenu – To display Menu
- onOptionsItemSelected – To handle user clicks
Follow the video to understand this better.
You should now be familiar with the Android Themes from the last Article.
Action Bars can be used to add items or shortcuts. Like if the user wants to quickly search for something or add something or even modify the app settings.
Let’s see how you can add such functionality.
There are three primary components which needs to be modified.
1. Menu resource file for the activity.
2. The onCreateOptionsMenu method.
3. The onOptionsItemSelected method.
You can find the menu resource file in the /menu folder. It’s auto generated by the Android Studio when you create a new Project.
The other two methods needs to be overridden in the Activity.
Follow the video to understand how to add this feature. Source code is available here.
Note : For the ThemeDemoApp you need to first remove the v7 dependency, as it creates a conflict when you try to use showAsAction attribute.