Primary arithmetic app first sprint stage sixth day

Source: Internet
Author: User

Team members: Chen Shuyun, Yang Jiane, Chen Xi

Team selection: Primary arithmetic App

First Sprint stage time: 11.17~11.27

This release is a rearrangement of neatly resultactivity layout code Activity_result.xml

The code is as follows:

Activity_result.xml:

<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http// Schemas.android.com/tools "android:layout_width=" match_parent "android:layout_height=" Match_parent "Android:paddi ngbottom= "@dimen/activity_vertical_margin" android:paddingleft= "@dimen/activity_horizontal_margin" Android: paddingright= "@dimen/activity_horizontal_margin" android:paddingtop= "@dimen/activity_vertical_margin" Android: background= "@drawable/animal" android:scrollbars= "vertical" tools:context= ".        Resultactivity "> <textview android:id=" @+id/textview1 "android:layout_width=" Wrap_content " android:layout_height= "Wrap_content" android:layout_alignparenttop= "true" Android:layout_centerhorizonta     L= "true" android:layout_margintop= "14DP" android:text= "@string/result" android:textsize= "30sp"/> <textview android:id= "@+id/sum" android:layout_width= "Wrap_content" Android:layout_height= "Wrap_content" android:layout_alignparentbottom= "true" Android:layout_centerhorizontal= "Tru E "android:layout_marginbottom=" 44DP "android:text=" TextView "android:textsize=" 20sp "/> <tex TView android:id= "@+id/thenumber" android:layout_width= "wrap_content" android:layout_height= "Wrap_con Tent "android:layout_alignleft=" @+id/textview2 "android:layout_below=" @+id/textview2 "Android:layout_ margintop= "23DP" android:text= "TextView"/> <textview android:id= "@+id/textview3" Android:la         Yout_width= "Wrap_content" android:layout_height= "wrap_content" android:layout_alignbaseline= "@+id/textView2" Android:layout_alignbottom= "@+id/textview2" android:layout_alignright= "@+id/panduan" android:text= "@ String/panduan "android:textsize=" 20sp "/> <textview android:id=" @+id/textview2 "Android:lay Out_width= "Wrap_content"        android:layout_height= "Wrap_content" android:layout_below= "@+id/textview1" android:layout_margintop=  "16DP" android:layout_toleftof= "@+id/textview1" android:text= "@string/number" android:textsize= "20SP" /> <textview android:id= "@+id/textview4" android:layout_width= "Wrap_content" android:layout        _height= "Wrap_content" android:layout_above= "@+id/textview5" android:layout_alignbaseline= "@+id/textView3" Android:layout_alignbottom= "@+id/textview3" android:layout_alignright= "@+id/sum" android:text= "@string /trueresult "android:textsize=" 20sp "/> <textview android:id=" @+id/textview5 "android:layout        _width= "Wrap_content" android:layout_height= "wrap_content" android:layout_alignbaseline= "@+id/thenumber" Android:layout_alignbottom= "@+id/thenumber" android:layout_centerhorizontal= "true" android:text= "TextVie W "/> <textview        Android:id= "@+id/panduan" android:layout_width= "wrap_content" android:layout_height= "Wrap_content" Android:layout_alignbaseline= "@+id/textview5" android:layout_alignbottom= "@+id/textview5" Android:layo ut_torightof= "@+id/textview1" android:text= "TextView"/></relativelayout>

Resultactivity.java:

Package Com.example.calculator;import Android.os.bundle;import Android.app.actionbar;import android.app.Activity; Import Android.content.intent;import android.view.menu;import Android.view.menuitem;import Android.widget.TextView ;p ublic class Resultactivity extends Activity {@Overrideprotected void onCreate (Bundle savedinstancestate) {ActionBar Actionbar=getactionbar (); actionbar.setdisplayshowhomeenabled (true); actionbar.setdisplayhomeasupenabled (true); Super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_result); Intent inten=getintent (); Bundle Bundle=inten.getextras (); TextView text1= (TextView) Findviewbyid (R.id.thenumber); TextView text= (TextView) Findviewbyid (R.id.panduan); TextView text2= (TextView) Findviewbyid (r.id.sum); TextView text3= (TextView) Findviewbyid (R.ID.TEXTVIEW5); int[] Shu1=inten.getintarrayextra ("shu1"); int[] Shu2= Inten.getintarrayextra ("Shu2"); int[] Result=inten.getintarrayextra ("result"); int suanfa=bundle.getint ("Suanfa"); String time=bundle.getstring ("Time"); String showfa= ""; if (suanfa==1) {showfa= "+";} if (suanfa==2) {showfa= "-";} if (suanfa==3) {showfa= "*";} if (suanfa==4) {showfa= "/";} String[] User=inten.getstringarrayextra ("user"); String aaa= ""; String bbb= ""; String ccc= ""; int score=0; String show4; String[] jie=new string[]{"correct", "Error"};for (int i=0;i<shu1.length;i++) {String show1= ""; String show2= ""; String show3= ""; show1=integer.tostring (Shu1[i]); Show2=integer.tostring (Shu2[i]); Show3=integer.tostring (result[i ]); if (User[i].equals (SHOW3)) {show4=jie[0];score++;} else {show4=jie[1];} aaa+=show4+ "\ n"; bbb+=show1+showfa+show2+ "=" +show3+ "\ n"; ccc+=user[i]+ "\ n"; Text.settext (AAA); Text1.settext (BBB); Text3.settext (CCC);} Text2.settext (time+ "must be divided into" +score*10);} @Overridepublic boolean Oncreateoptionsmenu (Menu menu) {//Inflate the menu; This adds items to the action bar if it is PR Esent.getmenuinflater (). Inflate (R.menu.result, menu); return true;} @Overridepublic boolean onoptionsitemselected (MenuItem Item) {//TODO auto-generated method Stubswitch (Item.getitemid ( )) {CAsE Android. r.id.home://Create intentintent intent=new Intent (This,calculatorsactivity.class) to start mainactivity;//Add extra flag, Eject Intent.addflags (intent.flag_activity_clear_top) in activity stack above mainactivity, startactivity (Intent); Break;default:break;} return super.onoptionsitemselected (item);}}

Summary: The layout code is not wrong, but the runtime "correct answer" and "judgment" overlap, we will continue to study, solve the current problem!

Primary arithmetic app first sprint stage sixth day

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.