简体   繁体   中英

Redirect user from mobile app to website or facebook when sending mail

I have one quiz mobile app. People use it and give me feed back via mail. I have set up mail into my mobile app.

When user click on mail then see the picture how they get information. 在此处输入图片说明

I have developed webiste and I want to put a link of website. Right now the link is coming as string. When user click on link nothing happens. I want to redirect user to my website when they want to click on mail.

The code that i have written is here.

                   public void onClick(View arg0)
                            {
            // TODO Auto-generated method stub
            Intent i = new Intent(Intent.ACTION_SEND);
            i.putExtra(Intent.EXTRA_EMAIL,new String[]  
                            `enter code here`{"husnainkazmi@ymail.com"});
            String username = loaduserpref();
            Log.i("username", username);
            i.putExtra(Intent.EXTRA_CC, new String[]{username});
            i.putExtra(Intent.EXTRA_SUBJECT, "Welcome to DataBase 
                            Quiz");
            String name = loadpref();                               
            i.putExtra(Intent.EXTRA_TEXT, "DataBase Quiz " +
            "\nScored "+i_ans+" of 20 with "+result +
            "\n\nPlease Visit our website: http://website.com/");                               
            i.setType("message/rfc882");
            startActivity(Intent.createChooser(i, "Choose your email   
                            client"));      


                 }
                     });

Everythig is working but instead of string, I want to have link in mail.

If you set the mime type to "text/html" by calling

i.setType("text/html");

and then encode your website address as html - eg

<a href="http://website.com/">http://website.com/</a>

it will give you a hyperlink.

Try this one. you must use the intents in the fashion shown below.

@Override
public void onCreate(Bundle savedInstanceState)
{

    Intent i=new Intent();
    i.setAction(Intent.ACTION_VIEW);
    i.setData(Uri.parse("http://www.website.com"));
    startActivity(i);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM