My main activity is
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new MyGame(this));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
where whole content is with in Mygame class,and I want whole app to restart on click of button which is in MyGame class, how can I do so, I came across this and tried it but nothing worked
OnClickListener retryClicklistener = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// Intent i = getContext().getPackageManager()
// .getLaunchIntentForPackage(getContext().getPackageName() );
//
// i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK );
// // startActivity( MyGameLongClick);
// Intent startActivity = new Intent();
// startActivity.setClass(this,OTHER_ACTIVITY.class);
// startActivity(startActivity);
}};