My teacher asked me this question and I have no idea what the answer. I use eclipse to build my android apps and the teacher uses the command line on a mac. Are there any methods that tell me how many activites there are. Our will the manifest file tell me. Any Thoughts on this question. I'm really confused.
Asked
Active
Viewed 2,234 times
3
-
How many times do you see `extends Activity` in your project? – takendarkk Oct 17 '14 at 00:01
-
Every activity should be declared in the manifest, but that won't yield the right answer if you've forgotten to declare some. Maybe the point of this exercise is to ensure that you've declared them all. – Kevin Krumwiede Oct 17 '14 at 00:02
-
@Takendarkk, more like: how many times do you see `extends X` where `X extends Activity` (or extends something else that `extends Activity`) – drew moore Oct 17 '14 at 00:04
-
I'm confused by the question. You can count them from the manifest by hand, but programmatically that is a whole different story. And compile method doesn't make a difference. – zgc7009 Oct 17 '14 at 00:05
3 Answers
1
If you don't need to count them in the app you could use this command to print the stack:
adb shell dumpsys activity activities

soundsofpolaris
- 596
- 3
- 12
0
If you're following naming conventions, you could use the Java search in Eclipse to search your project for declarations of types that match the pattern *Activity
.

Kevin Krumwiede
- 9,868
- 4
- 34
- 82
0
if you should do it via code you can use GET_ACTIVITIES http://developer.android.com/reference/android/content/pm/PackageManager.html#GET_ACTIVITIES

ligi
- 39,001
- 44
- 144
- 244