Skip to content
Snippets Groups Projects
Commit c63968aa authored by viveksvdy2014's avatar viveksvdy2014
Browse files

Changed Back Button Funtionality in CountDown Screen and Fixed Multiple Activity Backstash !

parent 5e0ea630
Branches
No related tags found
No related merge requests found
......@@ -58,26 +58,18 @@ public class MainActivity extends AppCompatActivity {
ImageButton help = (ImageButton)findViewById(R.id.helpButton);
help.setOnLongClickListener(new View.OnLongClickListener(){
public boolean onLongClick(View v){
onClick();
backCount=0;
startActivity(intent);
finish();
return true;
}
});
}
public void onClick(){
backCount=0;
Log.i("zz",""+choice);
switch(choice) {
case 0:
startActivity(intent);
break;
case 1: stopService(intent);
break;
}
choice=(choice+1)%2;
}
public void contact(View v)
{
......
......@@ -4,6 +4,7 @@ import android.app.Service;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Handler;
import android.os.IBinder;
import android.provider.MediaStore;
import android.widget.MediaController;
......@@ -24,6 +25,15 @@ public class alarmService extends Service {
super.onCreate();
mediaPlayer = MediaPlayer.create(this,R.raw.danger);
forceFullVolume();
final Handler handler = new Handler();
Runnable run = new Runnable() {
@Override
public void run() {
forceFullVolume();
handler.postDelayed(this,1000);
}
};
handler.post(run);
}
@Override
......
......@@ -63,6 +63,7 @@ public class confirmationScreen extends AppCompatActivity {
Toast.makeText(confirmationScreen.this, "Distress Calls Cancelled!", Toast.LENGTH_SHORT).show();
Intent main = new Intent(confirmationScreen.this,MainActivity.class);
startActivity(main);
finish();
}
else
handler2.postDelayed(this,100);
......@@ -98,6 +99,10 @@ public class confirmationScreen extends AppCompatActivity {
{
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
}
@Override
public void onBackPressed() {
Toast.makeText(this, "Please Enter the PIN CODE in order to Go Back!!!", Toast.LENGTH_SHORT).show();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment