findViewById in Fragment
In Fragment sub class in Android, you cannot directly use findViewById() to retrieve the control from view , similar with Activity. You need to do a single small step, this.getView(); Note that, to use this method, the view need to created, such as in onOptionsItemSelected
Code
| txtTitle = (EditText)this.getView().findViewById(R.id.txt_title); | 
If you wish to use it in OnCreateView, please do that in this way. At that moment, the view is not created yet, this.getView() will return null.
E.g.
Code
| public View onCreateView(LayoutInflater inflater, ViewGroup container, | |
|                              Bundle savedInstanceState) { | |
|         View view  = inflater.inflate(R.layout.fragment_note_detail, container, false); | |
|   | |
| txtTitle = (EditText) this.getActivity().findViewById(R.id.txt_title); | 
Navigation Drawer is not opening by clicking the app icon
I spent three days about this problem. The Navigation Drawer will show if I swipe the screen from left to right. But that won't show by clicking the app icon. Actually, I missed these lines of codes:
Code
| public boolean onOptionsItemSelected(MenuItem item) { | |
|   | |
|         if (mDrawerToggle.onOptionsItemSelected(item)) { | |
|             return true; | |
|         } | |
|         return super.onOptionsItemSelected(item); | |
|     } | 
if (mDrawerToggle.onOptionsItemSelected(item)) { will call to show the drawer!
Error:No GMSG handler found for GMSG
I added Google Play Ads Service. However, I got this error: "No GMSG handler found for GMSG". No ads is displayed at all. I found the reason, that is because my app has not put in the play store. So, I have to add the my emulator as a test device. 
Like this:
Code
| AdRequest adRequest = new AdRequest.Builder()..addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build(); | |
|         mAdView.loadAd(adRequest); | 
Foreach in Java
I used foreach keyword in C#. I used it to travel element one by one in a list. In Java, there is not such keyword calls foreach. But you can use for to do that:
E.g.
Code
| for(Tag tag : tags){  | |
|   tag.getName(); | |
| } | 


