In my OnCreate Method i need to create four buttons for example, but will 
be dynamically creations.  but this does not work =/

> Button botao = new Button(LinearLayoutActivity.this);
>
>         botao.setText("Clique");
>
>         
>
>         botao.setOnClickListener(new OnClickListener() {
>
>  @Override
>
> public void onClick(View v) {
>
> Toast.makeText(LinearLayoutActivity.this, "Clicado", 
>> Toast.LENGTH_LONG).show();
>
> }
>
> });
>
>         
>
>         setContentView(R.layout.main);   
>
>         
>
>         LinearLayout mainLayout = (LinearLayout)findViewById(R.id.layout1);
>
>         for (int i = 0; i < 4; i++) {
>
>  mainLayout.addView(botao);
>
> }
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to