1

I am new to android. i know only core java.

I saw the declaration

ArrayList<ApplicationInfo> mAppInfo;

in Android sample project. Can anyone explain what is the meaning of above declaration.

2
  • ArrayList of ApplicationInfo type Commented Nov 7, 2011 at 6:35
  • There's nothing android specific here. It's a class member (presumably) declaration with generic type. Commented Nov 7, 2011 at 6:37

4 Answers 4

3

This is core Java as well. Have a look at http://download.oracle.com/javase/1,5.0/docs/guide/language/generics.html

Also, it should most probably be:

List<ApplicationInfo> mAppInfo;
Sign up to request clarification or add additional context in comments.

Comments

1

It's an ArrayList (a container type) which can hold objects of the ApplicationInfo type.

Comments

1

mAppInfo is an ArrayList of ApplicationInfo. (This list contains only ApplicationInfo objects.

It use a generic syntax to declare a reference mAppInfo. The name inside the angle bracket is a class name. For example, we can declare ArrayList<String> or ArrayList<Integer>.

Comments

0

ArrayList is a Class from Java collection framework. You can use it in some ways like arrays but there are more advantages compared to normal arrays.

ApplicationInfo is the type of information you allowed to store in this arrayList. (Could also be String Integer, ... just no primitive Datatyps like int, float, ...)

mAppInfo is the name of the ArrayList.

Link to Java Oracle Documentation for more Information on ArrayLists:

https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html

Good Luck with your work!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.