如何在androidstudio中从Java文件获取字符串到其他文件

如何在androidstudio中从Java文件获取字符串到其他文件,java,android,variables,Java,Android,Variables,我有这个代码,我想把变量从java_2的java文件传输到java_2_1,I 尝试使用扩展的方法,但不起作用: public class java_2 extends java {//There is java_1, which is the first, but //the String transfer is only between java_2.java and

我有这个代码,我想把变量从java_2的java文件传输到java_2_1,I 尝试使用扩展的方法,但不起作用:

    public class java_2 extends java {//There is java_1, which is the first, but
                                  //the String transfer is only between java_2.java and
                                  //java_2_1.java;

        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.dise_2);
            botonRETURN1();
            botonAHEAD1();

//I WANT TO TRANSFER ALL THIS VARIABLES TO java_2_1, but don't know how.
            final EditText A,B,C,D,E,F;
            String AA,BB,CC,DD,EE,FF,G;
            A=(EditText)findViewById(R.id.A);
            B=(EditText)findViewById(R.id.B);
            C=(EditText)findViewById(R.id.C);
            D=(EditText)findViewById(R.id.D);
            E=(EditText)findViewById(R.id.E);
            F=(EditText)findViewById(R.id.F);
            AA=A.getText().toString();
            BB=B.getText().toString();
            CC=C.getText().toString();
            DD=D.getText().toString();
            EE=E.getText().toString();
            FF=F.getText().toString();
            G=AA+BB+CC+DD+EE+FF;
        }
致:


这是行不通的,你可以让所有你想要的数据都是静态的,也可以设置一个getter方法。你怎么使用getter方法?。简单的oop让函数返回一个值试试搜索getter和setters Java我想知道,如果人们不了解oop和Java,为什么要尝试为Android创建应用程序。
public class java_2_1 extends java_2{//I try doing this heritance thing, but it doesn't work;
    protected void onCreate(Bundle savedInstanceState) {
    }

}