我有一個看起來有點像的活動: 請不要複製它, 它從另一個類取三個變量並計算(a,b),(b,c),(c, d),(a,b,c),然後分解公式並給出五個不同的textViews字符串。 也如果你可以幫助改善x.square到x ,請幫助我,歡迎所有的建議。阻止應用程序被掛起
package com.aditya.blabla;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class AlternateForms extends Activity {
AnotherClass ec = new AnotherClass();
int aa = ec.geta();
int bb = ec.getb();
int cc = ec.getc();
int abhcf = HCF(aa, cc), bchcf = HCF(cc, cc), achcf = HCF(aa, cc),
abchcf = HCF(abhcf, cc);
String altform1,altform2,altform3,altform4,altform5;
TextView t1, t2, t3, t4, t5;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.alternate);
t1 = (TextView) findViewById(R.id.textView1);
t2 = (TextView) findViewById(R.id.textView2);
t3 = (TextView) findViewById(R.id.textView3);
t4 = (TextView) findViewById(R.id.textView4);
t5 = (TextView) findViewById(R.id.textView5);
altform1 = abhcf + "x(" + aa/abhcf + "x+" + bb/abhcf + ")+"
+ cc;
setProgress(20);
altform2 = aa + "x.square" + bchcf + "(" + bb/bchcf + "x" + cc
/bchcf + ")" + cc;
setProgress(30);
altform3 = achcf + "(" + aa/achcf + "x.square" + bb/achcf
+ ")" + cc + "x";
setProgress(40);
altform4 = abchcf + "(" + aa/abchcf + "x.square" + bb/abchcf
+ "x" + cc/abchcf + ")";
setProgress(50);
altform5 = abchcf + "(" + "x" + "(" + aa/abchcf + "x" + bb
/abchcf + ")" + cc/abchcf + ")";
if (abhcf != 1) {
t1.setText(altform1);
}
if (bchcf != 1) {
t2.setText(altform2);
}
if (achcf != 1) {
t3.setText(altform3);
}
if (abchcf != 1) {
t4.setText(altform4);
t5.setText(altform5);
}
}
private int HCF(int m, int n) {
// TODO Auto-generated method stub
int hcf = 0;
while (n != 0) {
hcf = n;
n = m % n;
n = hcf;
}
return hcf;
}
}
它沒有錯誤,但它需要很多的過程,看起來像掛起,並給出強制關閉對話框 任何建議來處理呢?
只是擡起頭來。通過發佈這裏你已經在[Creative-Commons Sharealike](http://creativecommons.org/licenses/by-sa/3.0/)許可它明確規定其他人可以自由複製和使用它...找到鏈接在此頁面的右下角以瞭解更多信息。 – FoamyGuy
沒關係,我可以製造出這樣的軍隊 – RE60K
產生一個軍隊....?什麼? – FoamyGuy