java - Not able to display very large calculation value in editext -


private textview info; private edittext input; private button getinfo; long answer;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     getinfo = (button) findviewbyid(r.id.button1);     getinfo.setonclicklistener(new onclicklistener() {         public void onclick(view v) {             input = (edittext) findviewbyid(r.id.edittext1);             string s2 = input.gettext().tostring();             long inputnumber = integer.parseint(s2);             (int = 0; <= inputnumber; i++) {                  answer = fibonacci(i);             }             input.settext(answer + "");         }     }); } public static long fibonacci(long n) {     if (n == 0) {         return 0;     } else if (n == 1) {         return 1;     } else {         return fibonacci(n - 1) + fibonacci(n - 2);     } } 

i made program generates fibonacci series number give input through edit text , display output value in edittext .issue when enter 30 generates fibonacci series when enter 50 or 100 app not respond , stops .

i think because have lot of calculation on ui thread. thy calculate in assynctask, example.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -