Reputation: 125
I am new to android. I need to develop a basic demo which creates a button dynamically without creating respective layout. I have two activities included. In my first activity i have button with relative layout, when i click that button i should be able to enter into the second activity without creating respective layout in second activity and by creating a dynamically button there i should be able to return back to my first activity. can a button be created likewise ?
LinearLayout layout = new LinearLayout(this); layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
Button button = new Button(this);
button.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
button.setText("Previous");
layout.addView(button);
And when i write the same code in eclipse i get line marked on the FILL_PARENT ? why is it so ?
Upvotes: 1
Views: 408