Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid get Textview text on the same row of listview
    primarykey
    data
    text
    <p>I have this code inside my BaseAdapter Adapter:</p> <pre><code>public View getView(final int position, View convertView, ViewGroup parent) { View vi=convertView; if(convertView==null) vi = inflater.inflate(R.layout.facebook_friends_layout, null); TextView friendsName = (TextView)vi.findViewById(R.id.tvFacebookName); // Friends thumb friend_image=(ImageView)vi.findViewById(R.id.ivFacebookPicture); // thumb image song= new HashMap&lt;String, String&gt;(); song = data.get(position); friendsName.setText(song.get(MyFriends.KEY_FBNAME)); //Log.i("Facebook Pangalan", ""+MyFriends.KEY_FBNAME); FriendName = (String) friendsName.getText().toString(); FBID = song.get(MyFriends.KEY_FBID); String fbAvatarUrl = "http://graph.facebook.com/"+ FBID +"/picture"; //Log.i("FBID", FBID); BitmapManager.INSTANCE.loadBitmap(fbAvatarUrl, friend_image, 100,100); Button btn=(Button)vi.findViewById(R.id.btnAdd); if (FBID.equals("")) { btn.setVisibility(View.GONE); } else { btn.setVisibility(View.VISIBLE); } btn.setOnClickListener(new OnClickListener(){ public void onClick(View arg0) { LOCK_BASEDATA = MyFriends.LOCK_BASEDATA; if (LOCK_BASEDATA.equals("0")) { //FACEBOOK FRIENDS Log.i("", ""+FriendName); //AddfromFacebookFriends(); } else if (LOCK_BASEDATA.equals("1")) { //MY REQUEST //((MyFriends)context).SetMyRequest(); //Log.i("LangYa", "Langya"); } else if (LOCK_BASEDATA.equals("2")) { //FRIEND REQUEST //((MyFriends)context).SetFriendRequest(); //d2papasok AddFriendRequest(); } } }); return vi; } </code></pre> <p>I am logging my friend's name whenever I click on the button. Now my problem starts when I click the button; I am not getting my desired string. It is getting the string from another row of my listview.</p> <p><strong>EDIT</strong> Thanks, actually ive just aaded this code</p> <pre><code>public void onClick(View arg0) { LOCK_BASEDATA = MyFriends.LOCK_BASEDATA; if (LOCK_BASEDATA.equals("0")) { //Object x =btn.getTag(); //String sa = x.toString(); View parentView = (View) arg0.getParent(); String textviewtext = ((TextView) parentView.findViewById(R.id.hiddentv)).getText().toString(); //FACEBOOK FRIENDS AddfromFacebookFriends(textviewtext); } else if (LOCK_BASEDATA.equals("1")) { </code></pre> <p>I am just getting my parents View to get my desired textview and now it works. Thanks anyway </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload