How can i use compose email activity in tabView?

后端 未结 2 1153
小蘑菇
小蘑菇 2021-01-27 12:47

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

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

    //View ta         


        
2条回答
  •  温柔的废话
    2021-01-27 13:20

    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();
        }
    }
    

提交回复
热议问题