2013-09-25 22 views
-1

在我的應用中,我想使用galaxy s4 S- transnslator.So是否可以使用它?通常情況下,我可以從我的應用程序調用另一個應用程序。我對android很新,所以我不知道它是否可能。因此,如果可能的話,請告訴我。我認爲通過採取適當的行動意圖,我們可以做到這一點。我可以在我的應用中整合S翻譯器

Intent i; 
PackageManager manager = getPackageManager(); 
try { 
i = manager.getLaunchIntentForPackage("app package name"); 
if (i == null) 
    throw new PackageManager.NameNotFoundException(); 
i.addCategory(Intent.CATEGORY_LAUNCHER); 
startActivity(i); 
} catch (PackageManager.NameNotFoundException e) { 

} 

感謝名單

回答

2

是,通過意圖。

例如:

final Intent intent = new Intent(); 
intent.setAction(Intent.ACTION_MAIN); 
intent.setClassName("com.example.theotherapp", "com.example.theotherapp.MainActivity"); 
startActivity(intent); 

這就是所謂的明確意圖,因爲你明確說明哪些組件應該對此作出迴應。您也可以使用隱式意圖,在其中指定您期望的組件類型,並且操作系統和/或用戶選擇最合適的組件。

如果可以選擇,則隱含意圖是首選。

這可能會幫助你。

+0

Thanx for ur response.So通過這種方式,我可以使用三星GalaxyS翻譯器。軟件包名稱是com.sec.android.app.translator。 –

+0

是的,你可以嘗試,如果它的工作,請接受答案。謝謝 – Droid

相關問題