Share my result

1

Good afternoon, I created a football referee application ... and I searched the internet how to share the result I found this way (a member here of stackoverflow in Portuguese)

String message = "Text I want to share.";
    Intent share = new Intent(Intent.ACTION_SEND);
    share.setType("text/plain");
    share.putExtra(Intent.EXTRA_TEXT, message);

    startActivity(Intent.createChooser(share, "Title of the dialog the system will open"));

Only the recorded message would be this String message = "Text I want to share.";

How would you display the message in String that is in the database?

I tried it that way and it did not work:

 String message = Esporte;
            Intent share = new Intent(Intent.ACTION_SEND);
            share.setType("text/plain");
            share.putExtra(Intent.EXTRA_TEXT, message);

            startActivity(Intent.createChooser(share, "Title of the dialog the system will open"));

My database (get and set):

package Base;

public class Esporte {

    private int id;
    private String nomeTimeUm;
    private String nomeTimeDois;
    private String jogadores;
    private int valorUm;
    private int valorDois;

    public Esporte(){}

    public Esporte(int id, String nomeTimeUm, String nomeTimeDois, String jogadores, int valorUm, int valorDois){
        this.id = id;
        this.nomeTimeUm = nomeTimeUm;
        this.nomeTimeDois = nomeTimeDois;
        this.jogadores = jogadores;
        this.valorUm = valorUm;
        this.valorDois = valorDois;
    }

    public int getId(){return id;}

    public void setId(int id){this.id = id;}

    public String getNomeTimeUm(){return nomeTimeUm;}

    public void setNomeTimeUm(String nomeTimeUm){this.nomeTimeUm = nomeTimeUm;}

    public String getNomeTimeDois(){return nomeTimeDois;}

    public void setNomeTimeDois(String nomeTimeDois){this.nomeTimeDois = nomeTimeDois;}

    public String getjogadores(){return jogadores;}

    public void setjogadores(String jogadores){this.jogadores = jogadores;}

    public int getValorUm(){return valorUm;}

    public void setValorUm(int valorUm){this.valorUm = valorUm;}

    public int getValorDois(){return valorDois;}

    public void setValorDois(int valorDois){this.valorDois = valorDois;}

    @Override
    public String toString(){
        return nomeTimeUm+ " X " +nomeTimeDois+
                " = " +valorUm+ " X " +valorDois + " -- " +jogadores;
    }

}

But I think I should get the last result that I recorded in the bank and share ... because if you get the nomeTimeUm , nomeTimeDois , valorUm and valorDois , it will get all that exists in the bank. .. like that I would do that

NOTE: Sport is my get and set of the database

Thank you ...

    
asked by anonymous 12.11.2016 / 17:18

1 answer

2

Just give toString() in the variable message , for example

Esporte objeto = ... recuperar as informações...
String message = objeto.ToString();
    
14.11.2016 / 01:12