I'm learning android development and I need a hint on the inner working of the whole thing.
I'm using the code showed here
In
public void sendMessage(View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
}
I want to know what "this" is
In the guide I read:
A Context as its first parameter (this is used because the Activity class is a subclass of Context)
What does Context class do? How is it used? Why does Activity inherit from it?
Now the main question:
If you check the whole example, they start the other activity directly from the button with the sendMessage()
method. There is a way to use the onClick event listener and start the activity from there so I can do some stuff before starting the activity (like initializing some variables or so)?
And, is it really necessary editing the android manifest file by hand?
They put all the stuff in there about editing the android manifest everytime you add an activity. Do I have to do that exact thing every time I add an activity? I would like to edit the AndroidManifest.xml
file more conscientiously, knowing what I'm typing in and why. In that guide all is put up mysteriously and they don't explain nothing.