server not responce
server not responce
my android code here
sign up button kaj kore na plz help me
//====================================
error here
===========================
Warning: Undefined array key "name" in E:\xampp\htdocs\app\user_sign_up\accaunt_create.php on line 3
Warning: Undefined array key "email" in E:\xampp\htdocs\app\user_sign_up\accaunt_create.php on line 4
Warning: Undefined array key "password" in E:\xampp\htdocs\app\user_sign_up\accaunt_create.php on line 5
Warning: Undefined array key "mobail" in E:\xampp\htdocs\app\user_sign_up\accaunt_create.php on line 6
Warning: Undefined array key "image" in E:\xampp\htdocs\app\user_sign_up\accaunt_create.php on line 7
Warning: Undefined array key "location" in E:\xampp\htdocs\app\user_sign_up\accaunt_create.php on line 8
Warning: Undefined array key "category" in E:\xampp\htdocs\app\user_sign_up\accaunt_create.php on line 9
Warning: file_put_contents(image/1760703700_9104.jpg): Failed to open stream: No such file or directory in E:\xampp\htdocs\app\user_sign_up\accaunt_create.php on line 19
===============================
php code here
===================================
=====================================
xml code here
====================================
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
android:padding="20dp"
tools:context=".Signup">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal">
<!--Profile Image with + icon overlay -->
<FrameLayout
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginBottom="20dp">
<ImageView
android:id="@+id/ProfileImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/default_image"
android:scaleType="centerCrop"
android:background="@drawable/circle_bg"
android:contentDescription="Signup Image" />
<!-- Small + icon on corner -->
<ImageButton
android:id="@+id/AddImage"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_gravity="bottom|end"
android:backgroundTint="@android:color/white"
android:src="@drawable/add_post"
android:background="@drawable/plus_bg"
android:padding="5dp"
android:contentDescription="Add Image"
android:elevation="3dp" />
</FrameLayout>
<!-- Full Name -->
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Full Name">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName" />
</com.google.android.material.textfield.TextInputLayout>
<!-- Email -->
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress" />
</com.google.android.material.textfield.TextInputLayout>
<!-- Mobile Number -->
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile Number">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/mobail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone" />
</com.google.android.material.textfield.TextInputLayout>
<!-- Location -->
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Location">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapWords" />
</com.google.android.material.textfield.TextInputLayout>
<!-- Password -->
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
app:endIconMode="password_toggle">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<!-- Account Type Dropdown -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select Account Type:"
android:textStyle="bold"
android:textColor="#000000"
android:layout_marginTop="15dp" />
<Spinner
android:id="@+id/spinnerUserType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/user_type_options"
android:layout_marginBottom="10dp" />
<!-- Signup Button -->
<Button
android:id="@+id/btnSignup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign Up"
android:layout_marginTop="20dp"
android:backgroundTint="#000000"
android:textColor="@android:color/white"
android:padding="10dp" />
<!-- Go to Login Text -->
<TextView
android:id="@+id/tvLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Already have an account? Login"
android:textColor="#000000"
android:layout_marginTop="10dp"/>
<!-- Login Button -->
<Button
android:id="@+id/btnLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:layout_marginTop="20dp"
android:backgroundTint="#000000"
android:textColor="@android:color/white"
android:padding="10dp" />
</LinearLayout>
</ScrollView>
===================================
java code here
package com.example.gramdeal;
import android.app.AlertDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.util.Base64;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Spinner;
import androidx.activity.EdgeToEdge;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.google.android.material.textfield.TextInputEditText;
import java.io.ByteArrayOutputStream;
import java.util.HashMap;
import java.util.Map;
public class Signup extends AppCompatActivity {
TextInputEditText edname,edemail,edpassword,edmobail,edlocation;
Button btnSignup,btnLogin;
ImageView Profileimage,Addimage;
Spinner spinnerUserType;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
edname=findViewById(R.id.name);
edemail=findViewById(R.id.email);
edpassword=findViewById(R.id.password);
edmobail=findViewById(R.id.mobail);
btnSignup=findViewById(R.id.btnSignup);
btnLogin=findViewById(R.id.btnLogin);
Profileimage=findViewById(R.id.ProfileImage);
edlocation=findViewById(R.id.location);
Addimage=findViewById(R.id.AddImage);
spinnerUserType=findViewById(R.id.spinnerUserType);
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(Signup.this,Login.class));
finish();
}
});
btnSignup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String name= edname.getText().toString();
String email= edemail.getText().toString();
String password= edpassword.getText().toString();
String mobail= edmobail.getText().toString();
String location=edlocation.getText().toString();
String category=spinnerUserType.getSelectedItem().toString();
BitmapDrawable bitmapDrawable= (BitmapDrawable) Profileimage.getDrawable();
Bitmap bitmap=bitmapDrawable.getBitmap();
ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG,60,byteArrayOutputStream);
byte[] imagebyte=byteArrayOutputStream.toByteArray();
String image= Base64.encodeToString(imagebyte,Base64.DEFAULT);
String url = "http://192.168.100.14/app/user_sign_up/accaunt_create.php";
StringRequest stringRequest=new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String responce) {
new AlertDialog.Builder(Signup.this)
.setTitle("server response")
.setMessage(responce)
.create().show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
new AlertDialog.Builder(Signup.this)
.setTitle("Error")
.setMessage(volleyError.toString())
.create().show();
}
}){
@Nullable
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map mymap=new HashMap<String,String>();
mymap.put("name",name);
mymap.put("email",email);
mymap.put("password",password);
mymap.put("mobail",mobail);
mymap.put("image",image);
mymap.put("location",location);
mymap.put("category",category);
mymap.put("password","");
return mymap;
}
};
//
RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext());
requestQueue.add(stringRequest);
}
});
}
}
Comments
Post a Comment