-2
JAVA
public class Contactofragment extends Fragment {
Button btnMaps;
TextView txtMaps;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_contato, container, false);}
public void onViewCreated (Bundle savedInstanceState){
txtMaps= (TextView) txtMaps.findViewById(R.id.txtMaps);
txtMaps.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getContext(), MapsActivity.class);
startActivity(intent);
}
});
}
}`