Skip to content

Commit 7b91d71

Browse files
committed
Import code for "Email from a Text View"
1 parent eb464c5 commit 7b91d71

File tree

14 files changed

+186
-0
lines changed

14 files changed

+186
-0
lines changed

EmailTextView/AndroidManifest.xml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.emailtextview"
4+
android:versionCode="1"
5+
android:versionName="1.0" >
6+
7+
<uses-sdk
8+
android:minSdkVersion="5"
9+
android:targetSdkVersion="10" />
10+
11+
<uses-permission
12+
android:name="android.permission.INTERNET" />
13+
14+
<application
15+
android:allowBackup="true"
16+
android:icon="@drawable/ic_launcher"
17+
android:label="@string/app_name"
18+
android:theme="@style/AppTheme" >
19+
<activity
20+
android:name="com.example.emailtextview.MainActivity"
21+
android:label="@string/app_name" >
22+
<intent-filter>
23+
<action android:name="android.intent.action.MAIN" />
24+
25+
<category android:name="android.intent.category.LAUNCHER" />
26+
</intent-filter>
27+
</activity>
28+
</application>
29+
30+
</manifest>

EmailTextView/ic_launcher-web.png

54.4 KB
Loading
377 KB
Binary file not shown.

EmailTextView/proguard-project.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# To enable ProGuard in your project, edit project.properties
2+
# to define the proguard.config property as described in that file.
3+
#
4+
# Add project specific ProGuard rules here.
5+
# By default, the flags in this file are appended to flags specified
6+
# in ${sdk.dir}/tools/proguard/proguard-android.txt
7+
# You can edit the include path and order by changing the ProGuard
8+
# include property in project.properties.
9+
#
10+
# For more details, see
11+
# http://developer.android.com/guide/developing/tools/proguard.html
12+
13+
# Add any project specific keep options here:
14+
15+
# If your project uses WebView with JS, uncomment the following
16+
# and specify the fully qualified class name to the JavaScript interface
17+
# class:
18+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19+
# public *;
20+
#}

EmailTextView/project.properties

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system edit
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
#
10+
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11+
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12+
13+
# Project target.
14+
target=android-10
8.02 KB
Loading
Loading
3.97 KB
Loading
13.2 KB
Loading
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:orientation="vertical"
5+
android:layout_width="fill_parent"
6+
android:layout_height="fill_parent">
7+
8+
<Button
9+
android:id="@+id/emailButton"
10+
android:text="Email Text!"
11+
android:layout_width="fill_parent"
12+
android:layout_height="wrap_content">
13+
</Button>
14+
15+
<EditText
16+
android:id="@+id/text_to_email"
17+
android:inputType="text"
18+
android:layout_width="fill_parent"
19+
android:layout_height="wrap_content"
20+
android:lines="10"
21+
android:text="@string/my_text" />
22+
23+
</LinearLayout>
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
2+
3+
<item
4+
android:id="@+id/menu_settings"
5+
android:orderInCategory="100"
6+
android:title="@string/menu_settings"/>
7+
8+
</menu>

EmailTextView/res/values/strings.xml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<string name="app_name">EmailAndroid</string>
5+
<string name="hello">Hello world!</string>
6+
<string name="menu_settings">Settings</string>
7+
<string name="my_text">
8+
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
9+
Ipsum has been the industry's standard dummy text ever since the 1500s, when
10+
an unknown printer took a galley of type and scrambled it to make a type
11+
specimen book. It has survived not only five centuries, but also the leap into
12+
electronic typesetting, remaining essentially unchanged. It was popularised in
13+
the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
14+
and more recently with desktop publishing software like Aldus PageMaker
15+
including versions of Lorem Ipsum." &#8212; http://www.lipsum.com/
16+
</string>
17+
</resources>

EmailTextView/res/values/styles.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<resources>
2+
3+
<!--
4+
Base application theme, dependent on API level. This theme is replaced
5+
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
6+
-->
7+
<style name="AppBaseTheme" parent="android:Theme.Light">
8+
<!--
9+
Theme customizations available in newer API levels can go in
10+
res/values-vXX/styles.xml, while customizations related to
11+
backward-compatibility can go here.
12+
-->
13+
</style>
14+
15+
<!-- Application theme. -->
16+
<style name="AppTheme" parent="AppBaseTheme">
17+
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
18+
</style>
19+
20+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.example.emailtextview;
2+
3+
import android.app.Activity;
4+
import android.content.Intent;
5+
import android.os.Bundle;
6+
import android.view.Menu;
7+
import android.view.View;
8+
import android.view.View.OnClickListener;
9+
import android.widget.Button;
10+
11+
public class MainActivity extends Activity implements OnClickListener {
12+
13+
private static final String tag = "Main";
14+
private Button emailButton;
15+
16+
/** Called when the activity is first created. */
17+
@Override
18+
public void onCreate(Bundle savedInstanceState)
19+
{
20+
super.onCreate(savedInstanceState);
21+
22+
// Set the View Layer
23+
setContentView(R.layout.activity_main);
24+
25+
// Get referenc to Email Button
26+
this.emailButton = (Button) this.findViewById(R.id.emailButton);
27+
28+
// Sets the Event Listener onClick
29+
this.emailButton.setOnClickListener(this);
30+
31+
}
32+
33+
@Override
34+
public void onClick(View view) {
35+
if (view == this.emailButton) {
36+
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
37+
emailIntent.setType("text/html");
38+
emailIntent.putExtra(android.content.Intent.EXTRA_TITLE, "My Title");
39+
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My Subject");
40+
41+
// Obtain reference to String and pass it to Intent
42+
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.my_text));
43+
startActivity(emailIntent);
44+
}
45+
}
46+
47+
@Override
48+
public boolean onCreateOptionsMenu(Menu menu) {
49+
// Inflate the menu; this adds items to the action bar if it is present.
50+
getMenuInflater().inflate(R.menu.activity_main, menu);
51+
return true;
52+
}
53+
54+
}

0 commit comments

Comments
 (0)