Intent Standard Activity Actions, 䳿 Activity. , ACTION_DIAL , MediaStore MediaStore.Audio.Media 䳿 , ; DownloadManager , RingtoneManager , . Activity :
Intent intent = new Intent(Intent.ACTION_DIAL); startActivity(intent);
4.6 Activity
Activity, . Activity , startActivityForResult(Intent, int) , . onActivityResult(int, int, Intent), Activity.
, (extra- ) Activity. - , . ᒺ Intent put() get() . Extra-
ᒺ Bundle砠 젠
putExtras() getExtras().
, Activity EditContactActivity ContactListActivity :
//
private static final int IDM_EDIT = 102; private long mId = -1;
// ContactItem
// NAME PHONE,
// getName(),getPhone(),setName(String),setPhone(String) ArrayList<ContactItem>mList;
private ListAdaptermAdapter;
mList = new ArrayList<ContactItem> ();
mId=this.getSelectedItemId();
ContactItem mItem = mList.get((int)mId); Intent intent = newIntent();
// extra- intent.putExtra(ContactItem.NAME, mItem.getName()); intent.putExtra(ContactItem.PHONE, mItem.getPhone());
// Activity intent.setClass(this, EditContactActivity.class);
// Activity startActivityFotrResult(intent, IDM_EDIT);
Activity , setResult(int), Activity. Activity, , RESULT_CANCELE, RESULT_OK RESULT_FIRST_USER.
private EditText mName; private EditTextmPhone;
Intent t = newIntent();
// t.putExtra(ContactItem.NAME,mName.getText().toString()); t.putExtra(ContactItem.PHONE,mPhone.getText().toString()
|
|
);
// Activity setResult(RESULT_OK, t);
finish();
, Activity ᒺ Intent, - . Activity Activity.onActivityResult(), , startActivityForResult() Activity:
protected void onActivityResult(int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK){
Bundle extras = data.getExtras(); switch(requestCode){
case IDM_ADD:
mList.add(new ContactItem(
extras.getString(ContactItem.NAME), extras.getString(ContactItem.PHONE)));
break;
case IDM_EDIT:
mList.set((int)mId, new ContactItem(extras.getString(ContactItem.NAME), extras.getString(ContactItem.PHONE)));
break;
}
}}
, 䳿 Activity,
Activity Activity, android:name,android:label:
<application >
<activity android:name=.ContactListActivity android:label=@string/app_name>
</activity>
<activity android:name=.NewContactActivity android:label=@string/title_add>
</activity>
<activity android:name=.EditContactActivity android:label=@string/title_edit>
</activity>
</application>
4.7 Intent-
Intent- ᒺ Intent, .
, ᒺ Intent. Intent. Intent ᒺ Intent: , . , - Activity, :
<activity android:name=.ContactListActivity android:label=@string/app_name>
<intent-filter>
<action android:name=android.intent.action.MAIN />
<category android:name=android.intent.category. LAUNCHER />
</intent-filter>
</activity>
Intent , , . , ᒺ Intent-, , Intent-.
, ContactListActivity , 4.6, :
<activity android:name=.ContactListActivity android:label=@string/app_name>
<intent-filter>
<action android:name=android.intent.action.MAIN />
<category android:name=android.intent.category. LAUNCHER />
</intent-filter>
<intent-filter>
<action android:name= com.samples.app.contact. VIEW_CONTACTS />
<category android:name=android.intent.category. DEFAULT />
</intent-filter>
</activity>
ᒺ Intent 䳺: startActivity(new Intent(com.samples.app.contact.VIEW_ CONTACTS));
Android-, ( 4.1).
|
|
4
1 | |
2 | |
3 | |
4 | . Գ |
5 | () |
6 | |
7 | - |
8 | |
9 | |
10 | Handmade |
, ;
;
;
;
.
1. Android.
2. ?
3. Activity.
4. Activity 䳿 ?
5. ᒺIntent?
6. ᒺIntent.
7. Activity?
8. Activity .
9. Activity .
10. Intent- .
: Kotlin Android.http://www.fandroid.info/urok-1-razrabotka-na-kotlin-ustanovka-android-studio/
64Windows, 3 Androidstudio, 3 Android
https://www.youtube.com/watch?v=-uP7WVpvbiI
˲
1. . .NET Compact Framework. , 2006. - 736.
2. . . Google Android: / . . .: - , 2011. 448.
3. .. Android 2: . .: ,2011.
672 .
4. .. Java 2 Micro Edition / .. . .: , 2004. 336.
5. B.. J2ME / B.. . . .: -, 2002. 352.
6. .. Bluetooth. . / .. , .. . .: , 2004. 203.
7. . Android 24 . Google / ., . .: , 464.
8. . Android 2: / ; . . .: , 2011. 672.