2010-06-26 3 views
1

에서 android.com 나는 안드로이드의 중심 기능을 읽을 수 있습니다 당신 자신의 응용 프로그램에서 다른 응용 프로그램의 요소를 사용할 수 있습니다.이 라인에 관심이 있어요. 1) 안드로이드 마켓에서 다운로드 한 .apk를 어떻게 응용 프로그램에 사용할 수 있습니까? 2) 우리가 만든 응용 프로그램을 새로 만든 응용 프로그램에 어떻게 사용할 수 있습니까?내 응용 프로그램에 .apk 파일을 어떻게 사용할 수 있습니까?

가이 스 니펫 (가능한 경우)에 대한 안내를 알려주십시오. Rajendar

답변

0

안드로이드 응용 프로그램의 요청 작업이 다른 응용 프로그램에 거주하는 소프트웨어에 의해 수행 될 수 있도록 Intents를 사용

감사합니다. 인 텐트에 대한 자세한 내용과 응용 프로그램이 브라우저 응용 프로그램에 웹 페이지를 표시하도록 요청하는 방법의 예는 my answer to this question을 참조하십시오.

1

난 당신이 that을 의미 같아요

안드로이드의 중심 기능은 하나의 응용 프로그램이 다른 응용 프로그램 의 요소의 사용을 만들 수 있다는 것입니다 (제공되는 응용 프로그램은 을 허용). 필요 응용 프로그램이 이미지의 스크롤 목록을 표시하고 다른 응용 프로그램이있는 경우 예를 들어, 는, 을 작업을 할 그 스크롤에 전화보다는 개발할 수 있습니다, 적절한 스크롤을 개발하고 다른 사람이 사용할 수 를 만든 당신의 개인적인. 귀하의 응용 프로그램에 다른 응용 프로그램의 코드 또는 코드가 통합되어 있지 않습니다. 오히려 필요가 생길 때 다른 응용 프로그램의 일부를 시작합니다. .

마지막 두 문장이 중요합니다. 그리고 링크는 그것에 대한 더 많은 정보를 제공합니다. 그러나 간단히 말하면 응용 프로그램 작성자는 다른 사람들이 재사용 할 수 있도록 코드를 작성할 수 있습니다. 그/그녀는 그/그녀의 응용 프로그램의 AndroidManifest.xml에 "의도 필터"를 넣어서 할 수 있습니다. 예 : Google의 카메라 응용 프로그램 (카메라 기능과 이미지 갤러리를 제공하는 응용 프로그램 - 예, 응용 프로그램이 홈 화면에있는 많은 "진입 점"= 아이콘을 "노출"할 수 있음)은 다음과 같이 활동 정의 (많은 것 중 하나)를 나타냅니다.

하나는 전송 의도하여 이미지 기능을 자르기있어 사용할 수 있다는 것을 의미한다
<activity android:name="CropImage" android:process=":CropImage" android:configChanges="orientation|keyboardHidden" android:label="@string/crop_label"> 
    <intent-filter android:label="@string/crop_label"> 
     <action android:name="com.android.camera.action.CROP"/> 
     <data android:mimeType="image/*"/> 
     <category android:name="android.intent.category.DEFAULT"/> 
     <category android:name="android.intent.category.ALTERNATIVE"/> 
     <category android:name="android.intent.category.SELECTED_ALTERNATIVE"/> 
    </intent-filter> 
</activity> 

: 하나 하나의 활동으로 정의 할 수 있습니다

/* prepare intent - provide options that allow 
Android to find functionality provider for you; 
will match intent filter of Camera - for matching rules see: 
http://developer.android.com/guide/topics/intents/intents-filters.html#ires */ 
Intent i = new Intent("com.android.camera.action.CROP"); 
i.addCategory(Intent.CATEGORY_DEFAULT); 
i.setType("image/*"); 
/* put "input paramters" for the intent - called intent dependent */ 
i.putExtra("data", /*... Bitmap object ...*/); 
i.putExtra(/*... other options, e.g. desired dimensions ...*/); 
/* "call desired functionality" */ 
startActivityForResult(i, /* code of return */ CROPPING_RESULT_CODE); 

CROPPING_RESULT_CODE 외부 활동이 반환하는 구분하는 데 사용됩니다 (helpfull 하나는 여러 외부 함수를 호출하는 경우)에서 제공되며 전화 활동의 onActivityResult() meth "원격"응용 프로그램이 완료되면 호출되는 od - 예 :

protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
    switch (requestCode) { 
    case CROPPING_RESULT_CODE: 
     /* ... crop returned ... */ 
     if (data != null) { 
      /* get cropped bitmap */ 
      Bitmap bmp = data.getParcelableExtra("data");  
      /* ... and do what you want ... */ 
     } 
    case ANOTHER_RESULT_CODE: 
     /* ... another external content ... */ 

    } 
} 

다른 옵션은 다른 서비스 또는 컨텐츠 제공자를 사용합니다.

더 궁금한 점이 있으시면 언제든지 주저하지 마십시오.

관련 문제