0

I want to display compose email in Tab Activity. It is my code.

        TabHost tabHost=getTabHost();
    TabHost.TabSpec spec;
    Intent intent;

    //View tabView= tabHost.getChildAt(0);
    //tabView.setPadding(0, 13, 0, 13);
    //tabView.setBackgroundColor(0xFFFFFFFF);
    intent=new Intent("com.android.phone.action.RECENT_CALLS").setClass(this,CallListActivity.class);
    spec=tabHost.newTabSpec("Call").setIndicator("Call").setContent(intent);
    tabHost.addTab(spec);

    intent=new Intent("android.intent.action.Compose_EMAIL");
    intent.setClassName("com.android.email", "com.android.email.activity.MessageCompose");
    spec=tabHost.newTabSpec("Message").setIndicator("Message").setContent(intent);
    tabHost.addTab(spec);    

    intent=new Intent().setClass(this, com.android.contacts.qs.logger.email.QsEmailLogger.class);
    spec=tabHost.newTabSpec("Email").setIndicator("Email").setContent(intent);
    tabHost.addTab(spec);

    intent=new Intent().setClass(this,com.android.contacts.qs.logger.notification.NotificationLogger.class);
    spec=tabHost.newTabSpec("Notification").setIndicator("Notification").setContent(intent);
    tabHost.addTab(spec);                      

    tabHost.setCurrentTab(0);

This code is generate Error. Error is 03-16 12:04:09.132: E/AndroidRuntime(312): java.lang.SecurityException: Requesting code from com.android.email (with uid 10011) to be run in process android.process.acore (with uid 10001)

   intent=new Intent("android.intent.action.Compose_EMAIL");
    intent.setClassName("com.android.email", "com.android.email.activity.MessageCompose");
    spec=tabHost.newTabSpec("Message").setIndicator("Message").setContent(intent);
    tabHost.addTab(sp
Bhargav Panchal
  • 1,159
  • 1
  • 12
  • 27

2 Answers2

1

on tab button click you can call a method

        tv_email.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {

                sendSimpleEmail(tv_email);
            }
        });        

this is a method which is used to open a compose email window ,call this method onClick

  public void sendSimpleEmail(View textView) {
    try {

  Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
        emailIntent.setType("plain/text");

        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                new String[] { email_add });
        startActivity(emailIntent);
    } catch (Exception e) {

        Toast.makeText(getApplicationContext(),
                "First Log in to your Email Account", Toast.LENGTH_LONG)
                .show();
    }
}
Nikhil Lamba
  • 593
  • 1
  • 6
  • 17
  • i am working on Ginger Bread source code. and i want to call MeassageCompose.java activity in Contact package.I am modify core email function that why i couldn't use this meassage. – Bhargav Panchal Mar 16 '12 at 11:58
1

In your Application Manifest write the below lines,

android:sharedUserId="android.uid.shared"
android:sharedUserLabel="@string/sharedUserLabel"

The sharedUserId parameter is used to share the code,process,data between two apps. So thes code will apply in both the apps.

and also write these lines in your .mk file of both the apps...

LOCAL_CERTIFICATE := shared
Parthraj
  • 573
  • 5
  • 16