将Android应用程序的代码修改为多个屏幕
我有一个Android应用程序可能会发生变化,具体情况如下: 要启动的应用程序有一个单屏幕配置和数据管理(应用程序本身),我想修改它,使其具有相同的应用程序,但在多个屏幕上(屏幕设置、应用程序、信息等),还包括菜单选项 在onCreate中,我有几个方法,其中还有几个类,我需要离开(否则)并与每个类进行交互,就像我可以做的那样 代码看起来像这样将Android应用程序的代码修改为多个屏幕,android,package,Android,Package,我有一个Android应用程序可能会发生变化,具体情况如下: 要启动的应用程序有一个单屏幕配置和数据管理(应用程序本身),我想修改它,使其具有相同的应用程序,但在多个屏幕上(屏幕设置、应用程序、信息等),还包括菜单选项 在onCreate中,我有几个方法,其中还有几个类,我需要离开(否则)并与每个类进行交互,就像我可以做的那样 代码看起来像这样 package com.Test1; 导入com.Test1.R.drawable 公共类Test1活动扩展了活动{ public handler_t
package com.Test1;
导入com.Test1.R.drawable
公共类Test1活动扩展了活动{
public handler_thread handlerThread;
public TestInterface uartInterface;
EditText readText;
EditText writeText;
Spinner Option1Spinner;
Button writeButton, configButton;
byte[] writeBuffer;
public Context global_context;
public boolean bConfiged = false;
public SharedPreferences sharePrefSettings;
Drawable originalDrawable;
public String act_string;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
readText = (EditText) findViewById(R.id.ReadValues);
writeText = (EditText) findViewById(R.id.WriteValues);
global_context = this;
configButton = (Button) findViewById(R.id.configButton);
writeButton = (Button) findViewById(R.id.WriteButton);
originalDrawable = configButton.getBackground();
'
'
'
configButton.setOnClickListener(new View.OnClickListener() {
// @Override
public void onClick(View v) {
'
'
'
}
});
/* handle write click */
writeButton.setOnClickListener(new View.OnClickListener() {
// @Override
public void onClick(View v) {
'
'
'
}
}
});
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
handlerThread = new handler_thread(handler);
handlerThread.start();
}
protected void cleanPreference(){
'
'
'
}
public class SelectedListener implements OnItemSelectedListener {
public void onItemSelected(AdapterView<?> parent, View view, int pos,
'
'
'
}
public class SelectedListener implements OnItemSelectedListener {
public void onItemSelected(AdapterView<?> parent, View view, int pos,
'
'
'
}
//@Override
public void onHomePressed() {
onBackPressed();
}
public void onBackPressed() {
super.onBackPressed();
}
private class handler_thread extends Thread {
Handler mHandler;
/* constructor */
handler_thread(Handler h) {
mHandler = h;
}
public void run() {
Message msg;
while (true) {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
}
status = Interface.ReadData(4096, readBuffer,actualNumBytes);
if (status == 0x00 && actualNumBytes[0] > 0) {
msg = mHandler.obtainMessage();
mHandler.sendMessage(msg);
}
}
}
}
公共处理程序\u线程handlerThread;
公共证人界面;
编辑文本-阅读文本;
编辑文本writeText;
旋转器选件1旋转器;
按钮写入按钮、配置按钮;
字节[]writeBuffer;
公共语境&全球语境;
公共布尔值bConfiged=false;
公共SharedReferences sharePrefSettings;
可绘制的原始可绘制的;
公共字符串;
@凌驾
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
readText=(EditText)findViewById(R.id.ReadValues);
writeText=(EditText)findViewById(R.id.WriteValue);
全局上下文=此;
configButton=(按钮)findViewById(R.id.configButton);
writeButton=(按钮)findViewById(R.id.writeButton);
originalDrawable=configButton.getBackground();
'
'
'
configButton.setOnClickListener(新视图.OnClickListener(){
//@覆盖
公共void onClick(视图v){
'
'
'
}
});
/*句柄写入单击*/
writeButton.setOnClickListener(新视图.OnClickListener(){
//@覆盖
公共void onClick(视图v){
'
'
'
}
}
});
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT\u输入\u状态\u始终\u隐藏);
handlerThread=新处理程序\线程(处理程序);
handlerThread.start();
}
受保护的空首选项(){
'
'
'
}
公共类SelectedListener实现了OnItemSelectedListener{
已选择公共视图(AdapterView父视图、视图、int pos、,
'
'
'
}
公共类SelectedListener实现了OnItemSelectedListener{
已选择公共视图(AdapterView父视图、视图、int pos、,
'
'
'
}
//@凌驾
公共无效onHomePressed(){
onBackPressed();
}
public void onBackPressed(){
super.onBackPressed();
}
私有类处理程序\u线程扩展线程{
汉德勒;
/*建造师*/
处理器线程(处理器h){
mHandler=h;
}
公开募捐{
消息消息;
while(true){
试一试{
睡眠(200);
}捕捉(中断异常e){
}
status=Interface.ReadData(4096,readBuffer,实际单位);
如果(状态==0x00&&actualNumBytes[0]>0){
msg=mHandler.obtainMessage();
mHandler.sendMessage(msg);
}
}
}
}
}我认为,你必须使用Bundle参数。这个答案可以帮助你