团队成员:陈淑筠、杨家安、陈曦

团队选题:小学四则运算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 第三阶段冲刺-第一天的更多相关文章

  1. 小学四则运算APP 第三阶段冲刺

    <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android=" ...

  2. 小学四则运算APP 第一个冲刺阶段 第三天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布是在与团队成员解决了昨天问题的基础上,再增加了几个界面,增加了一些功能,修改与增加的代 ...

  3. 小学四则运算APP 第一个冲刺阶段 第四天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布我们增加了CalculatorsActivity.java.YunsuanActivi ...

  4. 小学四则运算APP 第一个冲刺阶段 第一天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 思考:初步了解小学四则运算数是在100以内的加减乘除,首先先从简单的地方入手,把最基础的算法功 ...

  5. 小学四则运算APP 第一个冲刺阶段 第六天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是重新排列整齐ResultActivity的布局代码activity_result. ...

  6. 小学四则运算APP 第一个冲刺阶段 第五天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是实现练习功能的成功 代码: public class CalculatorActi ...

  7. 小学四则运算APP 第一阶段冲刺 第二天-补

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布已经解决上次问题,问题是写程序逻辑错误,问题已经修改!我们还增加两个模块的面板设置,如 ...

  8. 小学四则运算APP 第二阶段冲刺-第三天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第二次冲刺阶段时间:11.29~12.09 本次发布的是判断题的部分代码 panduanset.java import com.examp ...

  9. 小学四则运算APP 第二个冲刺 第一天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第二次冲刺阶段时间:11.29~12.09 本次发布的是已完成的功能二(选择题): ChoiceActivity.java: packag ...

随机推荐

  1. Pair Programming 2

    学生-社团匹配程序 项目流程: 1. 分析讨论 2. 分工合作 3. 代码规范 4. 编码实现 5. 模块结合 6. 测试修改 7. 数据样例 8. 心得体会 9. GitHub链接 结对队友:陈文举 ...

  2. 780. Reaching Points

    idea: 1.从后向前找 2.while (tx > ty) tx -= ty; 替为 % 操作 3.经过循环后,必定只有两种情况才true sx == tx && sy &l ...

  3. 解决input框黄色背景问题(转)

    input:-webkit-autofill { box-shadow: 0 0 0px 1000px white inset !important;} <form action="l ...

  4. django 中的 ajax

    (Asynchronous Javascript And XML ) 特点: 异步 页面局部刷新 传递的数据量小 ajax 请求返回数据 重定向 location.href='/index/' 发请求 ...

  5. A - Divisors POJ - 2992 (组合数C的因子数)数学—大数

    题意:就是求组合数C的因子的个数! 先说一下自己THL的算法,先把组合数求出来,然后将这个大数分解,得到各个素数的个数,再利用公式!用最快的大数分解算法 分析一下时间复杂度!   n1/4但是分析一下 ...

  6. Street Numbers POJ - 1320(佩尔方程式)

    题意:就是从n到1再从1到n的各个数字之和为sum1, 然后从n到m,再从m到n的各个数字之和为sum2,求,(n,m)的前10组解. 思路: 直接建模,利用等差数列的求和公式计算一个公式(2n+1) ...

  7. Mysql优化_慢查询开启说明及Mysql慢查询分析工具mysqldumpslow用法讲解

    Mysql优化_慢查询开启说明及Mysql慢查询分析工具mysqldumpslow用法讲解   Mysql慢查询开启 Mysql的查询讯日志是Mysql提供的一种日志记录,它用来记录在Mysql中响应 ...

  8. go标准库的学习-io/ioutil

    参考https://studygolang.com/pkgdoc 导入方式: import "io/ioutil" 包ioutil实现了一些I/O实用程序函数. 1.var 变量 ...

  9. redsi一主两从三哨兵

    1.前提准备 防火墙,selinux,主机名解析,所有主机安装gcc [root@localhost ~]# vim /etc/hosts 192.168.122.135  redis_master ...

  10. python在图片上写汉字

    1.python opencv的putText只能画英文上去 2.借鉴这个https://blog.csdn.net/dcrmg/article/details/79108491 使用pil 首先,你 ...