�u���E�U��n�}�A�X�g���[�g�r���[�̊�AIntent�Ƃ́H�FAndroid�œ����g��Java�A�v���쐬����i3�j�i3/3 �y�[�W�j

» 2009�N02��05�� 00��00�� ���J
[�������C������ЃC�[�t���[]
�O�̃y�[�W�� 1|2|3 �@�@�@�@�@�@

Editor Activity�̎���

�@�N������鑤��Editor Activity�̃\�[�X�R�[�h�ł��B

 1 package com.example.android.dual;
 2
 3 import android.app.Activity;
 4 import android.content.Intent;
 5 import android.os.Bundle;
 6 import android.view.View;
 7 import android.widget.Button;
 8 import android.widget.EditText;
 9
10 public class Editor extends Activity {
11
12     @Override
13     public void onCreate(Bundle savedInstanceState) {
14         super.onCreate(savedInstanceState);
15         setContentView(R.layout.editor);
16
17         Button button = (Button)findViewById(R.id.Button01);
18
19         Bundle extras = getIntent().getExtras();
20         if (extras != null) {
21             EditText editText = (EditText)findViewById(R.id.EditText01);
22             editText.setText(extras.getCharSequence("TEXT"));
23         }
24
25         button.setOnClickListener(new View.OnClickListener() {
26
27             @Override
28             public void onClick(View v) {
29                 Intent intent = new Intent();
30                 EditText editText = (EditText)findViewById(R.id.EditText01);
31                 CharSequence text = editText.getText();
32                 intent.putExtra("TEXT", text);
33                 setResult(RESULT_OK, intent);
34                 finish();
35             }
36
37         });
38     }
39 }

�@13�s�ڂ���onCreate()���������Ă��܂��B�N������鑤�̓����Ƃ��ẮA19�s�ڂɂ���getIntent()�œn���ꂽIntent���擾���AIntent����getExtras()�ł��ׂĂ̒lj�����Bundle�Ƃ��Ď��o���Ă��܂��BBundle��null�ł͂Ȃ�������AEditText�Ɏ󂯎�����lj�����ݒ肵�Ă��܂��B

�@�{�^���������ꂽ�Ƃ��̏������N���[�Y�A�b�v���ďڂ������Ă݂܂��傤�B

27             @Override
28             public void onClick(View v) {
                   //�t������Ԃ����߂�Intent���쐬
29                 Intent intent = new Intent();
30                 EditText editText = (EditText)findViewById(R.id.EditText01);
31                 CharSequence text = editText.getText();
                   //Intent�ɕt������t�^
32                 intent.putExtra("TEXT", text);
                   //���ʃR�[�h�ƕt����������Intent��setResult()���Ăяo��
33                 setResult(RESULT_OK, intent);
                   //finish()��Activity���I��
34                 finish();
35             }

�@29�s�ڂ�Intent���쐬���Ă��܂��B����͖߂�悪���܂��Ă���̂ŁA�f�t�H���g�R���X�g���N�^���g�p���Ă��܂��B

�@33�s�ڂŌ��ʃR�[�h�ƕt����������Intent���Ăяo�����ɕԂ��Ă��܂��B

�@34�s�ڂ�finish()�́A���݂�Activity���I�������邽�߂ɌĂяo���܂��B����͑O���Activity�̃��C�t�T�C�N���ŐG�ꂽ���\�b�h�ł��ˁB

�uAndroid Manifest Editor�v��Application Nodes��Activity��lj�

�@2�‚�Activity���g���ɂ́AApplication Nodes�ɐݒ肷��K�v������܂��BAndroidManifest.xml��Eclipse��Ń_�u���N���b�N����ƁAADT�̋@�\�̂P�uAndroid Manifest Editor�v�œ��e��ҏW�ł��܂��B�mApplication�n�^�u��I�����āA�mApplication Nodes�n��2�–ڂ�Activity��lj����܂��B

}6@قActivitysۂ̏ԑJ �}6�@Application Nodes��Activity��lj������Ƃ���

�@Activity�̖��O�̐擪�Ɂu.�v���t���Ă��܂��B���̃h�b�g�̓J�����g�p�b�P�[�W��\���Ă��āA�����Ă��Ȃ��Ă��\���܂���B

�@�Ȃ��A����̃A�v���̓p�b�P�[�W���ucom.example.android.dual�v�ŁAActivity��com.example.android.dual.Main�N���X�Ȃ̂ŁA�w���Main�ł�.Main�ł��\���܂���B�������AActivity��com.example.android.dual.foo.Main�Ȃ�A�w��́ucom.example.android.dual.foo.Main�v���u.foo.Main�v�łȂ���΂Ȃ炸�A�ufoo.Main�v�ł̓G���[�ɂȂ�܂��i�T�u�p�b�P�[�W�w��ł͂Ȃ�foo�p�b�P�[�W��Main���w�肵�Ă��邱�ƂɂȂ邽�߁j�B

Intent���g����Web�u���E�U��n�}�A�X�g���[�g�r���[

�@Dual Activity�𓮍삳���Ă݂āA�R�[�h�𕹂��ǂނ��ƂŁA��ʑJ�ڂƏ��̎󂯓n���̕��@�������ł����̂ł͂Ȃ����Ǝv���܂��B���ɁAIntent�̈قȂ�g���������Ă݂܂��B

�@�ȉ��̃A�v�����_�E�����[�h����Eclipse�ɃC���|�[�g���Ă��������B

�ҏW�����F�ŐV�̊‹��ł́A�T���v���R�[�h��Eclipse�ɃC���|�[�g����ƁA�R���p�C���G���[���������邱�Ƃ�����܂��B�Ώ��@�͘A�ڑ�2��́w2011�N9��23���NjL�uAndroid�̃o�[�W�����Ⴂ�ɂ��T���v���̓���ɂ‚��ĕ⑫�v�x�����Q�Ƃ�������

�@��ʂ͂���Ȋ����ł��B

}7@ActivityĊJۂ̏ԑJ �}7�@Intent Caster�̉�ʃC���[�W

�@���̃A�v���͓��͂���Uri�ƑI�������A�N�V�����ŁA�N������Activity���V�X�e���ɔ��f�����܂��B

Intent Caster��Main.java�̃\�[�X�R�[�h���ꕔ���� 30     @Override
31     public void onClick(View v) {
32         try {
33             EditText editText = (EditText)findViewById(R.id.EditText01);
34             Spinner spinner = (Spinner)findViewById(R.id.Spinner01);
35             Intent intent = new Intent(spinner.getSelectedItem().toString(),Uri.parse(editText.getText().toString()));
36             startActivity(intent);
37         } catch (Exception e) {
38             TextView textView = new TextView(Main.this);
39             textView.setText(e.getMessage());
40             Dialog dialog = new Dialog(Main.this);
41             dialog.setTitle(e.getClass().getName());
42             dialog.setContentView(textView);
43             dialog.show();
44         }
45     }

�@�厖�Ȃ̂�35�s�ڂ�36�s�ڂł��B

�@35�s�ڂŁAEditText�ɓ��͂��ꂽUri�iURI��\���N���X�j��Spinner�i�R���{�{�b�N�X�̃N���X�j�őI�����ꂽ�A�N�V������Intent�ɐݒ肵�Ă��܂��BUri�ƃA�N�V�����̏���̑g�ݍ��킹��Intent���쐬����ƁA����Intent���g�p���Ă��炩����Android�������Ă���Activity���N���ł��܂��B

�@�g�ݍ��킹�ƋN������Activity�́A�ȉ����\3�̂Ƃ���ł��B

Uri �A�N�V���� Activity�Ɛ���
�Ehttp://web_address
�Ehttps://web_address
android.intent.action.VIEW Web�u���E�U���N��
�E�󔒕���
�Ehttp://web_address
�Ehttps://web_address
android.intent.action.WEB_SEARCH Web�u���E�U�Ńf�o�C�X�̏ꏊ�̃t�@�C�����J���i���j
�Etel:phone_number android.intent.action.CALL �d�b�𔭐M
�Etel:phone_number
�Evoicemail:
android.intent.action.DIAL �d�b�ԍ����͉�ʂ��N��
�Egeo:latitude,longitude
�Egeo:latitude,longitude?z=zoom
�Egeo:0,0?q=my+streeet+address
�Egeo:0,0?q=business+near+city
android.intent.action.VIEW �n�}�A�v���P�[�V�������N��
�Egoogle.streetview:cbll=lat,lng
&cbp=1,yaw,,pitch,zoom
&mz=mapZoom
android.intent.action.VIEW �X�g���[�g�r���[���N��
�\3�@Uri�ƃA�N�V�����̑g�ݍ��킹�ƋN������Activity
���L�����J���_�i2009�N2��5���j�̍ŐV�‹��uAndroid SDK 1.0 Release 2�v�ł́AWEB_SEARCH�͐���ɋ@�\���Ȃ��B���|�[�g����Ă���̂ŁA��������C�����ł��낤

�@�n�}�A�v���P�[�V�����͒n����Z���Ō������Ă����̂Ŏ���͂��”\�ł����A�ܓx��y�x�A���[��s�b�`�͎���͂���̂͂��Ȃ莊��̋Ƃł��B

�@�����̃A�v���ƒn�}�A�v����X�g���[�g�r���[�Ƃ̘A���́AIntent�ɐݒ肷��Uri�̍쐬���L���ɂȂ�܂��B�����̂���ǎ҂������悤�Ȃ�A���̕ӂ�𒚔J�ɐ������悤���ȂƎv���܂��B

����́A���C�A�E�g��E�B�W�F�b�g�ɂ‚���

�@����Intent�ɂ‚��ẮA����łقڔ������炢�����������ȁA�Ƃ��������ł��B����͉�ʂ̍\���i���C�A�E�g��E�B�W�F�b�g�j�ɂ‚��Đ�������\��ł��B


�uAndroid�œ����g��Java�A�v���쐬����v�o�b�N�i���o�[
�O�̃y�[�W�� 1|2|3 �@�@�@�@�@�@

Copyright © ITmedia, Inc. All Rights Reserved.

'; this.insertTarget = document.querySelector('#cmsBody .subscription') || document.querySelector('#cmsBody .inner'); }; BodyAdIMSWithCCE.prototype = Object.create(BodyAdContent.prototype); BodyAdIMSWithCCE.prototype.activate = function () { refreshGam('InArtSpecialLink'); } // global reference window.itm = itm; //entry point BodyAdEventBase.polyfill(); const bodyAdManager = BodyAdManager.getInstance(); bodyAdManager.addEventListener(BodyAdManager.EVENTS.READY, function (ev) { bodyAdManager.loadAdvertise(); }); bodyAdManager.init(); })();
�X�|���T�[����̂��m�点PR

���ڂ̃e�[�}

Microsoft  WindowsőO2025
AI for GWjAO
[R[h^m[R[h Zg by IT - ITGWjArWlX̒SŊ􂷂gD
Cloud Native Central by IT - XP[uȔ\͂gD
�V�X�e���J���m�E�n�E �y�����i�r�zPR
���Ȃ��ɂ������߂̋L��PR

RSS�ɂ‚���

�A�C�e�B���f�B�AID�ɂ‚���

���[���}�K�W���o�^

��IT�̃��[���}�K�W���́A �������A���ׂĖ����ł��B���Ѓ��[���}�K�W�������w�ǂ��������B