Define setContentView with variable
<p>I'm newbie in android, and i'm trying to receive a variable through the Intent function, and according the and depending on the value of the variable is supposed to show a contentview.</p>

<pre><code>Bundle parametros = getIntent().getExtras();
String type = parametros.getString("tipo");
int accao = parametros.getInt("accao");

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (type=="medicamentos") {
        Button voltar = (Button) findViewById(R.id.button1);
        voltar.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                Intent medIntent = new Intent(view.getContext(), Listar.class);
                startActivityForResult(medIntent, 0);
            }
        });
        if (accao==1)
            setContentView(R.layout.adicionar_medicamentos);

        if (accao==2)
            setContentView(R.layout.editar_medicamentos);
    }
}
</code></pre>

<p>What i'm doing wrong? Thanks</p>
