@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.layout_loading); if (!createFile()) { Utils.showMsg(this, R.string.sdcard_no_sdcard); this.finish(); } else { onLoading(); } }
public boolean createFile() { String sdCardPath = Utils.getSdCardPath(); if (sdCardPath != null) { String root_temp_path = sdCardPath + Constants.TEMPPATH; File dir = new File(root_temp_path); if (!dir.exists()) { dir.mkdirs(); } dir = null; return true; } return false; }
public boolean insertPay(UserPayState userPay) { Connection conn = DBConnection.getConnection(); String addSQL = "insert into user_pay_state(user_id,cartoon_id,cartoon_pay_state,cartoon_pay_time) values(?,?,?,?)"; PreparedStatement pstmt = null; try { pstmt = conn.prepareStatement(addSQL); pstmt.setString(1, userPay.getUser_id()); pstmt.setInt(2, userPay.getCartoon_id()); pstmt.setInt(3, userPay.getCartoon_pay_state()); pstmt.setString(4, Utils.getTime()); int res = pstmt.executeUpdate(); return res > 0; } catch (SQLException e) { e.printStackTrace(); } finally { DBConnection.close(pstmt); } return false; }