Reputation: 117
I am trying to pass a int
called Money to another class but it keeps telling me "Cannot make a static reference to the non-static method putExtra(String, int)
from the type Intent
"
int Money = 0;
GoToSettings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(getApplicationContext(), settings.class);
Intent.putExtra("Money",Money);
//^^^^^that's the variable i am trying to use
startActivity(intent);
}
});
"Money" constantly changes and I don't know how else to get it to go to my second class.
PS I am still trying to learn how to use this site so please bear with me if I didn't do something right.
Upvotes: 0
Views: 75
Reputation: 36304
Change Intent.putExtra("Money",Money);
to intent.putExtra("Money",Money);
Intent
is a class, intent
is an instance of Intent
, and putExtra()
is an instance level method so you have to call it using intent
Upvotes: 4