Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package id.luwakdev.sportszusammen;
- /**
- * Created by OutAttacker on 2/15/2016.
- */
- import android.annotation.SuppressLint;
- import android.app.AlertDialog;
- import android.content.DialogInterface;
- import android.content.Intent;
- import android.os.Bundle;
- import android.support.v7.widget.Toolbar;
- import android.view.View;
- import android.view.View.OnClickListener;
- import android.widget.ImageView;
- import android.widget.TextView;
- public class Result2 extends Songs {
- public int correct1;
- public TextView t1,marks,result;
- public ImageView img;
- Toolbar toolbar;
- @SuppressLint("NewApi")
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.result);
- result = (TextView)findViewById(R.id.text1);
- marks = (TextView) findViewById(R.id.text2);
- t1= (TextView) findViewById(R.id.text3);;
- img = (ImageView) findViewById(R.id.imageView1) ;
- Bundle b=this.getIntent().getExtras();
- // String[] array=b.getStringArray("mes");
- String recive = getIntent().getStringExtra("string");
- int point = Integer.parseInt(recive);
- //t1.setText(recive);
- marks.setText(recive+" "+"Out Of 15");
- //result.setText(rec.toString());
- if(point == 15 ){
- img.setBackgroundResource(R.drawable.excelent);
- t1.setText("Excellent");}
- if(point > 10 && point <= 14){
- img.setBackgroundResource(R.drawable.good);
- t1.setText("Good");}
- if(point > 5 && point <= 9 ){
- img.setBackgroundResource(R.drawable.average);
- t1.setText("Average");}
- if(point <= 5 ){
- t1.setText("Poor");
- img.setBackgroundResource(R.drawable.poor);
- }
- toolbar = (Toolbar) findViewById(R.id.tool_bar);
- setSupportActionBar(toolbar);
- getSupportActionBar().setTitle("Quiz Result");
- int[] ques={R.drawable.poor,R.drawable.average,R.drawable.good,R.drawable.excelent};
- ///////////////////////////////////////////////////////////
- final View Button = findViewById(R.id.home);
- Button.setOnClickListener(new OnClickListener(){
- @Override
- public void onClick(View view) {
- Intent intent = new Intent(Result2.this,MainActivity.class);
- startActivity(intent);
- finish();
- }
- });
- }
- @Override
- public void onBackPressed() {
- AlertDialog.Builder builder = new AlertDialog.Builder(Result2.this);
- builder.setMessage("Do you really want to exit?.").setCancelable(
- false).setPositiveButton("Quit",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- Result2.this.finish();
- Intent intent = new Intent(Result2.this,MainActivity.class);
- startActivity(intent);
- }
- }).setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- }
- });
- AlertDialog alert = builder.create();
- alert.show();
- }
- public boolean onCreateOptionsLayout(View view) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getLayoutInflater().inflate(R.layout.activity_main, null);
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement