@Override public void onClick(View v) { switch (v.getId()) { case R.id.logged_btn_logout: MyUser.setIsLoggedIn(false); ChangeFragment(R.id.content_frame, new UserFragment(), false); break; case R.id.logged_btn_consume_history: String query = "username="******"/consumehistory?" + query; new SubmitAsyncTask().execute(url); break; } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_user_logged, container, false); txtUsername = (TextView) view.findViewById(R.id.logged_txt_username); txtUsername.setText(MyUser.getUsername()); btnLogout = (Button) view.findViewById(R.id.logged_btn_logout); btnHistory = (Button) view.findViewById(R.id.logged_btn_consume_history); btnLogout.setOnClickListener(this); btnHistory.setOnClickListener(this); return view; }