android如何将一个类的值传到另一个类中

private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {//重写HandleMessage方法,子类对象通过该方法接受信息
switch (msg.what) {
case MESSAGE_STATE_CHANGE:
Toast.makeText(MainActivity.this, "change", Toast.LENGTH_LONG);
switch (msg.arg1) {
case BluetoothService.STATE_CONNECTED:
mTitle.setText(R.string.title_connected_to);
mTitle.append(mConnectedDeviceName);
//mConversationArrayAdapter.clear();
break;
case BluetoothService.STATE_CONNECTING:
mTitle.setText(R.string.title_connecting);
break;
case BluetoothService.STATE_LISTEN:
case BluetoothService.STATE_NONE:
mTitle.setText(R.string.title_not_connected);
break;
}
break;
//发送了信息,显示在本地屏幕上(重写,显示结果即可)
case MESSAGE_WRITE:

Toast.makeText(getApplicationContext(),"发送成功",
Toast.LENGTH_SHORT).show();
break;
//收到了信息,显示在本地屏幕上
case MESSAGE_READ:
Bundle data =msg.getData();
String ss = data.getString("BTdata");
readStr += ss;//把送过来的字符串衔接起来
readCount++;//已读字符个数
if(readCount>=3&&readStr.length()>10){
int index = readStr.indexOf("#");//查找#号首次出现的位置0
if(index+13<=readStr.length()){
String mess = readStr.substring(index+1,index+13+1);
String ss1 = mess.substring(0,6);
String ss2 = mess.substring(7);
onReceiveMess1(ss1);
onReceiveMess2(ss2);
//集合框架,按索引值操作数据,允许存放重复元素
//ChartView.list1.add(ss1);//像集合列表中添加对象
//ChartView.list2.add(ss2);
list1.add(ss1);//像集合列表中添加对象
list2.add(ss2);

                                我想在另一个类中调用ss1、ss2,该如何做呢
查看全部
chawei0397
chawei0397
2017/09/21 07:56
  • android
  • class
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

5个回复