When I'm clicking a button, that is indeed inside an LinearLayout, I get this error on this line:
LinearLayout ll = (LinearLayout) view;
My method looks like this:
public void adjDoa(final View view) {
final CharSequence[] items = {"Get on with it!", "Doable!", "Maybe, maybe not.", "Unlikely!", "When pigs fly!"};
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(GetItActivity.this);
dialogBuilder.setTitle("Choose doability!");
dialogBuilder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
LinearLayout ll = (LinearLayout) view;
TextView text = (TextView)ll.findViewById(R.id.tViewChDoa);
text.setText(items[which]);
}
});
dialogBuilder.create().show();
}
What does it mean?
viewis a Button, not a LinearLayout, and you cannot cast a Button to LinearLayoutLinearLayout parent = (LinearLayout) view.getParent()