`
文章列表

list随机排序

    博客分类:
  • java
/** * 随机排序集合 * * @param objs * @return */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static List randomList(List objs) { Collections.sort(objs, new Comparator() { private final int[] vs = { -1, 0, 1 }; private final Random rnd = new Rand ...
今天在游戏中播放音效的时候,连续点击的时候出现了错误: android no more track names available 这是典型的MediaPlayer对象使用了没有释放的原因,记得release了
// 获得屏幕大小1 WindowManager manager = getWindowManager(); int width = manager.getDefaultDisplay().getWidth(); int height = manager.getDefaultDisplay().getHeight(); // 获得屏幕大小2 DisplayMetrics dMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dMetrics); ...
final Spinner timeGroup = (Spinner) findViewById(R.id.timer); // 倒计时自定义的选择视图 BaseAdapter baseAdapter = new BaseAdapter() { @Override public View getView(int position, View convertView, ViewGroup parent) { LinearLayout ll = new LinearLayout(GameSettingActivity.this); ll.set ...
在AndroidManifest.xml中的每个activity配置一下screenOrientation属性 <activity android:name="GameIntroduceActivity" android:screenOrientation="portrait" >
final RadioButton red_radio = (RadioButton) findViewById(R.id.red_radio); final RadioButton gray_radio = (RadioButton) findViewById(R.id.gray_radio); gray_radio.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButto ...
public class TimerActivity extends Activity { /** Called when the activity is first created. */ private TextView timerView ; private MyTimer timer; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ...

android全屏显示

在 onCreate方法中 requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
/** * * 判断当前日期是一年的第几周 * */ private function weekOfYear(yyyy:Number,mm:Number,dd:Number):Number{  var myDate =new Date(yyyy, mm - 1, dd);  var startDate = new Date(yyyy,0,1);  var diff = myDate.valueOf() - startDate.valueOf();  var d = Math.round(diff/86400000);  ...
flex实现跨域访问的配置文件crossdomain.xml, <?xml version="1.0"?> <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> <cross-domain-policy>   <allow-access-from domain="1.202.135.142" />   <allow-access-from d ...
根据字母取数字,根据数字取字母,主要应用他们之间的asciI码得对应关系 /** * 数字与字母的转换(1、2、3.....A、B、C、.......) * * @author sg * */ public class NumberMapLetter { /** * 取数字对应的字母 * * @param index * @return */ public static String getLetter(int index) { String rs = ""; do { index--; rs = ((char) ...
在Java对象的拷贝过程中,Apache的BeanUtils对日期的支持不是很好,但有扩展,大家可以找到它的日期转换器,注册进去就ok了 创建BeanUtils的子类,把日期转换器注册进去,以后用这个子类来copy对象: public class BeanUtilEx extends BeanUtils { private static Map cache = new HashMap(); private static Log logger = LogFactory.getFactory().getInstance(BeanUtilEx.class); private BeanUt ...
SEVERE: Servlet.service() for servlet Spring MVC Dispatcher Servlet threw exception java.lang.NoSuchMethodError: org.codehaus.jackson.map.type.TypeFactory.type(Ljava/lang/reflect/Type;)Lorg/codehaus/jackson/type/JavaType; at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter. ...
spring3 mvc date前台传递报错 从前台传递一个date到controller,前后台的date类型转换不过来,解决办法: 在controller中加上 @InitBinder public void initBinder(WebDataBinder binder) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); dateFormat.setLenient(true); binder.registerCustomEditor(Date.class, new CustomDa ...
数据库备份: ./mysqldump -udams -pdams -h 192.168.0.13 dams > /Users/shuguang/Work/dams.sql 数据库恢复:./mysql -uroot -p -h 127.0.0.1 dams < /Users/shuguang/Work/dams.sql 将数据库转移到新服务器: mysqldump -uusername -ppassword databasename | mysql –host=*.*.*.* -C databasename
Global site tag (gtag.js) - Google Analytics