English 中文(简体)
甲型六氯环己烷
原标题:Classes vs Activities in Android

我是安乐斯发展的开端人,但不是方案规划本身。 无论如何,这个问题可能只是一个bit。

问题在于:所有类别的安乐团活动是否都与统一分析要素有关? 我想有一个“经常”的 Java类,通常可以制造物体,不会混淆如何“去除”和如何“召唤”。

任何帮助都会受到高度赞赏。 增 编

最佳回答

是的,你可以有正规班级,但与统一工会无关。 这与正常的 Java一样。 因此,在Eclipse中,你可以树立像形象一样的新阶层,紧随一页的.。

“在Eclipse中添加一个新类别”/

您最后将采用以下一些守则(例如,我增加了几个实例):

package this.is.your.package;

public class Person{

    private int age;

    public void setAge(int _age)
    {
        age = _age;
    }

}

那么,你就能够建立正常的方法和其他手段。 关于即时或接触贵阶层,你可能必须公布这些活动。 然而,有许多不同的方式这样做,但如上所述,我可以这样做。

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

        Person me = new Person();
        me.setAge(22); //feels old
    }

你们可以看到,这完全是正常的。

问题回答

回答是无。 所有活动都是定期的 Java课,当然,你可以开设许多非统一课堂,如<代码>Application,你可以有助手...... 如果我正确理解你的问题,那么你就会被以下事实所混为一谈:活动没有用户定义的建筑商,只能通过打电话<条码>启动<>> > 代码/代码”方法间接创造,但在其他情况下,活动是 Java的一个共同类别。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签