package com.fanxin.huangfangyi.main.ulive.preference; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import com.fanxin.huangfangyi.R; public class SettingsActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); Fragment newFragment = SettingsFragment.newInstance(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.body, newFragment); transaction.commit(); } public static Intent newIntent(Context context) { Intent intent = new Intent(context, SettingsActivity.class); return intent; } public static void intentTo(Context context) { context.startActivity(newIntent(context)); } }