Sunday, July 18, 2021

Streakify - Privacy Policy

Leave a Comment

 Privacy Policy

Amit Sharma built the Streakify app as a Free app. This SERVICE is provided by Amit Sharma at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Streakify unless otherwise defined in this Privacy Policy.

Information Collection and Use

For a better experience, while using our Service, I may require you to provide us with certain personally identifiable information, including but not limited to number,email,photo. The information that I request will be retained on your device and is not collected by me in any way.

The app does use third party services that may collect information used to identify you.

Link to privacy policy of third party service providers used by the app

Log Data

I want to inform you that whenever you use my Service, in a case of an error in the app I collect data and information (through third party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing my Service, the time and date of your use of the Service, and other statistics.

Cookies

Cookies are files with a small amount of data that are commonly used as anonymous unique identifiers. These are sent to your browser from the websites that you visit and are stored on your device's internal memory.

This Service does not use these “cookies” explicitly. However, the app may use third party code and libraries that use “cookies” to collect information and improve their services. You have the option to either accept or refuse these cookies and know when a cookie is being sent to your device. If you choose to refuse our cookies, you may not be able to use some portions of this Service.

Service Providers

I may employ third-party companies and individuals due to the following reasons:

  • To facilitate our Service;
  • To provide the Service on our behalf;
  • To perform Service-related services; or
  • To assist us in analyzing how our Service is used.

I want to inform users of this Service that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

I value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee its absolute security.

Links to Other Sites

This Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by me. Therefore, I strongly advise you to review the Privacy Policy of these websites. I have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.

Children’s Privacy

These Services do not address anyone under the age of 13. I do not knowingly collect personally identifiable information from children under 13 years of age. In the case I discover that a child under 13 has provided me with personal information, I immediately delete this from our servers. If you are a parent or guardian and you are aware that your child has provided us with personal information, please contact me so that I will be able to do necessary actions.

Changes to This Privacy Policy

I may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. I will notify you of any changes by posting the new Privacy Policy on this page.

This policy is effective as of 2021-07-18

Contact Us

If you have any questions or suggestions about my Privacy Policy, do not hesitate to contact me at amitsharmamail101@gmail.com.

This privacy policy page was created at privacypolicytemplate.net and modified/generated by App Privacy Policy Generator

Read More

Tuesday, March 24, 2020

[ANDROID] ObjectSerializer.java

Leave a Comment
package com.example.cw.sharedpreferences;

import android.util.Log;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;


public class ObjectSerializer {


    public static String serialize(Serializable obj) throws IOException {
        if (obj == null) return "";
        try {
            ByteArrayOutputStream serialObj = new ByteArrayOutputStream();
            ObjectOutputStream objStream = new ObjectOutputStream(serialObj);
            objStream.writeObject(obj);
            objStream.close();
            return encodeBytes(serialObj.toByteArray());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static Object deserialize(String str) throws IOException {
        if (str == null || str.length() == 0) return null;
        try {
            ByteArrayInputStream serialObj = new ByteArrayInputStream(decodeBytes(str));
            ObjectInputStream objStream = new ObjectInputStream(serialObj);
            return objStream.readObject();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static String encodeBytes(byte[] bytes) {
        StringBuffer strBuf = new StringBuffer();

        for (int i = 0; i < bytes.length; i++) {
            strBuf.append((char) (((bytes[i] >> 4) & 0xF) + ((int) 'a')));
            strBuf.append((char) (((bytes[i]) & 0xF) + ((int) 'a')));
        }

        return strBuf.toString();
    }

    public static byte[] decodeBytes(String str) {
        byte[] bytes = new byte[str.length() / 2];
        for (int i = 0; i < str.length(); i+=2) {
            char c = str.charAt(i);
            bytes[i/2] = (byte) ((c - 'a') << 4);
            c = str.charAt(i+1);
            bytes[i/2] += (c - 'a');
        }
        return bytes;
    }

}
Read More

[ANDROID] Hiker's Watch App

Leave a Comment
package com.example.cw.hikerswatch;

import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import java.util.List;
import java.util.Locale;

public class MainActivity extends AppCompatActivity {
    LocationManager locationManager;
    LocationListener locationListener;
    TextView latitudeTextView;
    TextView longitudeTextView;
    TextView accuracyTextView;
    TextView addressTextView;
    @Override    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if(grantResults.length>0 && grantResults[0]==PackageManager.PERMISSION_GRANTED){
           startListening();
        }
    }

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

        latitudeTextView = (TextView)findViewById(R.id.latitudeTextView);
        longitudeTextView = (TextView)findViewById(R.id.longitudeTextView);
        accuracyTextView = (TextView)findViewById(R.id.accuracyTextView);
        addressTextView = (TextView)findViewById(R.id.addressTextView);

        locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
        locationListener = new LocationListener() {
            @Override            public void onLocationChanged(Location location) {
                updateLocation(location);
            }

            @Override            public void onStatusChanged(String provider, int status, Bundle extras) {

            }

            @Override            public void onProviderEnabled(String provider) {

            }

            @Override            public void onProviderDisabled(String provider) {

            }
        };


        if(ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){
            ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS_FINE_LOCATION},1);
        }else{
            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,locationListener);
            Location lastKnownLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER );
            if(lastKnownLocation!=null){
                updateLocation(lastKnownLocation);
            }
        }
    }

    public void startListening(){
        if(ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){
            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,locationListener);
        }
    }

    public void updateLocation(Location location)
    {
        latitudeTextView.setText("Latitude : "+location.getLatitude());
        longitudeTextView.setText("Longitude : "+location.getLongitude());
        accuracyTextView.setText("Accuracy : "+location.getAccuracy());

        String address = "Could not find address";

        Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
        try{
            List<Address> listAddresses = geocoder.getFromLocation(location.getLatitude(),location.getLongitude(),1);
            if(listAddresses!=null && listAddresses.size()>0){
                String result = "";
                Log.i("address : ",listAddresses.get(0).toString());

                if(listAddresses.get(0).getFeatureName()!=null)
                {
                    result += listAddresses.get(0).getFeatureName();
                    result += "\r\n";
                }
                if(listAddresses.get(0).getAdminArea()!=null)
                {
                    result += listAddresses.get(0).getAdminArea();
                    result += "\r\n";
                }
                if(listAddresses.get(0).getPostalCode()!=null)
                {
                    result += listAddresses.get(0).getPostalCode();
                    result += "\r\n";
                }
                if(listAddresses.get(0).getCountryName()!=null)
                {
                    result += listAddresses.get(0).getCountryName();
                    result += "\r\n";
                }
                address = result;

            }
            addressTextView.setText(address);
        }catch (Exception e){
            e.printStackTrace();
            addressTextView.setText(address);
        }
    }
}
Read More

Sunday, March 22, 2020

[ANDROID] Weather App

Leave a Comment
package com.example.cw.weatherapp;

import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class MainActivity extends AppCompatActivity {

    String mn;
    TextView mainResultTextView;
    TextView cityNameTextView;
    TextView tempTextView;
    TextView pressureTextView;
    String cityName;
    String pressure;
    String temperature;
    EditText editText;

    public class DataDownload extends AsyncTask<String,Void,String>
    {

        @Override        protected String doInBackground(String... urls) {
            URL url;
            HttpURLConnection connection=null;
            String result="";
            try{
                url = new URL(urls[0]);
                connection = (HttpURLConnection) url.openConnection();
                InputStream in = connection.getInputStream();
                InputStreamReader reader = new InputStreamReader(in);

                int data = reader.read();
                while(data!=-1)
                {
                    char ch = (char)data;
                    result += ch;
                    data = reader.read();
                }

                return result;
            }catch (Exception e){
                e.printStackTrace();
                Toast.makeText(MainActivity.this, "Could not get weather", Toast.LENGTH_SHORT).show();
                return null;
            }
        }

        @Override        protected void onPostExecute(String s) {
            super.onPostExecute(s);

            try {
                JSONObject jsonObject = new JSONObject(s);
                String weather = jsonObject.getString("weather");
                JSONArray jsonArray = new JSONArray(weather);
                JSONObject partObject = jsonArray.getJSONObject(0);
                String main = partObject.getString("main");
                String desc = partObject.getString("description");
                mn = main + " : " + desc;

                cityName = jsonObject.getString("name");

                String str = jsonObject.getString("main");
                partObject = new JSONObject(str);
                pressure = "Pressure : "+partObject.getString("pressure");

                temperature = "Temp:"+partObject.getString("temp")+";"+"Temp_MAX:"+partObject.getString("temp_max")+";"+"Temp_MIN:"+partObject.getString("temp_min");

            }catch (Exception e){
                e.printStackTrace();
                Toast.makeText(MainActivity.this, "Could not get weather", Toast.LENGTH_SHORT).show();
            }
        }
    }

    public void buttonClicked(View view)
    {
        DataDownload data = new DataDownload();

        String place = editText.getText().toString();

        if(!place.equals("")) {
            try {
                data.execute("https://openweathermap.org/data/2.5/weather?q=" + place + "&appid=b6907d289e10d714a6e88b30761fae22").get();
                mainResultTextView.setText(mn);
                cityNameTextView.setText(cityName);
                pressureTextView.setText(pressure);
                tempTextView.setText(temperature);

                mainResultTextView.setVisibility(View.VISIBLE);
                cityNameTextView.setVisibility(View.VISIBLE);
                pressureTextView.setVisibility(View.VISIBLE);
                tempTextView.setVisibility(View.VISIBLE);

            } catch (Exception e) {
                e.printStackTrace();
                Toast.makeText(MainActivity.this, "Could not get weather", Toast.LENGTH_SHORT).show();
            }
        }else{
            Toast.makeText(this, "Input Place Name", Toast.LENGTH_SHORT).show();
        }

    }

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

        mainResultTextView = (TextView)findViewById(R.id.mainResultTextView);
        tempTextView = (TextView)findViewById(R.id.tempTextView);
        pressureTextView = (TextView) findViewById(R.id.pressureTextView);
        cityNameTextView = (TextView) findViewById(R.id.cityNameTextView);

        editText = (EditText)findViewById(R.id.editText);
    }
}


//////////////////////////////////////////
//DESIGN
////////////////////////////////////////

<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".MainActivity">

    <ImageView        android:id="@+id/imageView"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:scaleType="centerCrop"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="1.0"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toTopOf="parent"        app:layout_constraintVertical_bias="1.0"        app:srcCompat="@drawable/weather" />

    <TextView        android:id="@+id/textView"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginEnd="8dp"        android:layout_marginRight="8dp"        android:layout_marginTop="10dp"        android:text="Enter City Name"        android:textColor="?android:attr/colorLongPressedHighlight"        android:textSize="40sp"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="0.5"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toTopOf="parent" />

    <EditText        android:id="@+id/editText"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginEnd="8dp"        android:layout_marginRight="8dp"        android:ems="10"        android:hint="eg. London"        android:inputType="textPersonName"        android:textColor="?android:attr/colorLongPressedHighlight"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="0.527"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/textView" />

    <Button        android:id="@+id/button"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginEnd="8dp"        android:layout_marginLeft="8dp"        android:layout_marginRight="8dp"        android:layout_marginStart="8dp"        android:layout_marginTop="8dp"        android:onClick="buttonClicked"        android:text="WHAT'S THE WEATHER?"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/editText" />

    <TextView        android:id="@+id/cityNameTextView"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginEnd="8dp"        android:layout_marginLeft="8dp"        android:layout_marginRight="8dp"        android:layout_marginStart="8dp"        android:layout_marginTop="2dp"        android:text="TextView"        android:textColor="@android:color/background_light"        android:textSize="25sp"        android:textStyle="bold"        android:visibility="invisible"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="0.5"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/button" />

    <TextView        android:id="@+id/mainResultTextView"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginEnd="8dp"        android:layout_marginLeft="8dp"        android:layout_marginRight="8dp"        android:layout_marginStart="8dp"        android:layout_marginTop="16dp"        android:text="TextView"        android:textColor="@android:color/background_light"        android:textSize="20sp"        android:textStyle="bold"        android:visibility="invisible"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/cityNameTextView" />

    <TextView        android:id="@+id/tempTextView"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginEnd="8dp"        android:layout_marginLeft="8dp"        android:layout_marginRight="8dp"        android:layout_marginStart="8dp"        android:layout_marginTop="18dp"        android:text="TextView"        android:textColor="@android:color/background_light"        android:textSize="20sp"        android:textStyle="bold"        android:visibility="invisible"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="0.5"        app:layout_constraintStart_toStartOf="@+id/imageView"        app:layout_constraintTop_toBottomOf="@+id/mainResultTextView" />

    <TextView        android:id="@+id/pressureTextView"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginEnd="8dp"        android:layout_marginLeft="8dp"        android:layout_marginRight="8dp"        android:layout_marginStart="8dp"        android:layout_marginTop="24dp"        android:text="TextView"        android:textColor="@android:color/background_light"        android:textSize="30sp"        android:textStyle="bold"        android:visibility="invisible"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="0.502"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/tempTextView" />

</android.support.constraint.ConstraintLayout>
Read More

[ANDROID] Guess the Celeb App

Leave a Comment
package com.example.cw.guesstheceleb;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MainActivity extends AppCompatActivity {

    Button option1;
    Button option2;
    Button option3;
    Button option4;
    ImageView imageView;
    ArrayList <String> celebURLs;
    ArrayList <String> celebNames;
    Random rand;
    int totalCelebs,chosenCelebIndex,chosenOptionIndex;
    String[] options = new String[4];

    public class InfoDownloader extends AsyncTask<String,Void,String>
    {

        @Override        protected String doInBackground(String... urls) {
            URL url;
            HttpURLConnection connection=null;
            String result="";
            try            {
                url = new URL(urls[0]);
                connection = (HttpURLConnection) url.openConnection();
                InputStream in = connection.getInputStream();
                InputStreamReader reader = new InputStreamReader(in);

                int data = reader.read();
                while (data!=-1)
                {
                    char ch = (char)data;
                    result+=ch;
                    data = reader.read();
                }
                return result;
            }
            catch (Exception e)
            {
                e.printStackTrace();
                return null;
            }
        }
    }

    public class ImageDownloader extends AsyncTask<String,Void,Bitmap>
    {

        @Override        protected Bitmap doInBackground(String... urls) {

            URL url;
            HttpURLConnection connection;
            try            {
                url = new URL(urls[0]);
                connection = (HttpURLConnection)url.openConnection();
                connection.connect();
                InputStream in = connection.getInputStream();

                Bitmap image = BitmapFactory.decodeStream(in);

                return image;
            }catch(Exception e)
            {
                e.printStackTrace();
                Log.i("Inside task class","Image downloading failed");
                return null;
            }

        }
    }

    public void optionClicked(View view)
    {
        Button buttonClicked = (Button)view;
        int userChoice = Integer.parseInt(buttonClicked.getTag().toString());
        if(userChoice==chosenOptionIndex){
            Toast.makeText(this, "Correct!", Toast.LENGTH_SHORT).show();
        }
        else{
            Toast.makeText(this, "Incorrect! Correct answer is "+celebNames.get(chosenCelebIndex), Toast.LENGTH_SHORT).show();
        }
        setupQuiz();
    }

    public void setupQuiz() {
        ImageDownloader imgTask = new ImageDownloader();
        chosenCelebIndex = rand.nextInt(totalCelebs);
        chosenOptionIndex = rand.nextInt(4);
        try {
            for (int i = 0; i < 4; i++) {
                if (i == chosenOptionIndex) {
                    options[i] = celebNames.get(chosenCelebIndex);
                } else {
                    int wrongCelebNameIndex = rand.nextInt(totalCelebs);
                    while (wrongCelebNameIndex == chosenCelebIndex) wrongCelebNameIndex = rand.nextInt(totalCelebs);
                    options[i] = celebNames.get(wrongCelebNameIndex);
                }
            }
            option1.setText(options[0]);
            option2.setText(options[1]);
            option3.setText(options[2]);
            option4.setText(options[3]);

            Bitmap image = imgTask.execute(celebURLs.get(chosenCelebIndex)).get();
            Log.i("URL chosen",celebURLs.get(chosenCelebIndex));
            imageView.setImageBitmap(image);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

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

        option1 = (Button) findViewById(R.id.option1);
        option2 = (Button) findViewById(R.id.option2);
        option3 = (Button) findViewById(R.id.option3);
        option4 = (Button) findViewById(R.id.option4);

        imageView = (ImageView)findViewById(R.id.imageView);

        celebURLs = new ArrayList<>();
        celebNames = new ArrayList<>();

        rand = new Random();

        InfoDownloader task = new InfoDownloader();
        try {
            String result = task.execute("http://www.posh24.se/kandisar").get();

            String[] strs = result.split("<a href=\"/kandisar/a_till_o\" class=\"link\">Kändisar A-Ö</a>");
            String html = strs[1];

            Pattern p = Pattern.compile("<img src=\"(.*?)\"");
            Matcher m = p.matcher(html);

            while(m.find())
            {
                celebURLs.add(m.group(1));
            }

            p = Pattern.compile("alt=\"(.*?)\"");
            m = p.matcher(html);

            while(m.find())
            {
                celebNames.add(m.group(1));
            }

            totalCelebs = celebNames.size();

            Log.i("No of URLs",celebURLs.size()+""); //28            Log.i("No of Namess",celebNames.size()+""); //23
            setupQuiz();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}


/////////////////////////////////////////////////////////////////////////////
// Design
//////////////////////////////////////////////////////////////////////////////


<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".MainActivity">

    <ImageView        android:id="@+id/imageView"        android:layout_width="0dp"        android:layout_height="0dp"        android:layout_marginBottom="5dp"        android:layout_marginEnd="5dp"        android:layout_marginLeft="5dp"        android:layout_marginRight="5dp"        android:layout_marginStart="5dp"        android:layout_marginTop="5dp"        app:layout_constraintBottom_toTopOf="@+id/option1"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toTopOf="parent" />

    <Button        android:id="@+id/option1"        android:layout_width="368dp"        android:layout_height="wrap_content"        android:layout_marginBottom="1dp"        android:layout_marginEnd="8dp"        android:layout_marginLeft="8dp"        android:layout_marginRight="8dp"        android:layout_marginStart="8dp"        android:layout_marginTop="5dp"        android:onClick="optionClicked"        android:tag="0"        android:text="option1"        app:layout_constraintBottom_toTopOf="@+id/option2"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="0.0"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/imageView" />

    <Button        android:id="@+id/option2"        android:layout_width="368dp"        android:layout_height="wrap_content"        android:layout_marginBottom="1dp"        android:layout_marginEnd="8dp"        android:layout_marginLeft="8dp"        android:layout_marginRight="8dp"        android:layout_marginStart="8dp"        android:layout_marginTop="1dp"        android:onClick="optionClicked"        android:tag="1"        android:text="option2"        app:layout_constraintBottom_toTopOf="@+id/option3"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="0.0"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/option1" />

    <Button        android:id="@+id/option3"        android:layout_width="368dp"        android:layout_height="wrap_content"        android:layout_marginBottom="1dp"        android:layout_marginEnd="8dp"        android:layout_marginLeft="8dp"        android:layout_marginRight="8dp"        android:layout_marginStart="8dp"        android:layout_marginTop="1dp"        android:onClick="optionClicked"        android:tag="2"        android:text="option3"        app:layout_constraintBottom_toTopOf="@+id/option4"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="0.0"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/option2" />

    <Button        android:id="@+id/option4"        android:layout_width="368dp"        android:layout_height="wrap_content"        android:layout_marginBottom="16dp"        android:layout_marginEnd="8dp"        android:layout_marginLeft="8dp"        android:layout_marginRight="8dp"        android:layout_marginStart="8dp"        android:layout_marginTop="1dp"        android:onClick="optionClicked"        android:tag="3"        android:text="option4"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="0.5"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/option3" />

</android.support.constraint.ConstraintLayout>
Read More