root / src / com / rackspacecloud / android / ServerErrorActivity.java @ b722cab3
History | View | Annotate | Download (1.7 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 |
|
13 |
public class ServerErrorActivity extends Activity { |
14 |
|
15 |
private Button okButton; |
16 |
private Button detailsButton; |
17 |
private String message; |
18 |
private String response; |
19 |
private String request; |
20 |
|
21 |
public void onCreate(Bundle savedInstanceState) { |
22 |
super.onCreate(savedInstanceState);
|
23 |
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
24 |
setContentView(R.layout.servererror); |
25 |
message = (String) this.getIntent().getExtras().get("errorMessage"); |
26 |
response = (String) this.getIntent().getExtras().get("response"); |
27 |
request = (String) this.getIntent().getExtras().get("request"); |
28 |
setUpText(); |
29 |
setUpInputs(); |
30 |
} |
31 |
|
32 |
private void setUpText(){ |
33 |
TextView messageText = ((TextView) findViewById(R.id.server_error_message)); |
34 |
messageText.setText(message); |
35 |
} |
36 |
|
37 |
private void setUpInputs(){ |
38 |
okButton = ((Button) findViewById(R.id.server_error_ok_button));
|
39 |
okButton.setOnClickListener(new OnClickListener() {
|
40 |
@Override
|
41 |
public void onClick(View v) { |
42 |
finish(); |
43 |
} |
44 |
}); |
45 |
|
46 |
|
47 |
detailsButton = ((Button) findViewById(R.id.server_error_details_button));
|
48 |
detailsButton.setOnClickListener(new OnClickListener() {
|
49 |
@Override
|
50 |
public void onClick(View v) { |
51 |
startErrorDetails(); |
52 |
} |
53 |
}); |
54 |
} |
55 |
|
56 |
private void startErrorDetails(){ |
57 |
Intent viewIntent = new Intent(this, ErrorDetailsActivity.class); |
58 |
viewIntent.setFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP); |
59 |
viewIntent.putExtra("request", request);
|
60 |
viewIntent.putExtra("response", response);
|
61 |
startActivity(viewIntent); |
62 |
} |
63 |
|
64 |
} |