Skip to content

Commit

Permalink
hzuapps#4 提交实验4代码
Browse files Browse the repository at this point in the history
  • Loading branch information
yinghaocai committed Apr 13, 2019
1 parent d7ba9a1 commit 71afa99
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions students/com171408901141/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
</activity>
<activity
android:name=".Com1714080901141MainActivity"
android:label="@string/app_name">
android:label="@string/app_name"
android:launch="singleTask">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
public class Com1714080901141DialogActivity extends Com1714080901141BaseActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(Bundle savedInstanceState) {//This is DialogActivity's onCreate function.
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dialog);
Button select_yes=(Button) findViewById(R.id.hope_to_exit);
Button select_no=(Button) findViewById(R.id.regret_to_exit);
select_no.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(Com1714080901141DialogActivity.this,Com1714080901141MainActivity.class);
//Its launcher is singleTask,so it will start the old one instead of a new one.
startActivity(intent);
finish();//exit dialog activity

}
Expand All @@ -28,6 +31,5 @@ public void onClick(View v) {
Com1714080901141ActivityCollector.finishAll();//exit all activity
}
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
public void onBackPressed() {
Intent intent=new Intent(Com1714080901141MainActivity.this,Com1714080901141DialogActivity.class);
startActivity(intent);
}

};

@Override
protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(Bundle savedInstanceState) {//This is MainActivity's onCreate function.
super.onCreate(savedInstanceState);
exit=false;
setContentView(R.layout.activity_main);
Expand Down

0 comments on commit 71afa99

Please sign in to comment.