1. Are you ready for the Galaxy S20? Here is everything we know so far!

Gridview child view removal/replacement

Discussion in 'Android Development' started by szw21, Dec 22, 2011.

  1. szw21

    szw21 Lurker
    Thread Starter

    Hi everyone - I'm new to Andoid development. I'm currently working on an app that has a number of views within a Gridview (Imageviews, Textviews and Linearlayout). Upon clicking the mouse button I would like to replace the existing views with new views. Where I currently have an imageview for example could be replaced with a TextView.

    I cannot figure out how to do this - I have tried various calls which suggest they delete these objects and the code does compile but then when I run it it crashes.

    Any suggestions on how to do this would be appreciated.

    1. Download the Forums for Android™ app!


  2. jiminaus

    jiminaus Well-Known Member

    Your program is crashing because an exception is being thrown. The clue to fixing your problem is going to be in what exception was thrown and why was it thrown. This information will be in the exception trace that's logged into Eclipse's console view.

    Please post that exception trace.
  3. szw21

    szw21 Lurker
    Thread Starter

    Hi thanks - yes I managed to figure it out using the debugger. I cannot recall the exact reason as I have written a lot more code since posting this but the exception that was thrown gave clues to the problem. It mainly arose as a result of copying and pasting code from another section which was not appropriate to the LinearLayout I had placed with child views in one of the grid positions.

    I've started using the debugger a lot more since.

Share This Page