0
Hello, after trying all the tutorials and some more I decided I can’t even solve the problem, I want to create a button that redirects to a call to a certain number happens is that the button does nothing, no error, no warning,...
This is the Java:
public class APizzaria extends Fragment {
private Button button;
View inflatedView = null;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
this.inflatedView = inflater.inflate(R.layout.pizzaria_1, container,false);
super.onCreate(savedInstanceState);
button = (Button) inflatedView.findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
String number = "23454568678";
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" +number));
startActivity(intent);
}
});
View android = inflater.inflate(R.layout.pizzaria_1, container, false);
return android;
}
}
This is the layout:
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_below="@+id/TextView06"
android:text="@string/Telefone" />
And I added the permissions to Manifest, can you help me figure out why it’s not working? Thank you
Thank you very much, solved my problem.
– SaPires