root / src / com / rackspacecloud / android / ContactActivity.java @ 5018a7f8
History | View | Annotate | Download (1.8 kB)
1 |
package com.rackspacecloud.android; |
---|---|
2 |
|
3 |
import java.util.ArrayList; |
4 |
|
5 |
import android.content.Intent; |
6 |
import android.net.Uri; |
7 |
import android.os.Bundle; |
8 |
import android.util.Log; |
9 |
import android.view.View; |
10 |
import android.widget.Button; |
11 |
|
12 |
public class ContactActivity extends GaActivity{ |
13 |
|
14 |
ArrayList<String[]> contacts; |
15 |
private final String USNUMBER = "1-877-934-0407"; |
16 |
private final String UKNUMBER = "0800-083-3012"; |
17 |
private final String twitterAddress = "twitter.com/rackspace"; |
18 |
|
19 |
public void onCreate(Bundle savedInstanceState) { |
20 |
super.onCreate(savedInstanceState);
|
21 |
trackPageView(GoogleAnalytics.PAGE_CONTACT); |
22 |
setContentView(R.layout.contactrackspace); |
23 |
setUpButtons(); |
24 |
} |
25 |
|
26 |
private void setUpButtons(){ |
27 |
|
28 |
Button usButton = (Button)findViewById(R.id.contact_us_button); |
29 |
usButton.setText(USNUMBER); |
30 |
usButton.setOnClickListener(new View.OnClickListener() { |
31 |
public void onClick(View v){ |
32 |
String phone = "tel:" + USNUMBER; |
33 |
Intent i = new Intent(Intent.ACTION_DIAL, Uri.parse(phone));
|
34 |
startActivity(i); |
35 |
} |
36 |
}); |
37 |
|
38 |
Button ukButton = (Button)findViewById(R.id.contact_uk_button); |
39 |
ukButton.setText(UKNUMBER); |
40 |
ukButton.setOnClickListener(new View.OnClickListener() { |
41 |
public void onClick(View v){ |
42 |
String phone = "tel:" + UKNUMBER; |
43 |
Intent i = new Intent(Intent.ACTION_DIAL, Uri.parse(phone));
|
44 |
startActivity(i); |
45 |
} |
46 |
}); |
47 |
|
48 |
Button twitterButton = (Button)findViewById(R.id.contact_twitter_button); |
49 |
twitterButton.setText(twitterAddress); |
50 |
twitterButton.setOnClickListener(new View.OnClickListener() { |
51 |
public void onClick(View v){ |
52 |
Log.d("info", "http://" + twitterAddress); |
53 |
Intent browse = new Intent(Intent.ACTION_VIEW , Uri.parse("http://mobile.twitter.com/rackspace")); |
54 |
startActivity(browse); |
55 |
|
56 |
} |
57 |
}); |
58 |
|
59 |
} |
60 |
|
61 |
} |