在ecliipse-->preference-->Java--->Debug 设置
Suspend execution:
只保留 suspend for breakpoint.
Hot code replace
保留: show error when hot code replace failed.
show error when obsolete code remain after replace.
replace classfiles containing compilation errors.
Communication:
change Debugger timer to 30000
Launch timer to 200000
The project was not built since its build path is incomplete. The project was not built since its build path is incomplete. Fix the build path then try building this project
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
出現以上訊息的原因是因為你裝了多個版本的jre或jdk的關係。本來Eclipse在建立專案時,會自動參照你的jre路徑,但多個版本就沒辦法了。
你只能手動建立…
1. 進入window\preferences\java\Installed JREs
1)按Add
2)輸入JRE Name, 例JDK1.5.0.03
3)JRE home directory, 選擇安裝的路徑
4)按OK
2. 進入Project\properties\Java Bulid Path
1)Add library
2)選JRE System Library後按Next
3)選workplace default JRE後按finish...
RelativeLayout.LayoutParams relativeParams =
new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
relativeParams.addRule(RelativeLayout.CENTER_HORIZONTAL)
LinearLayout.LayoutParams lineParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
LinearLayout line = new LinearLayout(this);
LinearLayout line1 = new LinearLayout(this);
line.addView(myTt0, lineParams);
line.addView(myTx0, lineParams);
line.addView(myTx1, lineParams);
line1.addView(myTx, lineParams);
relativeLayout.addView(line,
relativeParams); //
Attention:if the two params are same, the larger layout will be cliped.
relativeLayout1.addView(line1,
relativeParams);
////////////////////////////////////////////////////////////
So the relativeParams should use different ones attach to more than one layouts as below:
relativeLayout.addView(line, relativeParams);
relativeLayout1.addView(line1, relativeParams_c);
Use SetBackGrounp() target a View component, it will enlange width to the drawable be set.
So it will influence the Center function.
Such us:
TextView tx = new TextView(this);
tx.setText("test"); //the width will be same as the text length.
tx.setBackGrounp(bitmap); //the width will be enlanged as bitmap's width.
最近在搞一个j2me的项目, 目标手机的内存较小, 程序内存分配如果有问题会出现内存泄露. Java的内存回收由JVM控制,这给开发者的内存管理带来了方便的同时, 也会带来一些苦恼(辩证法). 目前用索爱的模拟器进行开发, 它的开发工具还是比较健全了,可以进行内存检测(尽管很慢), 来找出问题所在.
现在已知可以预防内存泄露的措施是:
使用完的对象,特别是大对象即使 置 null, 否则可能陷入循环引用导致JVM不能释放.
减小图片尺寸.
减小重新new对象.