Accessing classes from other apk
I would like to know if it is possible to access directly a class in an apk from another apk.
By example, in the notepad tutorial, an activity is launched by these lines of code:
Intent i = new Intent(this, NoteEdit.class);
startActivit开发者_StackOverflow中文版yForResult(i, ACTIVITY_CREATE);
This code accesses directly NoteEdit.class. But in this tutorial, the class containing this code and the NoteEdit class are in the same apk.
I would like to know if the same constructor for an intent could be use if the activity is in another apk.
System classes are, off course, accessible, but they seem to be in a jar file, android.jar. So there seems to be a way to access directly classes inside jar files, I would like to know if there is a way to access direclty classes in other apk.
I have some sample code for you. Here you can start the clock-app of HTC smartphones
Intent i = new Intent(Intent.ACTION_VIEW);
i.setComponent(new ComponentName("com.htc.android.worldclock",
"com.htc.android.worldclock.WorldClockTabControl"));
startActivity(i);
精彩评论