Moving imageview in XML causes crash-Collection of common programming errors

I am making some changes to an XML layout side of my application. There is a ImageView I am trying to bring to the front yet when I do the app crashes and I can seem to tell why.

Working XML:

    








    





XML that crashes:

    






    

    








Im just trying to bring the @place_img to the front of the @wrapper.

java.lang.NullPointerException at com.peekatucorp.peekatu.DiscussArrayAdapter.getView(DiscussArrayAdapter.java:172)

DiscussArrayAdapter.java:

        public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    if (row == null) {
        LayoutInflater inflater = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        if(type==1 || type==3)
            row = inflater.inflate(R.layout.listitem_discuss, parent, false);
        else if(type==4 || type==5)
            row = inflater.inflate(R.layout.listitem_users, parent, false);
        else
            row = inflater.inflate(R.layout.listitem_messages, parent, false);
    }

//  

    final OneComment coment = getItem(position);

    userComment = (TextView) row.findViewById(R.id.comment);
    userImage = (ImageView) row.findViewById(R.id.place_img);
    userName = (TextView) row.findViewById(R.id.place_name);
    userOnlineImage = (ImageView) row.findViewById(R.id.pe_profile_pic);
    commentDate = (TextView) row.findViewById(R.id.place_distance);

    userComment.setText(coment.comment);

    ImageLoader imageLoader = ImageLoader.getInstance();
//  imageLoader = ImageLoader.getInstance();
//  imageLoader.init(ImageLoaderConfiguration.createDefault(convertView.getContext()));

    imageLoader.displayImage(coment.image, userImage);
    userImage.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // it was the 1st button


             final TabInfo tab = navact.getCurrentTabInfo();
                final ProfileFragment fragment = new ProfileFragment().setUser(coment.userid).setNAV(navact);
              //  fragment.setText(characters[position]);

                // second, you push the fragment. It becomes visible and the up button is
                // shown
                navact.pushFragment(tab, fragment);

             /*
             Intent i = new Intent(context, ProfileActivity.class);

             i.putExtra("userID", coment.userid);

             // Create the view using FirstGroup's LocalActivityManager
             View view = ChatTabGroup.group.getLocalActivityManager()
             .startActivity("show profile", i
             .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
             .getDecorView();

             // Again, replace the view
             ChatTabGroup.group.replaceView(view);*/

          }
        });
    if(coment.online.equalsIgnoreCase("1"))
    userOnlineImage.setImageResource(R.drawable.online);
    else
    userOnlineImage.setImageResource(R.drawable.offline);
    if(coment.gender.equalsIgnoreCase("M"))
        userName.setTextColor(Color.parseColor("#878ff4"));
    else if(coment.gender.equalsIgnoreCase("F"))
        userName.setTextColor(Color.parseColor("#f487d6"));
    else
        userName.setTextColor(Color.parseColor("#969696"));
    userName.setText(coment.username);

    commentDate.setText(coment.time);
    if(type==4){
        commentDate = (TextView) row.findViewById(R.id.textView1);
        SharedPreferences preferences = getContext().getSharedPreferences("MyPreferences", getContext().MODE_PRIVATE);
    double distance = distFrom(Double.parseDouble(getItem(position).time.split(",")[0]),Double.parseDouble(getItem(position).time.split(",")[1]),
            Double.parseDouble(preferences.getString("user_lat", "0.0")),Double.parseDouble(preferences.getString("user_lng", "0.0"))
            );
    commentDate.setText(""+String.format("%.2f", (distance*0.62))+"miles");
    }

    if(type==1 || type==3){
        wrapper = (LinearLayout) row.findViewById(R.id.wrapper);
        wrapper.setGravity(coment.left ? Gravity.LEFT : Gravity.RIGHT);
    }else{      



    }
//    

    return row;
}

Thank you.

  1. 
    
    
    
    
    
    
        
    
        
    
    
    
    
    
    
    
    
    
  2. change

    android:layout_height="wrap_content"
    

    to

    android:layout_height="fill_parent"
    

    of your main Relative Layout..