Course Name |
Mobile Internet development based on Android platform |
Date of experiment |
2016/4/15 |
Name of the experimental project |
Sudoku Game Interface Design |
Location of the experiment |
Computer room S3004 |
Type of experiment |
-Verification Type √ design type-comprehensive type |
Hours |
Two sessions |
The purpose and requirements of the experiment (the knowledge points which are involved in this experiment and are required to be mastered) |
1) Complete interface design for Sudoku game 2) Mastering the use of Actionbar |
second, the experimental environment (the hardware equipment and related software used in this experiment) |
(1) PC Machine (2) Operating system: Windows XP (3) Software: Eclipse, jdk1.6,android Sdk,adt |
Third, the contents and steps of the experiment |
1. Import Project Sudoku 2. Add 3 Activity classes: 3 Adding a layout resource file 4 Registering activity |
Four, the experimental results (the experimental source program list and operating results or experimental conclusions, experimental design drawings) |
The Mainacitivi class code is as follows: PackageCom.example.sudoku;ImportJava.security.PublicKey;ImportAndroid.os.Build;ImportAndroid.os.Bundle;Importandroid.provider.SyncStateContract.Helpers;ImportAndroid.annotation.SuppressLint;ImportAndroid.annotation.TargetApi;ImportAndroid.app.ActionBar;Importandroid.app.Activity;Importandroid.content.Intent;ImportAndroid.view.Menu;ImportAndroid.view.MenuInflater;ImportAndroid.view.MenuItem;ImportAndroid.view.View;ImportAndroid.view.View.OnClickListener;ImportAndroid.widget.Button; @SuppressLint ("Newapi") Public classMainactivityextendsActivity {Button btn;intent Intent=NewIntent ();PrivateMenuinflater Menuinflaterinflater;//Bundle bundle = new bundle ();@TargetApi (build.version_codes. Honeycomb) @SuppressLint ("Newapi") @Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (R.layout.activity_main); ActionBar ActionBar= Getactionbar ();//Get Actionbar ObjectActionbar.setdisplayshowhomeenabled (true);//Show application iconActionbar.setdisplayhomeasupenabled (true);//turn the application icon into a clickable icon and add a return arrow. btn=(Button) Findviewbyid (R.id.about_button); Btn.setonclicklistener (NewOnclicklistener () {@Override Public voidOnClick (View arg0) {//TODO auto-generated Method Stub//Intent Intent = new Intent (); //Bundle bundle = new bundle ();Intent.setclass (mainactivity. This, Secondactivity.class); StartActivity (Intent); Mainactivity. This. Finish (); } }); } @Override Public BooleanOncreateoptionsmenu (Menu menu) {//inflate the menu; This adds items to the action bar if it is present.Menuinflater Inflater =NewMenuinflater ( This); Inflater.inflate (R.menu.main, menu); return Super. Oncreateoptionsmenu (menu); } Public Booleanonoptionsitemselected (MenuItem item) {Switch(Item.getitemid ()) { CaseAndroid. R.id.home:intent Intent=NewIntent ( This, Mainactivity.class); Intent.addflags (Intent.flag_activity_clear_top); StartActivity (Intent); Break; Caser.id.item1:intent intent1=NewIntent ( This, Help.class); StartActivity (INTENT1); Break; Caser.id.item2:intent Intent2=NewIntent ( This, about.class); StartActivity (Intent2); Break; Caser.id.item3:intent Intent3=NewIntent ( This, New_game.class); StartActivity (INTENT3); Break; default: Break; } return Super. onoptionsitemselected (item); To run the screenshot: Post-Design interface: To run the Help interface : To run the About interface: To run the new game interface: |
Five, Experimental summary (analysis of the results of the experiment, experience and improvement of experimental ideas) |
The time spent on this experiment was less than it used to be, but it was confused when the error was displayed, and people around me were looking for errors. Some mistakes are wrong and confused. For me now, the easiest mistake I can make is when I inject a package or show something new, it's easy to inject or import the wrong package and import the wrong one, so every time I have to think about it for a long time. |
Experimental reviews |
|
Experimental results |
|
Guide Teacher Signature: Date |
|
|
|
|
|
|