I'm very new to Android development and I'm trying to create a view, which can be easily done by alloc
then initWithFrame ...
in Obj-C with Cocoa Touch, but in Java it uses the new ..()
method and I'm stuck with defining the variable context
, the parameter for LinearLayout()
.
I see some people use this
as argument, namely new LinearLayout(this)
, but I don't understand what this argument actually does and I would appreciate if someone can give me a little bit guidance regarding what to put into as the argument.
LinearLayout layout = new LinearLayout(context);
What should context
be? How should I define it? What does it do? What value should I assign it to?