以下是我想开始新活动的片段
public class Admin extends Fragment {
public Admin() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_admin, container, false);
}
}
答案 0 :(得分:1)
您必须在按钮的OnClick
功能中添加活动开始流程
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent myIntent = new Intent(FirstActivity.this, SecondActivity.class);
FirstActivity.this.startActivity(myIntent);
}
}
不要忘记在你的清单中添加你的第二个活动
<activity android:label="@string/second_activity" android:name="SecondActivity"/>
请参阅$match