I having trouble with making a Textview change text when i push a button from another activity, the button is working from within the same activity as its own but it shuts down my app as soon as I tell it to change text from another activity, my code looks like this:
this is the button code from my main activity:
go = (Button)findViewById(R.id.go);
go.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
InventoryActivity.fire.setText("1 fire");
}
});
and this is the code from the activity with the TextView I wish to change:
public class InventoryActivity extends Activity
{
public static TextView fire;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_inventory);
fire = (TextView) findViewById(R.id.fire);
}
}
ok thanks again