title: Android - Removing inflated layout xml from a Linear Layout
body: <p>I inflated internetnotconnected.xml to a linear layout. I want to remove View which is inflated layout when user clicks to button. But my way didn't work.</p>
  
  <pre><code>if (!EZInternetConnection.isNetworkConnected(context)) {
              LinearLayout LLPureCard = (LinearLayout) ((Activity) context).findViewById(R.id.ll_main_activity_pure_card);
              LinearLayout LLPureCardContent = (LinearLayout) ((Activity) context).findViewById(R.id.ll_main_activity_pure_card_content);
              LLPureCardContent.setVisibility(View.GONE);
              LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              inflater.inflate(R.layout.internetnotconnected, LLPureCard);
              Button button = (Button) ((Activity) context).findViewById(R.id.b_internet_not_connected_try_connection);
              button.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      if (EZInternetConnection.isNetworkConnected(context)) {
  
                          LinearLayout LLPureCard = (LinearLayout) ((Activity) context).findViewById(R.id.ll_main_activity_pure_card);
                          LinearLayout LLPureCardContent = (LinearLayout) ((Activity) context).findViewById(R.id.ll_main_activity_pure_card_content);
                          int id = context.getResources().getIdentifier("internetnotconnected", "layout", context.getPackageName());
                          LLPureCard.removeView(((Activity) context).findViewById(id));
                          LLPureCardContent.setVisibility(View.VISIBLE);
                          Get20Words();
                      }
                  }
              });
              this.onCancelled();
          }
  </code></pre>