Statistics
| Branch: | Revision:

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

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.view.View;
7
import android.view.View.OnClickListener;
8
import android.view.Window;
9
import android.widget.Button;
10
import android.widget.TextView;
11

    
12
import com.rackspace.cloud.android.R;
13

    
14

    
15
public class ServerErrorActivity extends Activity {
16

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

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

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

    
48

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

    
66
}