I'm new as an Android developer, I've researched several search sources on how to send SMS to my email, I've taken an example from a book on the internet, but running it did not generate any errors and only reported a message on screen that did not I can understand because of my lack of experience.
this was the messages in LogCat
11-26 18:09:43.721: I/Choreographer(790): Skipped 31 frames! The application may be doing too much work on its main thread.
11-26 18:09:43.971: D/gralloc_goldfish(790): Emulator without GPU emulation detected.
11-26 18:10:22.246: D/dalvikvm(790): GC_FOR_ALLOC freed 87K, 9% free 2556K/2788K, paused 27ms, total 30ms
11-26 18:10:22.476: I/Choreographer(790): Skipped 86 frames! The application may be doing too much work on its main thread.
this was the screen
Thisismyprojecthere
<?xmlversion="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="@+id/btnSendEmail"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="Send Email" />
</LinearLayout>
package br.com.google.sms2;
import com.example.sms2.R;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
public class EmailsActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void onClick(View v) {
String[] to = { "[email protected]" };
String[] cc = { "[email protected]" };
sendEmail(to, cc, "hello", "helo meu amigo");
}
private void sendEmail(String[] emailAddresses, String[] carbonCopies,
String subject, String message) {
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:"));
String[] to = emailAddresses;
String[] cc = carbonCopies;
emailIntent.putExtra(Intent.EXTRA_EMAIL, to);
emailIntent.putExtra(Intent.EXTRA_CC, cc);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(Intent.EXTRA_TEXT, message);
emailIntent.setType("message/rfc822");
startActivity(Intent.createChooser(emailIntent, "Email"));
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sms2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity android:name="br.com.google.sms2.EmailsActivity" android:label="@string/app_name">
<intent-filter >
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>