wirelessly tutorial (1): @InjectView

Source: Internet
Author: User

1  Packagecom.mycompany.hungry;2 3 ImportAndroid.annotation.SuppressLint;4 Importandroid.app.Activity;5 Importandroid.content.Intent;6 ImportAndroid.os.Bundle;7 ImportAndroid.view.View;8 ImportAndroid.view.View.OnClickListener;9 ImportAndroid.view.Window;Ten ImportAndroid.widget.TextView; One  A ImportCOM.MYCOMPANY.R; - ImportCom.mycompany.util.InjectView; - ImportCom.mycompany.util.Injector; the  -  Public classWelcomeactivityextendsActivity { - @InjectView (R.id.welcome_start_order) - //Injectview is a highly sought-after ID method, equivalent to Findidbyview, which can save a lot of traditional codes.  + PrivateTextView start; - //when we are going to call the change start in the future, we have to define the start from the start.  +  A@SuppressLint ("Newapi")  at //@SuppressLint ("Newapi"). The Android version will be updated, and the new version brings new features to the new method. The new approach comes in handy, but it doesn't work on a low-version system, and if the compatibility is not right, the app will be crash on the lower version system.  - @Override - protected voidonCreate (Bundle savedinstancestate) { - Super. OnCreate (savedinstancestate); -  - requestwindowfeature (window.feature_no_title); in //full sentence use, syntactic meaning is full screen, but if it is to complete the full screen, you must write the following three sentences: - //requestwindowfeature (window.feature_no_title); to //GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, + //WindowManager.LayoutParams.FLAG_FULLSCREEN); - Setcontentview (r.layout.welcome); theInjector.get ( This). inject (); * //Injector is another Java file. Init views $Start.setonclicklistener (NewOnclicklistener ()Panax Notoginseng //Start is a button system, now set the listener.  - { the  + @Override A  Public voidOnClick (View v) { theIntent Intent =NewIntent (welcomeactivity. This, Homepageactivity.class);  + //The type of the definition intent is the type of intention, and the intention here is to jump to another page from this page.  - startactivity (Intent);  $ //to execute the above instructions, you can not write.  $ finish (); - } - }); the  - }Wuyi  the  -}

wirelessly tutorial (1): @InjectView

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.