I am using SlidingMenu library provided by jfeinstein10, and I would like to inflate a certain number of linearlayouts with textviews in them ( each linking to one Activity inside my app). I would like to make the textview that starts current Activity be non-clickable, but for this, I have to create a condition where I can compare current Activity's context to the context of the Activity that created this SlidingMenu. I know it sounds quite complicated what I'm trying to explain, but I also feel like the solution could be quite simple. I`ll show a picture so you can understand better:
So I would like, ie Cart textView to be disabled for tapping, if current Activity (the one on the right) is Cart Activity.
I have to do something like this:
tv_menu_cart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// check if Cart Activity's context is the current one and -> do nothing, otherwise continue with starting the activity.
startActivity(new Intent(getBaseContext(), Cart.class));
sm.toggle(false);
}
});