Statistics
| Branch: | Revision:

root / src / com / rackspacecloud / android / ServerErrorActivity.java @ e6c34a0f

History | View | Annotate | Download (1.8 kB)

1
package com.rackspacecloud.android;
2

    
3
import android.app.Activity;
4
import android.content.Intent;
5
import android.os.Bundle;
6
import android.util.Log;
7
import android.view.View;
8
import android.view.View.OnClickListener;
9
import android.view.Window;
10
import android.widget.Button;
11
import android.widget.TextView;
12

    
13

    
14
public class ServerErrorActivity extends Activity {
15

    
16
        private Button okButton;
17
        private Button detailsButton;
18
        private String message;
19
        private String response;
20
        private String request;
21
        
22
        public void onCreate(Bundle savedInstanceState) {
23
                super.onCreate(savedInstanceState);
24
                requestWindowFeature(Window.FEATURE_NO_TITLE);  
25
                setContentView(R.layout.servererror);
26
                message = (String) this.getIntent().getExtras().get("errorMessage");
27
                response = (String) this.getIntent().getExtras().get("response");
28
                request = (String) this.getIntent().getExtras().get("request");
29
                setUpText();
30
                setUpInputs();
31
        } 
32

    
33
        private void setUpText(){
34
                TextView messageText = ((TextView) findViewById(R.id.server_error_message));
35
                messageText.setText(message);
36
        }
37

    
38
        private void setUpInputs(){
39
                okButton = ((Button) findViewById(R.id.server_error_ok_button));
40
                okButton.setOnClickListener(new OnClickListener() {
41
                        @Override
42
                        public void onClick(View v) {
43
                                finish();
44
                        }
45
                });
46

    
47

    
48
                detailsButton = ((Button) findViewById(R.id.server_error_details_button));
49
                detailsButton.setOnClickListener(new OnClickListener() {                
50
                        @Override
51
                        public void onClick(View v) {
52
                                startErrorDetails();
53
                        }
54
                });
55
        }
56
        
57
        private void startErrorDetails(){
58
                Intent viewIntent = new Intent(this, ErrorDetailsActivity.class);
59
                viewIntent.setFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
60
            viewIntent.putExtra("request", request);
61
            viewIntent.putExtra("response", response);
62
            startActivity(viewIntent);
63
        }
64

    
65
}