title: How to go listview adapter item click listener to fragment in android?
body: <p>I want to go from listview adapter itemview click listener to fragment with extra details that i want to use in that fragment where i go..I use this list view adapter class.I want to go from listview adapter itemview click listener to fragment with extra details that i want to use in that fragment where i go..I use this list view adapter class.</p>
  
  <pre><code>public class ListViewAdapter extends BaseAdapter {
  
      // Declare Variables
      Context context;
      LayoutInflater inflater;
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; data;
  
      HashMap&lt;String, String&gt; resultp = new HashMap&lt;String, String&gt;();
      public ListViewAdapter(Context context, ArrayList&lt;HashMap&lt;String, String&gt;&gt; arraylist) {
          this.context = context;
          data = arraylist;
      }
    @Override
      public int getCount() {
          return data.size();
      }
  
      @Override
      public Object getItem(int position) {
          return null;
      }
  
      @Override
      public long getItemId(int position) {
          return 0;
      }
  
      public View getView(final int position, View convertView, ViewGroup parent) {
          // Declare Variables
          TextView ip;
          TextView port;
  
          inflater = (LayoutInflater) context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
          View itemView = inflater.inflate(R.layout.listview_item, parent, false);
          // Get the position
          resultp = data.get(position);
  
          // Locate the TextViews in listview_item.xml
          ip = (TextView) itemView.findViewById(R.id.ip);
          port = (TextView) itemView.findViewById(R.id.port);
  
          // Locate the ImageView in listview_item.xml
  
          // Capture position and set results to the TextViews
          ip.setText(resultp.get(AddFragment.ip));
          port.setText(resultp.get(AddFragment.port));
          // Capture position and set results to the ImageView
          // Passes flag images URL into ImageLoader.class
          // Capture ListView item click
          itemView.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View arg0) {
                  // Get the position
                  resultp = data.get(position);
                  Intent intent = new Intent(context, MainActivity.class);
                  // Pass all data rank
                  intent.putExtra("ip", resultp.get(AddFragment.ip));
                  // Pass all data country
                  intent.putExtra("port", resultp.get(AddFragment.port));
                  intent.putExtra("uname", resultp.get(AddFragment.uname));
                  intent.putExtra("password", resultp.get(AddFragment.password));
  
                  Log.e("uname: ", "&gt; " + resultp.get(AddFragment.uname));
                  Log.e("password: ", "&gt; " + resultp.get(AddFragment.password));
                  Log.e("ip: ", "&gt; " + resultp.get(AddFragment.ip));
                  Log.e("port: ", "&gt; " + resultp.get(AddFragment.port));
  
  
  
                  // Pass all data population
                  // Pass all data flag
                  // Start SingleItemView Class
                  context.startActivity(intent);
  
              }
          });
          return itemView;
      }
  </code></pre>
  
  <p>so How i can go to fragment instead of activity.
  I want to go in fragment with this put extra detailss. so, How i can go?</p>