Menu

EditProfile using Volley Library

0 Comment

Main Objective of this blog post is to explain how to Volley library in an Android Studio .Volley is an HTTP library that makes networking for Android apps easier and most importantly, faster. Volley is available on GitHub.

Advantages of Using Volley:

  • Automatic scheduling of network requests.. It means that Volley will be taking care of all the network requests your app executes for fetching response or image from the web.
  • Transparent disk and memory response caching with standard HTTP cache coherence.
  • Volley provides powerful cancellation request API. It means that you can cancel a single request or you can set blocks or scopes of requests to cancel.
  • Strong ordering that makes it easy to correctly populate your UI with data fetched asynchronously from the network.
  • Debugging and tracing tools.

How to Get Started?

Open build.gradle and add volley support by adding under dependencies section.

compile files('libs/httpmime-4.3.6.jar')
compile files('libs/httpcore-4.3.3.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.mikhaellopez:circularimageview:2.0.2'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'

Add the below library in lib folder .Download the lib from below link

compile files(‘libs/httpmime-4.3.6.jar’)
compile files(‘libs/httpcore-4.3.3.jar’)

For Volley Library cnfiguration please follow the below link and configure it first by adding required files

http://androtech1tk.000webhostapp.com/2017/09/android-working-with-volley-library

Add Below strings in String.xml

<resources>
    <string name="app_name">ProfileEdit</string>
    <string name="update">Update</string>
    <string name="Enter_city">Enter City</string>
    <string name="alphabet">abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ </string>
    <string name="alphabet_digits">abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_</string>
    <string name="Enter_first_name">Enter First Name</string>
    <string name="Enter_last_name">Enter Last Name</string>
    <string name="Enter_Company_name">Enter Company Name</string>
    <string name="Enter_Email">Enter Email ID</string>
    <string name="failed_to_update">Failed to upload profile picture</string>
    <string name="please_wait">Please wait...</string>
    <string name="emaildigits">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@. </string>
    <string name="error_password_not_match">Password not matched.</string>
    <string name="error_confirm_password">Please enter confirm password.</string>
    <string name="error_first_name">Please enter first name.</string>
    <string name="error_post">Please first add post.</string>
    <string name="error_last_name">Please enter last name.</string>
    <string name="error_name">Please enter  name.</string>
    <string name="error_email_id">Please enter email id.</string>
    <string name="error_company">Please enter company.</string>
    <string name="error_mobile">Please enter mobile number.</string>
    <string name="error_password">Please enter password.</string>
    <string name="error_mobile_length">Mobile number must be 10 digit.</string>
    <string name="error_password_length">Password must be in between 6 to 12 charachters.</string>
    <string name="error_invalid_email_id">Please enter valid email id.</string>
    <string name="error_invalid_pan_no">Please enter valid Pan no.</string>
    <string name="error_position">Please enter position.</string>
    <string name="error_location">Please enter location.</string>
    <string name="internet_connection">Please check your internet connection.</string>
    <string name="choose_image">Choose Image</string>
    <string name="need_to_allow">You need to allow this permission to continue.</string>

    <string name="Enter_mobile_number">Enter Mobile Number</string>
</resources>

Create Constant file and Add email Pattern given Below.

public class Constant {
public static Pattern emailPattern = Pattern.compile(“^[a-zA-Z0-9_\\+-]+(\\.[a-zA-Z0-9_\\+-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.([a-zA-Z]{2,4})$”);

}

MainActivity.xml

package com.profileedit;

import android.Manifest;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Build;
import android.provider.MediaStore;
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.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

import com.mikhaellopez.circularimageview.CircularImageView;

import org.apache.http.NameValuePair;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;

public class MainActivity extends AppCompatActivity {
private EditText profileactivity_textview_role,profileactivity_textview_name,profileactivity_textview_email,profileactivity_textview_location,
profileactivity_textview_mobile,profileactivity_textview_company,profileactivity_textview_lastname;
ImageView activity_register_imageview_profile_icon_edit;

CircularImageView activity_company_sign_up_imageView_profile_pic;
private Button editprofileactivity_button_save;
private String name,lastname,location,mobile,email,company,profileimage;
private InternetConnection internetConnection = new InternetConnection();
ProgressDialog progressDialog;
private boolean isPicChooserCreated;
private String mSelectedImagePath="", jsonResult="";

private boolean isPermissionGranted, lastPermission,lastPermissionCamera,isPermissionGrantedCamera = false;
private Dialog dialogSelectImage;
private View imageSelectorView;
private int SELECT_PICTURE_FROM_GALLERY_BELOW_API_19 = 101;
private int SELECT_PICTURE_FROM_GALLERY_FROM_API_19 = 102;
private int SELECT_PICTURE_FROM_CAMERA = 103;
private Bitmap imageUplodedBitmap;
private final static int PERMISSION_REQUEST_CODE104 = 104;
private final static int PERMISSION_REQUEST_CODE105 = 105;
private View view;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById();

activity_register_imageview_profile_icon_edit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
view = v;
if (isDeviceBuildVersionMarshmallow()){
if(lastPermission == true && isPermissionGranted == true){
System.out.println("opendialog*********************");
openDialog1(v);
}else {
System.out.println("getSMSReadPermisson*********************");
getReadExternalStorage();
}
}else{
openDialog1(v);
}
}
});

editprofileactivity_button_save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

name=profileactivity_textview_name.getText().toString();
lastname=profileactivity_textview_lastname.getText().toString();
location=profileactivity_textview_location.getText().toString();
mobile=profileactivity_textview_mobile.getText().toString();
email=profileactivity_textview_email.getText().toString();
company=profileactivity_textview_company.getText().toString();

if (validateForm()) {
if (internetConnection.isNetworkAvailable(getApplicationContext())) {
new MainActivity.JsonReadTaskEmployerProfile().execute();
} else {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.internet_connection), Toast.LENGTH_SHORT).show();
}
}

}
});
}

private boolean isDeviceBuildVersionMarshmallow(){

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
return true;

return false;
}

public void openDialog1(View view) {
dialogSelectImage = new Dialog(MainActivity.this);
dialogSelectImage.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialogSelectImage.setContentView(R.layout.dialog_photo_select);
dialogSelectImage.show();

imageSelectorView = view;

ImageView footer_image_imageview_close_button = (ImageView) dialogSelectImage.findViewById(R.id.footer_image_imageview_close_button);
footer_image_imageview_close_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialogSelectImage.dismiss();
}
});

dialogSelectImage.findViewById( R.id.btncamera ).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

dialogSelectImage.dismiss();
System.out.println("lastPermissionCamera "+lastPermissionCamera );
System.out.println("isPermissionGrantedCamera "+isPermissionGrantedCamera );
if (isDeviceBuildVersionMarshmallow()){
if(lastPermissionCamera == true && isPermissionGrantedCamera == true){
selectFromcamera();
}else {
System.out.println("getSMSReadPermisson*********************");
getCameraStoragePermission();
}
}else{
selectFromcamera();
}

}
});
dialogSelectImage.findViewById( R.id.btnGallery ).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialogSelectImage.dismiss();
selectfromGallery();
}
});
isPicChooserCreated = true;
}

private void selectFromcamera()
{
isPicChooserCreated = false;

Intent intent = new Intent( MediaStore.ACTION_IMAGE_CAPTURE );
intent.putExtra(MediaStore.EXTRA_OUTPUT, MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString());
try
{
intent.putExtra( "return-data", true );
startActivityForResult( intent, SELECT_PICTURE_FROM_CAMERA );

} catch( ActivityNotFoundException e )
{
}
}

private void selectfromGallery()
{
// SDK < API19
if (Build.VERSION.SDK_INT < 19)
{
Intent photoPickerIntent = new Intent( Intent.ACTION_PICK );
photoPickerIntent.setType( "image/*" );
startActivityForResult( photoPickerIntent, SELECT_PICTURE_FROM_GALLERY_BELOW_API_19 );
}
else
{
Intent photoPickerIntent = new Intent( Intent.ACTION_OPEN_DOCUMENT );
photoPickerIntent.addCategory(Intent.CATEGORY_OPENABLE);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, SELECT_PICTURE_FROM_GALLERY_FROM_API_19);
}
}

private void getReadExternalStorage() {

int permissionCheckCamera = ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE);

if (permissionCheckCamera != PackageManager.PERMISSION_GRANTED){

if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)){

// explanation needed
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSION_REQUEST_CODE104);

}else{
// No explanation needed
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSION_REQUEST_CODE104);
}
}

if(permissionCheckCamera == 0){
isPermissionGranted = true;
lastPermission = true;

openDialog1(view);
}
}

private void getCameraStoragePermission() {

int permissionCheckCamera = ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA);

if (permissionCheckCamera != PackageManager.PERMISSION_GRANTED){

if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.CAMERA)){

// explanation needed
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.CAMERA},
PERMISSION_REQUEST_CODE105);

}else{
// No explanation needed
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.CAMERA},
PERMISSION_REQUEST_CODE105);
}
}

if(permissionCheckCamera == 0){
isPermissionGrantedCamera = true;
lastPermissionCamera = true;

selectFromcamera();
}
}

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {

switch (requestCode){

case PERMISSION_REQUEST_CODE104:

if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
isPermissionGranted = true;
lastPermission = true;

openDialog1(view);
}else {
lastPermission = false;
isPermissionGranted = false;
Toast.makeText(getApplicationContext(), getResources().getString(R.string.need_to_allow), Toast.LENGTH_SHORT).show();
}
break;

case PERMISSION_REQUEST_CODE105:

if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
isPermissionGrantedCamera = true;
lastPermissionCamera = true;

selectFromcamera();
}else {
lastPermissionCamera = false;
isPermissionGrantedCamera = false;
Toast.makeText(getApplicationContext(), getResources().getString(R.string.need_to_allow), Toast.LENGTH_SHORT).show();
}
break;
}
}

private boolean validateForm() {

Matcher mEmail = Constant.emailPattern.matcher(profileactivity_textview_email.getText().toString().trim());

if (profileactivity_textview_name.getText().toString().trim().equalsIgnoreCase("") ) {
profileactivity_textview_name.setError(getResources().getString(R.string.error_first_name));
return false;
}
if (profileactivity_textview_lastname.getText().toString().trim().equalsIgnoreCase("")) {
profileactivity_textview_lastname.setError(getResources().getString(R.string.error_last_name));
return false;
}

if (profileactivity_textview_location.getText().toString().trim().equalsIgnoreCase("")) {
profileactivity_textview_location.setError(getResources().getString(R.string.error_location));
return false;
}

if (profileactivity_textview_mobile.getText().toString().trim().length() < 10) {
profileactivity_textview_mobile.setError(getResources().getString(R.string.error_mobile_length));
return false;
}
if (profileactivity_textview_mobile.getText().toString().trim().equalsIgnoreCase("")) {
profileactivity_textview_mobile.setError(getResources().getString(R.string.error_mobile));
return false;
}

if (profileactivity_textview_email.getText().toString().trim().equalsIgnoreCase("")) {
return true;
}else{
if (!mEmail.matches()) {
profileactivity_textview_email.setError(getResources().getString(R.string.error_invalid_email_id));
return false;
}

}
return true;
}

private void findViewById(){

editprofileactivity_button_save= (Button) findViewById(R.id.editprofileactivity_button_save);
profileactivity_textview_name= (EditText) findViewById(R.id.profileactivity_textview_name);
profileactivity_textview_email= (EditText) findViewById(R.id.profileactivity_textview_email);
profileactivity_textview_location= (EditText) findViewById(R.id.profileactivity_textview_location);
profileactivity_textview_mobile= (EditText) findViewById(R.id.profileactivity_textview_mobile);
profileactivity_textview_lastname= (EditText) findViewById(R.id.profileactivity_textview_lastname);
progressDialog =new ProgressDialog(MainActivity.this);
activity_company_sign_up_imageView_profile_pic = (CircularImageView) findViewById(R.id.activity_company_sign_up_imageView_profile_pic);
activity_register_imageview_profile_icon_edit = (ImageView) findViewById(R.id.activity_register_imageview_profile_icon_edit);

}

private class JsonReadTaskEmployerProfile extends AsyncTask<String, Void, String> {

@Override
protected void onPreExecute()
{
progressDialog.setMessage(getString(R.string.please_wait));
progressDialog.setIndeterminate(false);
progressDialog.setCancelable(false);
progressDialog.show();
}

@Override
protected String doInBackground(String... params) {

final ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();

//insert your keys and value
// nameValuePairs.add(new BasicNameValuePair(getResources().getString(R.string.user_id_),userId ));
// nameValuePairs.add(new BasicNameValuePair(getResources().getString(R.string.firstName),name ));
// nameValuePairs.add(new BasicNameValuePair(getResources().getString(R.string.lastName),lastname ));
// nameValuePairs.add(new BasicNameValuePair(getResources().getString(R.string.email_),email ));
// nameValuePairs.add(new BasicNameValuePair(getResources().getString(R.string.altMobile),mobile ));
// nameValuePairs.add(new BasicNameValuePair(getResources().getString(R.string.city),location ));
//

if(mSelectedImagePath == null || mSelectedImagePath.equalsIgnoreCase("")){

// nameValuePairs.add(new BasicNameValuePair(Constant.profile_image,profileimage));
}else {
System.out.println("mSelectedImagePath************"+mSelectedImagePath);
// nameValuePairs.add(new BasicNameValuePair(Constant.profile_image, mSelectedImagePath));
}

Log.d("updateProfile", nameValuePairs.toString());

// jsonResult = makePostAddImage(getResources().getString(R.string.url_main) +getResources().getString(R.string.editProfileDetails) , nameValuePairs);

System.out.println("updateProfile " + jsonResult);

return null;
}

@Override
protected void onPostExecute(String result) {

parseJSONObjectPostQuestionImage();

}
}// end async task

public void parseJSONObjectPostQuestionImage() {

if (progressDialog.isShowing())
progressDialog.dismiss();

try {
if (jsonResult == null || jsonResult.equalsIgnoreCase("null") || jsonResult.equalsIgnoreCase("")) {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.failed_to_update), Toast.LENGTH_SHORT).show();
} else {

JSONObject object = new JSONObject(jsonResult);
if (object.getString("status").equalsIgnoreCase("200"))
{
progressDialog.dismiss();
Toast.makeText(getApplicationContext(), object.getString("message"), Toast.LENGTH_SHORT).show();

finish();
} else
{
progressDialog.dismiss();
Toast.makeText(getApplicationContext(), object.getString("message"), Toast.LENGTH_SHORT).show();

}

}
} catch (JSONException e)
{
Log.d("updateProfile",e.toString());
if (progressDialog.isShowing())
progressDialog.dismiss();
}
}

public String makePostAddImage(String url, List<NameValuePair> urlParams) {

String response=null;

try
{
@SuppressWarnings( "deprecation" )
org.apache.http.entity.mime.MultipartEntity entity = new org.apache.http.entity.mime.MultipartEntity( HttpMultipartMode.BROWSER_COMPATIBLE );

int i=0;
for( int index = 0; index < urlParams.size(); index++ )
{

if( urlParams.get( index ).getName().equalsIgnoreCase("profile_image") )
{
if(urlParams.get( index ).getValue() == null || urlParams.get( index ).getValue().equalsIgnoreCase("")){

}else {
entity.addPart(urlParams.get( index ).getName(),
new FileBody(new File(urlParams.get(index).getValue())));
}
i++;
}
else
{
// Normal string data
entity.addPart( urlParams.get( index ).getName(), new StringBody( urlParams.get( index ).getValue() ) );
}
}

System.out.println("updateProfile: "+entity.toString());
HttpURLConnection httpURLConnection = null;

URL postCommentURL = new URL( url );

httpURLConnection = (HttpURLConnection) postCommentURL.openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setUseCaches(false);
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
//httpURLConnection.setConnectTimeout(60000);
httpURLConnection.addRequestProperty(entity.getContentType().getName(), entity.getContentType().getValue());

// Make Post Request
OutputStream os = httpURLConnection.getOutputStream();
entity.writeTo(httpURLConnection.getOutputStream());
os.close();
httpURLConnection.connect();

int response_code = httpURLConnection.getResponseCode();

if (HttpURLConnection.HTTP_OK == response_code) {

BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
String line;
StringBuilder builder = new StringBuilder();

while ((line = bufferedReader.readLine()) != null) {

builder = builder.append(line);
}

bufferedReader.close();
response = builder.toString();

}

} catch( Exception e )
{
System.out.println("updateProfile Exception: " + e);
}

return response;
}

}

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_sign_up"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
   >

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true"
        >


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">



            <RelativeLayout
                android:layout_marginBottom="10dp"
                android:gravity="center_horizontal"
                android:layout_width="match_parent"
                android:id="@+id/profilefragment_relativeview"
                android:layout_marginTop="10dp"
                android:layout_height="wrap_content">

                <com.mikhaellopez.circularimageview.CircularImageView
                    android:id="@+id/activity_company_sign_up_imageView_profile_pic"
                    android:src="@drawable/network_profile_pic"
                    android:layout_width="110dp"
                    android:layout_height="110dp"
                    android:scaleType="fitXY"/>

                <ImageView
                    android:id="@+id/activity_register_imageview_profile_icon_edit"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/camera_icon"
                    android:layout_alignRight="@id/activity_company_sign_up_imageView_profile_pic"
                    android:layout_alignParentBottom="true"
                    android:layout_marginBottom="15dp"
                    android:layout_marginRight="12dp"
                    />


            </RelativeLayout>
            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/line"
                android:inputType="text"
                android:padding="10dp"
                android:layout_marginTop="10dp"
                android:id="@+id/profileactivity_textview_name"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:singleLine="true"
                android:digits="@string/alphabet"
                android:hint="@string/Enter_first_name"
                android:textColorHint="@color/robotolightblack"/>
            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="10dp"
                android:inputType="textPersonName"
                android:background="@drawable/line"
                android:layout_marginTop="10dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:singleLine="true"
                android:id="@+id/profileactivity_textview_lastname"
                android:digits="@string/alphabet"
                android:textColorHint="@color/robotolightblack"
                android:hint="@string/Enter_last_name"/>

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="10dp"
                android:singleLine="true"
                android:id="@+id/profileactivity_textview_email"
                android:digits="@string/emaildigits"
                android:textColorHint="@color/robotolightblack"
                android:background="@drawable/line"
                android:layout_marginTop="10dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:hint="@string/Enter_Email"/>

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="10dp"
                android:inputType="number"
                android:maxLength="10"
                android:singleLine="true"
                android:editable="false"
                android:enabled="false"
                android:layout_marginTop="10dp"
                android:layout_marginLeft="10dp"
                android:id="@+id/profileactivity_textview_mobile"
                android:layout_marginRight="10dp"
                android:textColorHint="@color/robotolightblack"
                android:background="@drawable/line"
                android:hint="@string/Enter_mobile_number"/>
            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="10dp"
                android:inputType="text"
                android:layout_marginTop="10dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:singleLine="true"
                android:id="@+id/profileactivity_textview_location"
                android:digits="@string/alphabet"
                android:textColorHint="@color/robotolightblack"
                android:background="@drawable/line"
                android:hint="@string/Enter_city"/>



            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_click"
                android:textColor="@color/white"
                android:text="@string/update"
                android:id="@+id/editprofileactivity_button_save"
                android:paddingBottom="5dp"
                android:gravity="center"
                android:textSize="14dp"
                android:textAllCaps="false"
                android:layout_marginTop="30dp"
                android:layout_gravity="center"/>

        </LinearLayout>
    </ScrollView>

</RelativeLayout>

dialog_photo_select.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:layout_margin="10dp"
    android:background="@color/white">

    <RelativeLayout
        android:layout_marginTop="5dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:padding="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/choose_image"
            android:textSize="20dp"
            android:textColor="@color/blue"
            android:layout_centerVertical="true"/>

        <ImageView
            android:id="@+id/footer_image_imageview_close_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/cancel_icon"
            android:padding="5dp"
            android:layout_alignParentRight="true"/>
    </RelativeLayout>

    <LinearLayout
        android:layout_marginTop="10dp"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <Button
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:text="Camera"
            android:textSize="15sp"
            android:textColor="@color/white"
            android:id="@+id/btncamera"
            android:gravity="center"
            android:background="@drawable/button_click"
            android:layout_marginRight="10dp"
            android:textAllCaps="false"/>
        <Button
            android:textColor="@color/white"
            android:background="@drawable/button_click"
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:text="Gallery"
            android:gravity="center"
            android:layout_marginLeft="10dp"
            android:textSize="15sp"
            android:id="@+id/btnGallery"
            android:textAllCaps="false"/>
    </LinearLayout>

</LinearLayout>

Happy Coding!!!!
Please follow and like us:
0
0
Tags: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

000webhost logo