title: How to get ViewId dynamically in android
body: <p>How to get the ID of dynamically created View in android ?  Actually I have many views in my layout and i want the id of that view which is touched by user. It it possible? if Yes than how to do it? </p>
  
  <p>In the following code new Frame Layout is created, I have generateViewId for this layout and save this id as key to HashMap (logoResizingRecordList).</p>
  
  <pre><code> FrameLayout fm=new FrameLayout(getApplication());
   FrameLayout.LayoutParams params=new FrameLayout.LayoutParams(400,300);
                      fm.addView(img_pinch,params);
  
   int FrameLayoutID=fm.generateViewId();
  
   logoResizingRecordList.put(FrameLayoutID,logoObj);
   fm.setOnTouchListener(logoTouchListner);
  </code></pre>
  
  <p>Here OnTouch I have assign instance of FrameLayout to temp_img_logo.</p>
  
  <pre><code>public boolean onTouch(final View p_v, MotionEvent p_event)
      {            
          if(p_v instanceof FrameLayout) {           
              temp_img_logo=(FrameLayout)p_v;
          }
  </code></pre>
  
  <p>here I want to get the id of the above FrameLayout (fm) But it return the default Id of any View i.e -1</p>
  
  <pre><code>logoResizingRecordList.get(temp_img_logo.getId())
  </code></pre>
  
  <p>Now my question is that is it possible to get the id of fm (FrameLayout) that i have created dynamically? If yes then please help me out to find it.</p>