갤럭시탭 7.0에서 만든 프로그램을 갤럭시탭 10.1로 바꾸는 과정에서

생긴 오류입니다. (오류파일첨부함)

 

소스는 고치지 않고 레이아웃 xml 부분만 수정했구요.

화면1에서 화면2로 넘어간 다음 다시 화면1로 back 하려고 하니 저런 오류가 납니다.

갤탭7.0에서는 오류가 안났었구요.

 

아래에 소스 첨부합니다.

화면1 소스

 package mutronics.flowVc;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;

import mutronics.flowVc.Adapter.FlowDbAdapter;
import mutronics.flowVc.Adapter.FlowGroupCursorAdapter;
import mutronics.flowVc.Adapter.FlowGroupModel;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.CompoundButton;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class FlowDataViewActivity extends BaseListActivity {
 private FlowDbAdapter mDbAdapter;
 
 private Button btnExport;
 private Button btnTextOut;
 private Button btnDelete;
 private CheckBox chkSelect;
 
 private String extParentDirectory;
 private String extSummaryDirectory;
 private String extDataDirectory;
 
 private SummaryController mSummaryController = new SummaryController();
 
 @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
       
        setContentViewWithTitleEx(R.layout.flow_data_activity);
       
        btnExport = (Button) findViewById(R.id.btnExport);       
        btnExport.setOnClickListener(mExportButtonListener);
       
        btnDelete = (Button) findViewById(R.id.btnDelete);       
        btnDelete.setOnClickListener(mDeleteButtonListener);
       
        btnTextOut = (Button) findViewById(R.id.btnTextOut);
        btnTextOut.setOnClickListener(mTextOutButtonListener);
       
        chkSelect = (CheckBox) findViewById(R.id.chkSelect);
        chkSelect.setOnCheckedChangeListener(mCheckChangedListener);
       
        final ListView listView = getListView();
        listView.setOnCreateContextMenuListener(this);

        String rootPath = Environment.getExternalStorageDirectory().toString();
        extParentDirectory = rootPath + "/MU2720_DATA";
        extSummaryDirectory = rootPath + "/MU2720_DATA/SUMMARY";
        extDataDirectory = rootPath + "/MU2720_DATA/DATA";
       
        File directory = new File(extParentDirectory);
     if (directory.exists() == false) {
      directory.mkdir();
     }
     
     directory = new File(extSummaryDirectory);
     if (directory.exists() == false) {
      directory.mkdir();
     }
     
  directory = new File(extDataDirectory);
     if (directory.exists() == false) {
      directory.mkdir();
     }
       
        mDbAdapter = new FlowDbAdapter(this.getApplicationContext());
    }
 
 @Override
    public synchronized void onResume() {
        super.onResume();
       
        searchGroupData();
    }
 
 /**
     * List의 Item이 선택 되었을 경우 해당 데이터를 자세히 보기 Activity를 보여줍니다.
     */
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
     super.onListItemClick(l, v, position, id);
     
     TextView txtTransTime = (TextView) v.findViewById(R.id.txtTransTime);
     TextView txtDatasetName = (TextView) v.findViewById(R.id.txtDatasetName);
  
     Intent intent = new Intent(FlowDataViewActivity.this, FlowDataSummaryActivity.class);
     intent.putExtra("trans_time", txtTransTime.getText());
     intent.putExtra("dataset_name", txtDatasetName.getText());
     startActivity(intent);
    }
 
 private OnClickListener mExportButtonListener = new OnClickListener() {
  public void onClick(View view) {
   summaryFlowGroupData();
  }
 };
 
 private OnClickListener mTextOutButtonListener = new OnClickListener() {
  public void onClick(View view) {
   exportMeasureData();
  }
 };
 
 private OnClickListener mDeleteButtonListener = new OnClickListener() {
  public void onClick(View view) {
   deleteFlowGroupData();
  }
 };
 
 private OnCheckedChangeListener mCheckChangedListener = new OnCheckedChangeListener() {
  
  public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
   FlowGroupCursorAdapter adapter = (FlowGroupCursorAdapter)getListAdapter();
   if (isChecked) {
    adapter.checkAll();
   } else {
    adapter.uncheckAll();
   }
   final ListView listView = getListView();
   for(int i=0;i<listView.getChildCount();i++){
    listView.setItemChecked(i, isChecked);
   }
   listView.invalidate();
  }
 };
 
 /**
     * 유속 측정 데이터를 조회합니다.
     */
    private void searchGroupData() {
        Cursor cursor = null;
        try {
   mDbAdapter.open();   
   cursor = mDbAdapter.getFlowGroupCursor();
   startManagingCursor(cursor);
  } catch (SQLiteException ex) {
   Log.w("Db Error", ex.getMessage());
  }
  
  try {
   ListAdapter adapter = new FlowGroupCursorAdapter(this, cursor);
         // Bind to our new adapter.
         setListAdapter(adapter);
  } catch (Exception ex) {
   Log.w("Adapter Error", ex.getMessage());
  }
  
  chkSelect.setChecked(false);
  
  if (mDbAdapter != null)
   mDbAdapter.close();
    }
   
    private void deleteFlowGroupData() {
     FlowGroupCursorAdapter adapter = (FlowGroupCursorAdapter)getListAdapter();
  final ArrayList<FlowGroupModel> models = adapter.getModels();
  
     new AlertDialog.Builder(this)
  .setTitle("선택한 데이터를 삭제하시겠습니까?")
  .setPositiveButton("예", new DialogInterface.OnClickListener() {
  //.setTitle("Do you want to delete the selected dataset?")
  //.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
   
   public void onClick(DialogInterface dialog, int which) {   
    
    boolean isWritable = false;
    for (FlowGroupModel model : models) {
     if (model.getChecked() == true)
      isWritable = true;
    }
    
    if (isWritable == false) {
     //Toast.makeText(FlowDataViewActivity.this, "체크된 항목이 없습니다.", Toast.LENGTH_LONG).show();
     Toast.makeText(FlowDataViewActivity.this, "There is no checked item.", Toast.LENGTH_LONG).show();
     return;
    }      
    
          try {
           mDbAdapter.beginTransaction();                     
     for (FlowGroupModel model : models) {
      
      if (model == null || model.getChecked() == false) continue;
      
      String trans_time = model.getTranstime();
      mDbAdapter.deleteFlowData(trans_time);
           
      Cursor groupCursor = mDbAdapter.getFlowGroupCursor(trans_time);
      Cursor itemCursor = mDbAdapter.getFlowItemCursorOnlyRetryAvg(trans_time);
         Cursor cursor = mDbAdapter.getFlowItemCursor(trans_time);
         
         if (groupCursor != null)
             groupCursor.close();
            if (itemCursor != null)
             itemCursor.close();
            if (cursor != null)
             cursor.close();    
     }     
     mDbAdapter.setTransactionSuccesful();
    
    } catch (SQLiteException ex) {
     Log.w("Db Error", ex.getMessage());
    } finally {
     mDbAdapter.endTransaction();
    }
    
    Toast.makeText(FlowDataViewActivity.this, "데이터 삭제가 완료되었습니다.", Toast.LENGTH_LONG).show();
    //Toast.makeText(FlowDataViewActivity.this, "Data delete is completed.", Toast.LENGTH_LONG).show();
       
    searchGroupData();
   }
  })
  .setNegativeButton("아니오", new DialogInterface.OnClickListener() {
  //.setNegativeButton("No", new DialogInterface.OnClickListener() {
   
   public void onClick(DialogInterface dialog, int which) {
    dialog.cancel();
   }
  })
  .show();
    }
   
    private void exportMeasureData() {
     FlowGroupCursorAdapter adapter = (FlowGroupCursorAdapter)getListAdapter();
  final ArrayList<FlowGroupModel> models = adapter.getModels();
  
     new AlertDialog.Builder(this)
  .setTitle("선택한 데이터셋의 Text 파일을 생성하겠습니까?")
  .setPositiveButton("예", new DialogInterface.OnClickListener() {
     //.setTitle("Would you like to create a text file of selected dataset?")
  //.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
   
   public void onClick(DialogInterface dialog, int which) {
    
    boolean isWritable = false;
    for (FlowGroupModel model : models) {
     if (model.getChecked() == true)
      isWritable = true;
    }
    
    if (isWritable == false) {
     Toast.makeText(FlowDataViewActivity.this, "체크된 항목이 없습니다.", Toast.LENGTH_LONG).show();
     //Toast.makeText(FlowDataViewActivity.this, "There is no checked item.", Toast.LENGTH_LONG).show();
     return;
    }
    
    File directory = null;
    File file = null;

       String dataDirectoryName = android.text.format.DateFormat.format("yyyyMMddTkkmm", new java.util.Date()).toString();
       String destDirectory = extDataDirectory + "/" + dataDirectoryName;
       directory = new File(destDirectory);
       if (directory.exists() == false) {
        directory.mkdir();
       }
       
    StringBuilder sb = null;
    
    OutputStream outStream = null;
    
    try {
     mDbAdapter.open();
     for (FlowGroupModel model : models) {
      if (model == null || model.getChecked() == false) continue;
          
      String trans_time = model.getTranstime();
      if (trans_time == null || trans_time.length() <= 0) continue;
      
      Cursor groupCursor = mDbAdapter.getFlowGroupCursor(trans_time);
      Cursor itemCursor = mDbAdapter.getFlowItemCursorOnlyRetryAvg(trans_time);
         Cursor cursor = mDbAdapter.getFlowItemCursor(trans_time);
         
         sb = new StringBuilder();
         sb.append(mSummaryController.getSummaryString(groupCursor, itemCursor));
      sb.append("============================================================\n");       
      sb.append("\n");
      sb.append(mSummaryController.getDetailString(cursor));
      
      String datasetName = model.getDatasetName();
      file = new File(destDirectory, datasetName + ".txt");
      int fileIndex = 0;
      while (true) {
       if (file.exists() == false)
        break;
       
       fileIndex++;
       file = new File(destDirectory, datasetName + "(" + String.valueOf(fileIndex)  + ").txt");
      }
         
         outStream = new FileOutputStream(file);
         outStream.write(sb.toString().getBytes("KSC5601"));
            outStream.flush();
            if (outStream != null) {
       outStream.close();
             outStream = null;
         }
            if (groupCursor != null)
             groupCursor.close();
            if (itemCursor != null)
             itemCursor.close();
            if (cursor != null)
             cursor.close();
     }
          
           //Toast.makeText(FlowDataViewActivity.this, dataDirectoryName + " Text 파일이 " + directory.getAbsolutePath() + "에 생성되었습니다.", Toast.LENGTH_LONG).show();
     Toast.makeText(FlowDataViewActivity.this, "Text file " + dataDirectoryName + " has been created on " + directory.getAbsolutePath() + ".", Toast.LENGTH_LONG).show();
    } catch (FileNotFoundException e) {
     e.printStackTrace();
           Toast.makeText(FlowDataViewActivity.this, e.toString(), Toast.LENGTH_LONG).show();
    } catch (IOException e) {
        e.printStackTrace();
     Toast.makeText(FlowDataViewActivity.this, e.toString(), Toast.LENGTH_LONG).show();
    } catch (Exception e) {
        e.printStackTrace();
     Toast.makeText(FlowDataViewActivity.this, e.toString(), Toast.LENGTH_LONG).show();
       }finally {
        if (mDbAdapter != null)
         mDbAdapter.close();
        
        if (outStream != null) {
      try {
       outStream.close();
      } catch (IOException e) {
      } catch (Exception e) {       
      }
            outStream = null;
        }
    }
       
    searchGroupData();
   }
  })
  .setNegativeButton("아니오", new DialogInterface.OnClickListener() {
  //.setNegativeButton("No", new DialogInterface.OnClickListener() {
   
   public void onClick(DialogInterface dialog, int which) {
    dialog.cancel();
   }
  })
  .show();
    }
   
 private void summaryFlowGroupData() {
  
  FlowGroupCursorAdapter adapter = (FlowGroupCursorAdapter)getListAdapter();
  final ArrayList<FlowGroupModel> models = adapter.getModels();
  
     new AlertDialog.Builder(this)
  .setTitle("선택한 데이터셋의 요약 파일을 생성하겠습니까?")
  .setPositiveButton("예", new DialogInterface.OnClickListener() {
     //.setTitle("Would you like to create a summary file of the selected dataset?")
  //.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
   
   public void onClick(DialogInterface dialog, int which) {
    
    boolean isWritable = false;
    for (FlowGroupModel model : models) {
     if (model.getChecked() == true)
      isWritable = true;
    }
    
    if (isWritable == false) {
     Toast.makeText(FlowDataViewActivity.this, "체크된 항목이 없습니다.", Toast.LENGTH_LONG).show();
     //Toast.makeText(FlowDataViewActivity.this, "There is no checked item.", Toast.LENGTH_LONG).show();
     return;
    }
    
    String file_name = "Summary_" + android.text.format.DateFormat.format("yyyyMMddTkkmm", new java.util.Date()).toString();
    StringBuilder sb = new StringBuilder();
    
    OutputStream outStream = null;
    
    try {
     mDbAdapter.open();
     for (FlowGroupModel model : models) {
      if (model == null || model.getChecked() == false) continue;
          
      String trans_time = model.getTranstime();
      if (trans_time == null || trans_time.length() <= 0) continue;
      
      Cursor groupCursor = mDbAdapter.getFlowGroupCursor(trans_time);
      Cursor itemCursor = mDbAdapter.getFlowItemCursorOnlyRetryAvg(trans_time);
      sb.append(mSummaryController.getSummaryString(groupCursor, itemCursor));
      sb.append("============================================================\n");       
      sb.append("\n");
      
      if (groupCursor != null)
             groupCursor.close();
            if (itemCursor != null)
             itemCursor.close();
     }
     
        File directory = new File(extSummaryDirectory);
        File file = new File(extSummaryDirectory, file_name + ".txt");
        
        outStream = new FileOutputStream(file);
        if (outStream != null) {
            outStream.write(sb.toString().getBytes("KSC5601"));
            outStream.flush();
        }
          
           //Toast.makeText(FlowDataViewActivity.this, file_name + " 요약파일이 " + directory.getAbsolutePath() + "에 생성되었습니다.", Toast.LENGTH_LONG).show();
        Toast.makeText(FlowDataViewActivity.this, "Summarized the file " + file_name + " has been created on " + directory.getAbsolutePath()+ ".", Toast.LENGTH_LONG).show();
    } catch (FileNotFoundException e) {
     e.printStackTrace();
           Toast.makeText(FlowDataViewActivity.this, e.toString(), Toast.LENGTH_LONG).show();
    } catch (IOException e) {
        e.printStackTrace();
     Toast.makeText(FlowDataViewActivity.this, e.toString(), Toast.LENGTH_LONG).show();
    } catch (Exception e) {
        e.printStackTrace();
     Toast.makeText(FlowDataViewActivity.this, e.toString(), Toast.LENGTH_LONG).show();
       }finally {
        if (mDbAdapter != null)
         mDbAdapter.close();
     try {
         if (outStream != null) {
       outStream.close();
             outStream = null;
         }
     } catch (IOException e) {
      e.printStackTrace();
     } catch (Exception e) {       
     }
    }
       
    searchGroupData();
   }
  })
  .setNegativeButton("아니오", new DialogInterface.OnClickListener() {
  //.setNegativeButton("No", new DialogInterface.OnClickListener() {
   
   public void onClick(DialogInterface dialog, int which) {
    dialog.cancel();
   }
  })
  .show();
    }
}

 

화면2 소스

 package mutronics.flowVc;
import mutronics.flowVc.Adapter.FlowDbAdapter;
import mutronics.flowVc.Adapter.FlowItemCursorAdapter;
import Utility.DipManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
import android.os.Bundle;
import android.util.Log;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ScrollView;
import android.widget.TextView;
public class FlowDataSummaryActivity extends BaseListActivity {
 
 private TextView tvTitle;
 private TextView tvSummary;
 
 private ScrollView scrollView1;
 
 private FlowDbAdapter mDbAdapter;
 
 private String mDataset_name = null;
 private String mTrans_time;
 
 private SummaryController mSummaryController = new SummaryController();
 
 @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentViewWithTitleEx(R.layout.flow_data_summary);
        
        tvTitle = (TextView)findViewById(R.id.tvTitle);
        tvSummary = (TextView)findViewById(R.id.tvSummary);
        scrollView1 = (ScrollView)findViewById(R.id.scrollView1);
        
        getListView().setDivider(null);
  getListView().setDividerHeight(0);
  
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
         mDataset_name = extras.getString("dataset_name");
         mTrans_time = extras.getString("trans_time");
         
         tvTitle.setText(mDataset_name);
        }
        
        mDbAdapter = new FlowDbAdapter(this.getApplicationContext());
        
        try {
      mDbAdapter.open();
      Cursor groupCursor = mDbAdapter.getFlowGroupCursor(mTrans_time);
      Cursor itemCursor = mDbAdapter.getFlowItemCursorOnlyRetryAvg(mTrans_time);
      tvSummary.setText(mSummaryController.getSummaryString(groupCursor, itemCursor));
     } catch (Exception ex) {
      Log.e("Db Error", ex.getMessage());
     } finally {
      if (mDbAdapter != null)
          mDbAdapter.close();
     }
 }
 
 @Override
    public synchronized void onResume() {
        super.onResume();
        
        searchItemData();
    }
 
 private void searchItemData() {
     mDbAdapter = new FlowDbAdapter(this.getApplicationContext());
        Cursor cursor = null;
        try {
   mDbAdapter.open();   
   cursor = mDbAdapter.getFlowItemCursor(mTrans_time);
   
   ListView listView = (ListView)getListView();
   int rows = cursor.getCount();
   
   int height = DipManager.getPixel(getApplicationContext(), 28) * rows;
   
   startManagingCursor(cursor);
   
   ViewGroup.LayoutParams params = listView.getLayoutParams();
   params.height = height;
   listView.setLayoutParams(params);
   listView.requestLayout();
   
   scrollView1.smoothScrollTo(0, 0);
  } catch (SQLiteException ex) {
   Log.w("Db Error", ex.getMessage());
  }
  
  try {
   ListAdapter adapter = new FlowItemCursorAdapter(this, cursor);
         // Bind to our new adapter.
         setListAdapter(adapter);
  } catch (Exception ex) {
   Log.w("Adapter Error", ex.getMessage());
  }
  
  if (mDbAdapter != null)
   mDbAdapter.close();
    }
}

도움 부탁드립니다.