"Qianfeng-android-day04-spinner, Scrollvie, autocompletetextview,activity Basic Learning:

Source: Internet
Author: User

First, Spinner
Common Properties of 1.Spinner
android:entries= "" Setting the data source for spinner
android:prompt= "" Pop-up box set caption
Android:spinnermode= "" To set popup pop-up mode
Android:popupbackground= "" Sets the background color of the popup box
Common methods of 2.Spinner
Called when an item is selected
Setonitemselectedlistener
Second, the adapter
1. Introduction of the adapter
Introduction and use of 2.ArrayAdapter
arrayadapter<string> adapter = new Arrayadapter<string> (this, Android. R.layout.simple_spinner_item, your data set);
Three, array resources
1. Define the array resource defined in the Strings.xml file in the values folder, as follows:
<string-array name= "Province" >
<item> Guangdong </item>
<item> Guangxi </item>
<item> Hainan </item>
<item> Fujian </item>
</string-array>
2. Get the array resource getresources (). Getstringarray (r.array.province);
Iv. Autocompletetextview
Common methods of Autocompletetextview
Setthreshold (1);//Set start prompt when entering a few characters
setonitemclicklistener//call when clicking on an item

Five, ScrollView
    1. Using
    2.HorizontalScrollView for vertical ScrollView
 
Vi. Activity Preliminary Understanding: "Create, configure, start activity"
  (i), create activity:
  Two ways to create
  1. Use the tools provided by ADT to create the
  2. Create an activity as a normal Java class

  (b), Activity registration configuration:
   activity as one of the four components must be registered in the androidmanifest manifest file
  . If there is no configuration and the activity is started in the program,
   throws an exception (Activitynotfoundexception).
  
  "Additional thinking":
  1. When you set multiple pages in the androidmanifest manifest file, the default startup page will be an error. If you do not have an error, which page is executed?
    The first default startup page for execution settings
  2. When the default startup page is not set in the Androidmanifest manifest file, will an error occur?
    does not error, but the program does not have a startup icon
  (iii), start activity:
   use intent for communication between components in the Android app. An activity uses intent to express his "intentions".
   is commonly used in two ways:
   1.intent Intent = new Intent (mainactivity.this, nextactivity.class);
   2.intent Intent = new Intent ();
     Intent.setclass (Mainactivity.this, Nextactivity.class); There are two types of
    Common startup methods:
   startactivity ();
   startactivityforresult ();//note Use scene, view Demo2


(iv) Exchange of data between activity:
The first way:
A page uses the Putextra () method of the intent object to pass the value, b page uses Getstringextra (), Getintextra () and other series method to receive the value one by one;
The second way: "Common"
A page uses the bundle object to save all the values that need to be passed through the intent Putextras () method, and the B page returns the bundle object using the Getextras () method of the intent object, placing all the received data in the bundle object, Use the bundle's Get series method one by one to remove the data.
Note: If a page uses the Putextras () method to pass a value, the B page uses Getextras () to receive the value. If a page uses the Putextra () method to pass a value, the B page uses the Getbundleextra () method to receive the value.

Is it possible to pass objects between activity? "Mastering the use of serializable"
Serializable usage: Make the object we want to pass inherit serializable

"Qianfeng-android-day04-spinner, Scrollvie, autocompletetextview,activity Basic Learning:

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.