Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COAfter working with your code and trying to understand what was happening better, it looks like your solution is correct. However my emulator gave me an error message, unable to start app. Some source of issues could be the line where you create the new button. You have (context) rather than (this). What do you mean here? I got an error with (context) so I changed it to (this). Next, I added your linearlayout code to the onClick method. Is this correct? I'm unsure where the my issue exists because theoretically it makes sense.
      singulars
    2. COI use `context` instead of this, because in my Class body on every class I create, I have `Context context;` Then in my `onCreate` of every class I have, I put `context = this;`. That way, every time I need to reference a context, I can do so with no issues. For example: If you are within an `onClickListener`, then using `this` for the context doesn't work, so I refer to my global variable `context`. You are free to use `this`. I just prefer to setup the `context` variable as I described. It's simpler.
      singulars
    3. COI would recommend putting the layout instantiation line in your `onCreate`. Then, you would retrieve data from the internet, and update your layout after using the `params`, `setLayoutParams` and `addView` lines, and this will add a button to the screen. In the `onClick` of said button, you would place whatever code you need to `startActivity`. Another person answered recommending an Adapter. That may work better for you, but I don't know as I have no experience with them. In my apps, the above method was satisfactory.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload