英文:
I want to get some value from other class dynamicly for ex:
问题
public class Data{
public class Friend{
public int[] jane = {something};
public int[] frank = {something};
public int[] john = {something};
}
}
我想在其他类中像这样使用这个变量:
class GetData {
int[] getName = Data.classname.friendName;
}
英文:
My code
public class Data{
Public class Friend{
public int[] jane = {somthing};
public int[] frank = {somthing};
public int[] john = {somthing};
}}
I wanna use this variable in other class like this:
class GetData{
int[] getName = Data."className"."friendName";
}
</details>
# 答案1
**得分**: 0
```java
public class GetData{
int[] getName = Data."className"."friendName";
}
// 将 getdata 类继承到你的第二个类。
public class MainActivity extends AppCompatActivity implement GetData{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
英文:
public class GetData{
int[] getName = Data."className"."friendName";
}
inherit the getdata class to your second class.
public class MainActivity extends AppCompatActivity implement GetData{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
答案2
得分: 0
@安卓远程控制,那么,您试图实现什么,您在这里所指的动态是什么意思?请明确您的问题。
英文:
@android remote control, So, what you are trying to achieve, what do you mean by dynamic here? please be clear with your question.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论