小学四则运算APP 第三阶段冲刺-第一天
团队成员:陈淑筠、杨家安、陈曦
团队选题:小学四则运算APP
第三次冲刺阶段时间:12.12~12.19
本次发布的是音乐播放功能,可以根据用户需求一边播放音乐一边做题,也拥有暂停播放音乐的功能,增强APP的实用性
MainActivity.java:
package com.example.calculator; import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button; public class MainActivity extends Activity { private Button xunlian,choice;
private Button playmusic; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findView();
playmusic.setOnClickListener(startlis);
xunlian=(Button)findViewById(R.id.button1);
Log.i("PlayMusic", "PlayMusic onCreate被运行");
choice=(Button)findViewById(R.id.button2); xunlian.setOnClickListener(new OnClickListener() { @Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent=new Intent();
intent.setClass(MainActivity.this, CalculatorSet.class);
startActivity(intent);
MainActivity.this.finish();
}
});
choice.setOnClickListener(new OnClickListener() { @Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent=new Intent();
intent.setClass(MainActivity.this, ChoiceSet.class);
startActivity(intent);
MainActivity.this.finish();
}
});
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
Log.i("PlayMusic", "PlayMusic onStart被运行");
} @Override
protected void onRestart() {
// TODO Auto-generated method stub
super.onRestart();
Log.i("PlayMusic", "PlayMusic onRestart被运行");
} @Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
Log.i("PlayMusic", "PlayMusic onResume被运行");
} @Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
Log.i("PlayMusic", "PlayMusic onStop被运行");
} @Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
Log.i("PlayMusic", "PlayMusic onPause被运行");
} @Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
Log.i("PlayMusic", "PlayMusic onDestroy被运行");
} private OnClickListener startlis=new OnClickListener(){ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
startService(new Intent(MainActivity.this, MusicService.class));
//启动服务
} }; private void findView() {
// TODO Auto-generated method stub
playmusic=(Button)findViewById(R.id.playmusic);
} @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
} }
activity_main.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:background="@drawable/sea"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" > <TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="122dp"
android:text="@string/hello_world"
android:textSize="@dimen/btnTextSize" /> <Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_alignRight="@+id/textView2"
android:layout_below="@+id/textView2"
android:layout_marginTop="56dp"
android:text="进入普通训练系统"
android:textSize="@dimen/btnTextSizes" /> <Button
android:id="@+id/button2"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_alignRight="@+id/button1"
android:layout_below="@+id/button1"
android:layout_marginTop="23dp"
android:text="进入选择题训练系统"
android:textSize="@dimen/btnTextSizes"/> <Button
android:id="@+id/button3"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button2"
android:layout_alignRight="@+id/button2"
android:layout_below="@+id/button2"
android:layout_marginTop="21dp"
android:text="进入考试题目系统"
android:textSize="@dimen/btnTextSizes" /> <Button
android:id="@+id/playmusic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@drawable/music" /> <Button
android:id="@+id/stopmusic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/playmusic"
android:layout_toRightOf="@+id/playmusic"
android:background="@drawable/button_blue_pause" /> </RelativeLayout>
MusicService.java:
package com.example.calculator; import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;
import android.util.Log; public class MusicService extends Service{
private MediaPlayer mp;
private String TAG="Main"; @Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
super.onCreate();
mp=MediaPlayer.create(this,R.raw.big);
Log.i(TAG, "MusicService onCreate被运行");
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// TODO Auto-generated method stub
mp.start();
Log.i(TAG, "MusicService onStartCommand被运行");
return super.onStartCommand(intent, flags, startId); }
@Override
public void onDestroy() {
super.onDestroy();
mp.stop();
Log.i(TAG, "MusicService onDestroy被运行");
}
}
运行结果:

小学四则运算APP 第三阶段冲刺-第一天的更多相关文章
- 小学四则运算APP 第三阶段冲刺
<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android=" ...
- 小学四则运算APP 第一个冲刺阶段 第三天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布是在与团队成员解决了昨天问题的基础上,再增加了几个界面,增加了一些功能,修改与增加的代 ...
- 小学四则运算APP 第一个冲刺阶段 第四天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布我们增加了CalculatorsActivity.java.YunsuanActivi ...
- 小学四则运算APP 第一个冲刺阶段 第一天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 思考:初步了解小学四则运算数是在100以内的加减乘除,首先先从简单的地方入手,把最基础的算法功 ...
- 小学四则运算APP 第一个冲刺阶段 第六天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是重新排列整齐ResultActivity的布局代码activity_result. ...
- 小学四则运算APP 第一个冲刺阶段 第五天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是实现练习功能的成功 代码: public class CalculatorActi ...
- 小学四则运算APP 第一阶段冲刺 第二天-补
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布已经解决上次问题,问题是写程序逻辑错误,问题已经修改!我们还增加两个模块的面板设置,如 ...
- 小学四则运算APP 第二阶段冲刺-第三天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第二次冲刺阶段时间:11.29~12.09 本次发布的是判断题的部分代码 panduanset.java import com.examp ...
- 小学四则运算APP 第二个冲刺 第一天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第二次冲刺阶段时间:11.29~12.09 本次发布的是已完成的功能二(选择题): ChoiceActivity.java: packag ...
随机推荐
- 【项目 · WonderLand】 系 统 设 计
团 队 作 业 ---- 系 统 设 计 Part 0 · 简 要 目 录 Part 1 · 完 善 需 求 规 格 说 明 书 Part 2 · 团 队 编 码 规 范 Part 3 · 数 据 库 ...
- Nginx使用教程(一):下载并编译安装Nginx
安装依赖 <br\>我们已经选择下载程序源代码进行手动编译,而不是使用软件包管理器(如Yum,Aptitude或Yast)进行安装. 这个选择有两个原因. 首先,软件包可能不包含在您的Li ...
- vuejs_01项目启动
知识点 .npm 相关命令 npm list -g --depth= 查看全局安装了哪些依赖 项目启动 npm install vue-cli -g 安装vue脚手架 vue init webpack ...
- Android UI开发神兵利器之Android Action Bar Style Generator
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/x359981514/article/details/26283129 ActionBar是3.0后的 ...
- centos7下安装docker(8.3容器的常用操作)
yu我们之前已经学习了如何运行容器docker run,也学习了如何进入容器docker attach和docker exec,下面我们来学习容器的其他操作: stop/start/restart 1 ...
- 面试被问http协议?这篇文章足够覆盖所有相关问题!
http使用面向连接的TCP作为传输层协议.http本身无连接. 请求报文 CRLF是回车换行 方法为GET的请求报文 方法为POST的请求报文 方法 OPTIONS:这个方法 ...
- PID控制本版一 (M100可用)
版本1 云台+无人机 https://en.wikipedia.org/wiki/PID_controller https://github.com/tekdemo/MiniPID 详细讲解 PIDC ...
- 利用原生JS实现网页1920banner图滚动效果
内容描述:随着PC设备硬件性能的进步和分辨率的不断提高,现在主流网站逐渐开始采用1920banner图,为适应这一趋势,博主设计了1920banner图的滚动效果,代码利用了原生JS实现了1920ba ...
- 20145236《网络攻防》Exp5 MSF基础应用
20145236<网络攻防>Exp5 MSF基础应用 一.基础问题回答 解释exploit,payload,encode是什么: exploit就是负责负载有用代码的交通工具,先通过exp ...
- Cookie,Session的区别
1.Cookie 存储在用户本地上即客户端的数据,用来辨别用户的身份. 如果勾选了记住我则会在C盘中保存Cookie的信息,直至Cookie设置的有效期过期 注意: (1)记录用户访问次数 (2)不可 ...