的Hello World [关于&QUOT noob问题;安卓教程 [英] Noob question about "Hello World" Android tutorial

查看:106
本文介绍了的Hello World [关于&QUOT noob问题;安卓教程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚开始接触Android开发和Java。所以,这里的code我正在使用:

Just getting started with Android development and Java. So, here's the code I'm working with:

package com.example.helloandroid;

import android.app.Activity;
import android.os.Bundle;

public class HelloAndroidActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

什么是这里宣布的onCreate()方法的目的:

What is the purpose of declaring the onCreate() method here:

public void onCreate(Bundle savedInstanceState) {

然后,使用超级调用的onCreate()方法在这里:

Then using super to call the onCreate() method here:

super.onCreate(savedInstanceState);

这是否意味着你正在调用从活动类而不是HelloAndroidActivity类的onCreate()方法?如果是这样,什么是在HelloAndroidActivity类声明的同名方法的意义呢?

Doesn't this mean that you are calling the onCreate() method from the Activity class rather than the HelloAndroidActivity class? If so, what is the point of declaring a method with the same name in the HelloAndroidActivity class?

感谢您的任何澄清。

推荐答案

的onCreate 是那种你的主要(字串[] args)在正常的Java功能。这是你设置你的code。

onCreate is sort of your main(String[] args) function in normal Java. It is where you setup your code.

这篇关于的Hello World [关于&QUOT noob问题;安卓教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆