listview.setOnItemClickListener ( new AdapterView.OnItemClickListener () {
@Override
public void onItemClick(AdapterView <?> view3, View view, int view1, long view2) {
final TextView countid = (TextView) view.findViewById ( R.id.id );
final TextView count_counting = (TextView) view.findViewById ( R.id.text_view_countiing );
final TextView any_name = (TextView) view.findViewById ( R.id.textviewname );
final ImageView deletebutton = (ImageView) view.findViewById ( R.id.deletebutton );
animation = AnimationUtils.loadAnimation ( getApplicationContext (), R.anim.blinking );
any_name.setVisibility ( view.VISIBLE );
any_name.startAnimation ( animation );
final String realid = countid.getText ().toString ();
final String realcounting = count_counting.getText ().toString ();
final String realname = any_name.getText ().toString ();
Intent intent = new Intent ( getApplicationContext (), MainActivity.class );
intent.putExtra ( "Id", realid );
intent.putExtra ( "real_counting", realcounting );
intent.putExtra ( "real_name", realname );
startActivity ( intent );
}
} );
To make the other views stop being ticked when you click a different one, have your ListAdapter
store a reference to which one should be ticked, and call notifyDataSetInvalidated
on it inside the onItemClicked
function.
To make it persist when you leave the activity:
Make a class variable in your activity that remembers which item should be ticked, and then you can use onSaveInstanceState
to restore that when you return to the activity.
If you want the state to persist even when the user closes your app and returns, you can save the variable to a Preferences
object instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.