Some experience of Android development in junior primary school

Source: Internet
Author: User

1. Settings for several colors of the same textview:

build=new spannablestringbuilder ("Building name *"); Style.setspan (New Foregroundcolorspan (Color.Black), 0, 5, spannable.span_exclusive_exclusive); Style.setspan (New Foregroundcolorspan (color.red), 5, 6, spannable.span_exclusive_exclusive); Build.settext (style);
Show it: Building name* 2. Determine that the input is not empty:
//the building name cannot be emptyBuilding.addtextchangedlistener (NewTextwatcher () {@Override Public voidBeforetextchanged (Charsequence S,intStartintCountintAfter ) {} @Override Public voidOnTextChanged (Charsequence S,intStartintBefore,intcount) {        if(Textutils.isempty (Building.gettext ()) | |Textutils.isempty (Floor.gettext ())|| Textutils.isempty (Telephone.gettext ()) | |Textutils.isempty (Description.gettext ())) {upload.setenabled (false); Toast.maketext (Feedback. This, "Please complete the feedback information", Toast.length_long). Show (); }        Else{upload.setenabled (true); }} @Override Public voidaftertextchanged (Editable s) {}});
3. Pass a value between two interfaces with a value of double type: sender:
New Intent (selectpoint.  this, Feedback. class ); Intent.putextra ("latitude", latitude); Intent.putextra ("Longtitude", longtitude); StartActivity (intent);

Receiving Party:

Intent intent=getintent (); Final double longtitude = Intent.getdoubleextra ("Longtitude", 0); Final double latitude = Intent.getdoubleextra ("latitude", 0);

4. Set the app start dynamic effect (go to: http://blog.csdn.net/nmsoftklb/article/details/12943483)

 Public classWelcomeextendsappcompatactivity {PrivateImageView Welcome; @Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate);        Setcontentview (R.layout.activity_welcome); Welcome= (ImageView) This. Findviewbyid (R.id.welcome); Alphaanimation Anima=NewAlphaanimation (0.3f, 1.0f); Anima.setduration (3000);//Set the animation display timewelcome.startanimation (anima); Anima.setanimationlistener (NewAnimationimpl ()); }    Private classAnimationimplImplementsAnimation.animationlistener {@Override Public voidOnanimationstart (Animation Animation) {welcome.setbackgroundresource (r.drawable.welcome); } @Override Public voidonanimationend (Animation Animation) {skip ();//jump to another page after the animation ends} @Override Public voidonanimationrepeat (Animation Animation) {}}Private voidSkip () {startactivity (NewIntent ( This, Feedback.class));    Finish (); }}

5. Remove the blue default header above the interface

 Public class extends Appcompatactivity
Change into
 Public class extends Activity

6.edittext tip for Android:hint,edittext default text is Android:text

Some experience of Android development in junior primary school

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.