Just added a new button to my already-working-fine layout, but the findViewById function seems to be angry with something I don't get to understand.
Here's a bit of the layout:
<LinearLayout
...
>
<ListView
android:id="@+id/my_lovely_list"
android:layout_width="fill_parent"
android:layout_weight="1"
/>
<Button
android:id="@+id/my_lovely_butt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/exit_b"
android:layout_weight="0"
android:clickable="true"
/>
</LinearLayout>
And here's a bit of the coding:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
...
list_o = (ListView)findViewById(R.id.my_lovely_list);
butt_o = (Button)findViewById(R.id.my_lovely_butt);
...
}
So, the big mistery is that the ListView is found without any problem, but the Button won't by any means. I've already tried cleaning the Proyect, and look throught the posts I've found here... but still don't get to find the problem! Any thoughts?
import yourpackagename.R;
instead of android.R;
import R
of your package
Also Clean
your project that will refresh your entire project then you will also find ID
of button also
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With