package textview.exam;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
public class FragmentMe extends Fragment {
Button loginbutton;
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// TODO Auto-generated method stub
View view=inflater.inflate(R.layout.me, container,false);
loginbutton=(Button)view.findViewById(R.id.login);
loginbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(getActivity(),LoginActivity.class);
startActivity(intent);
}
});
return view;
}
}这是我一个Fragement的代码,想要弹出另外一个Activity,可是每次都是停止运行,怎么破?
添加回答
举报
0/150
提交
取消