package com.example.intentdemo;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Log;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void GotoURL(View view)
    {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com/"));
        startActivity(intent);
    }

    public void GotoGallery(View view)
    {
        Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("content://media/external/images/media/"));
        startActivity(intent);
    }

    public void GotoCamera(View view)
    {
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        startActivity(intent);
    }

    public void GotoContacts(View view)
    {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://contacts/people/"));
        startActivity(intent);
    }

    public void SendSMS(View view)
    {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("smsto:"));
        intent.putExtra("address", new String ("123456"));
        intent.putExtra("sms_body","Hello how are you");
        startActivity(intent);
    }

    public void MakeCall(View view)
    {
        Uri u = Uri.parse("tel:" + "12345");
        Intent i = new Intent(Intent.ACTION_DIAL, u);
        startActivity(i);
    }

}