Krishna app worlds
krishan app world is the best android application and source code provide company
Rto driving license computer exam questions and answers android application
SQLite database with login and register demo
Sqlite database use to store the application data. sqlite is a lightweight database
Screenshot
Resource file
value
color.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <color name="colorPrimary">#3b5998</color> <color name="colorPrimaryDark">#3b5998</color> <color name="colorAccent">#3b5998</color> <color name="lavender">#3b5998</color> <color name="white">#FFFFFF</color> <color name="login_button">#D81B60</color> </resources>
strings.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">Login</string> <string name="email">Email</string> <string name="login">Login</string> <string name="name">Name</string> <string name="password">Password</string> <string name="phone">Phone number</string> <string name="register">Register</string> <string name="user_login">User Login</string> <string name="please_enter_name">please enter name</string> <string name="please_enter_email">please enter email</string> <string name="please_enter_password">please enter password</string> <string name="please_enter_phone">please enter phone number</string> <string name="loading">Loading....</string> <string name="ok">OK</string> <string name="register_success">Register success fully</string> <string name="email_id_use">Email id already use</string> <string name="fail">Login Fail</string> <string name="update">Update</string> <string name="logout">Logout</string> <string name="update_user">Update User</string> </resources>
styles.xml
<resources> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> </resources>
drawable file
edittext_bg.xml
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <stroke android:width="1dp" android:color="@color/white" /> <corners android:radius="20dp" /> </shape> </item> </selector>
login_button_bg.xml
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="@color/white" /> <corners android:radius="40dp" /> </shape> </item> </selector>
layout file
activity_login.xml
<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/lavender" android:fillViewport="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/lavender" android:gravity="center" android:orientation="vertical" tools:context=".Activity.Login"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/login" android:textColor="@color/white" android:textSize="32sp" android:textStyle="bold" /> <EditText android:id="@+id/editText_email_login" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginStart="20dp" android:layout_marginTop="40dp" android:layout_marginEnd="20dp" android:background="@drawable/edittext_bg" android:hint="@string/email" android:inputType="textEmailAddress" android:paddingStart="10dp" android:paddingEnd="10dp" android:singleLine="true" android:textColor="@color/white" android:textColorHint="@color/white" android:textCursorDrawable="@null" /> <EditText android:id="@+id/editText_password_login" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:layout_marginEnd="20dp" android:background="@drawable/edittext_bg" android:hint="@string/password" android:inputType="textPassword" android:paddingStart="10dp" android:paddingEnd="10dp" android:singleLine="true" android:textColor="@color/white" android:textColorHint="@color/white" android:textCursorDrawable="@null" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="horizontal"> <Button android:id="@+id/button_login" android:layout_width="120dp" android:layout_height="40dp" android:layout_marginTop="20dp" android:background="@drawable/login_button_bg" android:text="@string/login" android:textColor="@color/login_button" android:textStyle="bold" /> <Button android:id="@+id/button_reg_login" android:layout_width="120dp" android:layout_height="40dp" android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:background="@drawable/login_button_bg" android:text="@string/register" android:textColor="@color/login_button" android:textStyle="bold" /> </LinearLayout> </LinearLayout> </ScrollView>
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:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_vertical" android:orientation="vertical" tools:context=".Activity.MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginTop="40dp" android:layout_marginEnd="10dp" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/name" android:textSize="18sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginEnd="10dp" android:text=":-" android:textSize="18sp" /> <TextView android:id="@+id/textView_name_main" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/name" android:textSize="18sp" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/email" android:textSize="18sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginEnd="10dp" android:text=":-" android:textSize="18sp" /> <TextView android:id="@+id/textView_email_main" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/name" android:textSize="18sp" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/phone" android:textSize="18sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginEnd="10dp" android:text=":-" android:textSize="18sp" /> <TextView android:id="@+id/textView_phone_main" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/name" android:textSize="18sp" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="20dp" android:orientation="horizontal"> <Button android:id="@+id/button_update_main" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/update" /> <Button android:id="@+id/button_logout_main" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="5dp" android:text="@string/logout" /> </LinearLayout> </LinearLayout> </RelativeLayout>
activity_register.xml
<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/lavender" android:fillViewport="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical" tools:context=".Activity.Register"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/register" android:textColor="@color/white" android:textSize="32sp" android:textStyle="bold" /> <EditText android:id="@+id/editText_name_reg" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginStart="20dp" android:layout_marginTop="50dp" android:layout_marginEnd="20dp" android:background="@drawable/edittext_bg" android:hint="@string/name" android:inputType="text" android:paddingStart="10dp" android:paddingEnd="10dp" android:singleLine="true" android:textColor="@color/white" android:textColorHint="@color/white" android:textCursorDrawable="@null" /> <EditText android:id="@+id/editText_email_reg" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:layout_marginEnd="20dp" android:background="@drawable/edittext_bg" android:hint="@string/email" android:inputType="textEmailAddress" android:paddingStart="10dp" android:paddingEnd="10dp" android:singleLine="true" android:textColor="@color/white" android:textColorHint="@color/white" android:textCursorDrawable="@null" /> <EditText android:id="@+id/editText_password_reg" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:layout_marginEnd="20dp" android:background="@drawable/edittext_bg" android:hint="@string/password" android:inputType="textPassword" android:paddingStart="10dp" android:paddingEnd="10dp" android:singleLine="true" android:textColor="@color/white" android:textColorHint="@color/white" android:textCursorDrawable="@null" /> <EditText android:id="@+id/editText_phone_reg" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:layout_marginEnd="20dp" android:background="@drawable/edittext_bg" android:hint="@string/phone" android:inputType="phone" android:paddingStart="10dp" android:paddingEnd="10dp" android:singleLine="true" android:textColor="@color/white" android:textColorHint="@color/white" android:textCursorDrawable="@null" /> <Button android:id="@+id/button_reg" android:layout_width="120dp" android:layout_height="40dp" android:layout_gravity="center" android:layout_marginTop="40dp" android:layout_marginBottom="40dp" android:background="@drawable/login_button_bg" android:text="@string/register" android:textColor="@color/login_button" android:textStyle="bold" /> </LinearLayout> </ScrollView>
activity_update_user.xml
<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/lavender" android:fillViewport="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical" tools:context=".Activity.UpdateUser"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/update_user" android:textColor="@color/white" android:textSize="32sp" android:textStyle="bold" /> <EditText android:id="@+id/editText_name_update" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginStart="20dp" android:layout_marginTop="50dp" android:layout_marginEnd="20dp" android:background="@drawable/edittext_bg" android:hint="@string/name" android:inputType="text" android:paddingStart="10dp" android:paddingEnd="10dp" android:singleLine="true" android:textColor="@color/white" android:textColorHint="@color/white" android:textCursorDrawable="@null" /> <EditText android:id="@+id/editText_email_update" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:layout_marginEnd="20dp" android:background="@drawable/edittext_bg" android:hint="@string/email" android:inputType="textEmailAddress" android:paddingStart="10dp" android:paddingEnd="10dp" android:singleLine="true" android:textColor="@color/white" android:textColorHint="@color/white" android:textCursorDrawable="@null" /> <EditText android:id="@+id/editText_password_update" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:layout_marginEnd="20dp" android:background="@drawable/edittext_bg" android:hint="@string/password" android:inputType="textPassword" android:paddingStart="10dp" android:paddingEnd="10dp" android:singleLine="true" android:textColor="@color/white" android:textColorHint="@color/white" android:textCursorDrawable="@null" /> <EditText android:id="@+id/editText_phone_update" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:layout_marginEnd="20dp" android:background="@drawable/edittext_bg" android:hint="@string/phone" android:inputType="phone" android:paddingStart="10dp" android:paddingEnd="10dp" android:singleLine="true" android:textColor="@color/white" android:textColorHint="@color/white" android:textCursorDrawable="@null" /> <Button android:id="@+id/button_update" android:layout_width="120dp" android:layout_height="40dp" android:layout_gravity="center" android:layout_marginTop="40dp" android:layout_marginBottom="40dp" android:background="@drawable/login_button_bg" android:text="@string/update" android:textColor="@color/login_button" android:textStyle="bold" /> </LinearLayout> </ScrollView>
AndroidManifest file
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.app.databaseloginregister"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".Activity.Login"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".Activity.Register" /> <activity android:name=".Activity.UpdateUser" /> <activity android:name=".Activity.MainActivity" /> </application> </manifest>
Java Code
Login.java
package com.app.databaseloginregister.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import com.app.databaseloginregister.DataBase.DatabaseHandler; import com.app.databaseloginregister.R; import com.app.databaseloginregister.Util.Method; public class Login extends AppCompatActivity { private Method method; private DatabaseHandler db; private String email, password; private EditText editText_email, editText_password; private Button button_reg, button_login; private InputMethodManager imm; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); method = new Method(Login.this); db = new DatabaseHandler(Login.this); imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); if (method.pref.getBoolean(method.pref_login, false)) { String id = method.pref.getString(method.profileId, null); startActivity(new Intent(Login.this, MainActivity.class) .putExtra("id", id)); finishAffinity(); } editText_email = findViewById(R.id.editText_email_login); editText_password = findViewById(R.id.editText_password_login); button_login = findViewById(R.id.button_login); button_reg = findViewById(R.id.button_reg_login); button_login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { email = editText_email.getText().toString(); password = editText_password.getText().toString(); editText_email.clearFocus(); editText_password.clearFocus(); imm.hideSoftInputFromWindow(editText_email.getWindowToken(), 0); imm.hideSoftInputFromWindow(editText_password.getWindowToken(), 0); login(); } }); button_reg.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(Login.this, Register.class)); } }); } private void login() { editText_email.setError(null); editText_password.setError(null); if (!isValidMail(email) || email.isEmpty()) { editText_email.requestFocus(); editText_email.setError(getResources().getString(R.string.please_enter_email)); } else if (password.isEmpty()) { editText_password.requestFocus(); editText_password.setError(getResources().getString(R.string.please_enter_password)); } else { if (!db.checkLogin(email, password)) { String id = db.getUserId(email); if (id != null) { startActivity(new Intent(Login.this, MainActivity.class) .putExtra("id", id)); finishAffinity(); method.editor.putBoolean(method.pref_login, true); method.editor.putString(method.profileId, id); method.editor.commit(); } } else { method.alertBox(getResources().getString(R.string.fail)); } } } private boolean isValidMail(String email) { return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches(); } }
MainActivity.java
package com.app.databaseloginregister.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.app.databaseloginregister.DataBase.DatabaseHandler; import com.app.databaseloginregister.Item.UserList; import com.app.databaseloginregister.R; import com.app.databaseloginregister.Util.Method; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { private String id; private Method method; private DatabaseHandler db; private ListuserLists; private Button button_update, button_logout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); id = getIntent().getStringExtra("id"); method = new Method(MainActivity.this); userLists = new ArrayList<>(); db = new DatabaseHandler(MainActivity.this); userLists = db.getUser(id); TextView textView_name = findViewById(R.id.textView_name_main); TextView textView_email = findViewById(R.id.textView_email_main); TextView textView_phoneNo = findViewById(R.id.textView_phone_main); button_update = findViewById(R.id.button_update_main); button_logout = findViewById(R.id.button_logout_main); if (userLists.size() != 0) { textView_name.setText(userLists.get(0).getName()); textView_email.setText(userLists.get(0).getEmail()); textView_phoneNo.setText(userLists.get(0).getPhone()); } button_update.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this, UpdateUser.class) .putExtra("id", id) .putExtra("name", userLists.get(0).getName()) .putExtra("email", userLists.get(0).getEmail()) .putExtra("phone", userLists.get(0).getPhone())); } }); button_logout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { method.editor.putBoolean(method.pref_login, false); method.editor.commit(); startActivity(new Intent(MainActivity.this, Login.class)); finishAffinity(); } }); } }
Register.java
package com.app.databaseloginregister.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import com.app.databaseloginregister.DataBase.DatabaseHandler; import com.app.databaseloginregister.R; import com.app.databaseloginregister.Util.Method; public class Register extends AppCompatActivity { private Method method; private DatabaseHandler db; private Button button_register; private InputMethodManager imm; private String name, email, password, phoneNo; private EditText editText_name, editText_email, editText_password, editText_phoneNo; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); method = new Method(Register.this); db = new DatabaseHandler(Register.this); imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); editText_name = findViewById(R.id.editText_name_reg); editText_email = findViewById(R.id.editText_email_reg); editText_password = findViewById(R.id.editText_password_reg); editText_phoneNo = findViewById(R.id.editText_phone_reg); button_register = findViewById(R.id.button_reg); button_register.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { name = editText_name.getText().toString(); email = editText_email.getText().toString(); password = editText_password.getText().toString(); phoneNo = editText_phoneNo.getText().toString(); editText_name.clearFocus(); editText_email.clearFocus(); editText_password.clearFocus(); editText_phoneNo.clearFocus(); imm.hideSoftInputFromWindow(editText_name.getWindowToken(), 0); imm.hideSoftInputFromWindow(editText_email.getWindowToken(), 0); imm.hideSoftInputFromWindow(editText_password.getWindowToken(), 0); imm.hideSoftInputFromWindow(editText_phoneNo.getWindowToken(), 0); form(); } }); } private boolean isValidMail(String email) { return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches(); } private void form() { editText_name.setError(null); editText_email.setError(null); editText_password.setError(null); editText_phoneNo.setError(null); if (name.equals("") || name.isEmpty()) { editText_name.requestFocus(); editText_name.setError(getResources().getString(R.string.please_enter_name)); } else if (!isValidMail(email) || email.isEmpty()) { editText_email.requestFocus(); editText_email.setError(getResources().getString(R.string.please_enter_email)); } else if (password.equals("") || password.isEmpty()) { editText_password.requestFocus(); editText_password.setError(getResources().getString(R.string.please_enter_password)); } else if (phoneNo.equals("") || phoneNo.isEmpty()) { editText_phoneNo.requestFocus(); editText_phoneNo.setError(getResources().getString(R.string.please_enter_phone)); } else { if (db.checkEmail(email)) { db.addUser(name, email, password, phoneNo); editText_name.setText(""); editText_email.setText(""); editText_password.setText(""); editText_phoneNo.setText(""); method.alertBox(getResources().getString(R.string.register_success)); startActivity(new Intent(Register.this, Login.class)); } else { method.alertBox(getResources().getString(R.string.email_id_use)); } } } @Override public void onBackPressed() { super.onBackPressed(); } }
UpdateUser.java
package com.app.databaseloginregister.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import com.app.databaseloginregister.DataBase.DatabaseHandler; import com.app.databaseloginregister.R; import com.app.databaseloginregister.Util.Method; public class UpdateUser extends AppCompatActivity { private Method method; private DatabaseHandler db; private Button button_update; private InputMethodManager imm; private String id, name, email, password, phoneNo; private EditText editText_name, editText_email, editText_password, editText_phoneNo; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_update_user); method = new Method(UpdateUser.this); db = new DatabaseHandler(UpdateUser.this); id = getIntent().getStringExtra("id"); name = getIntent().getStringExtra("name"); email = getIntent().getStringExtra("email"); phoneNo = getIntent().getStringExtra("phone"); imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); editText_name = findViewById(R.id.editText_name_update); editText_email = findViewById(R.id.editText_email_update); editText_password = findViewById(R.id.editText_password_update); editText_phoneNo = findViewById(R.id.editText_phone_update); button_update = findViewById(R.id.button_update); editText_name.setText(name); editText_email.setText(email); editText_phoneNo.setText(phoneNo); button_update.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { name = editText_name.getText().toString(); email = editText_email.getText().toString(); password = editText_password.getText().toString(); phoneNo = editText_phoneNo.getText().toString(); editText_name.clearFocus(); editText_email.clearFocus(); editText_password.clearFocus(); editText_phoneNo.clearFocus(); imm.hideSoftInputFromWindow(editText_name.getWindowToken(), 0); imm.hideSoftInputFromWindow(editText_email.getWindowToken(), 0); imm.hideSoftInputFromWindow(editText_password.getWindowToken(), 0); imm.hideSoftInputFromWindow(editText_phoneNo.getWindowToken(), 0); form(); } }); } private boolean isValidMail(String email) { return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches(); } private void form() { editText_name.setError(null); editText_email.setError(null); editText_password.setError(null); editText_phoneNo.setError(null); if (name.equals("") || name.isEmpty()) { editText_name.requestFocus(); editText_name.setError(getResources().getString(R.string.please_enter_name)); } else if (!isValidMail(email) || email.isEmpty()) { editText_email.requestFocus(); editText_email.setError(getResources().getString(R.string.please_enter_email)); } else if (phoneNo.equals("") || phoneNo.isEmpty()) { editText_phoneNo.requestFocus(); editText_phoneNo.setError(getResources().getString(R.string.please_enter_phone)); } else { db.updateUser(id, name, email, password, phoneNo); startActivity(new Intent(UpdateUser.this, MainActivity.class) .putExtra("id", id)); finishAffinity(); } } @Override public void onBackPressed() { super.onBackPressed(); } }
Sqlite Database
Create inside DataBase package name DatabaseHandler class and extends SQLiteOpenHelper. This class all function perform CRUD(create, read, update and delete)
onCreate() will be call once application is install and create table.
onUpgrade() call to update table.
addUser() method use to the new register user data add to the database.
getUser() method used to the get single user information using to user id.
updateUser() method used to the user update information to the database.
checkEmail() method used to check the email id already exist or not in database.
getUserId() method used to the get user id.
DatabaseHandler.java
package com.app.databaseloginregister.DataBase; import android.annotation.SuppressLint; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import com.app.databaseloginregister.Item.UserList; import java.util.ArrayList; import java.util.List; public class DatabaseHandler extends SQLiteOpenHelper { // All Static variables // Database Version private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "demo_login"; // Table name private static final String TABLE_NAME = "user"; // Table Columns names private static final String KEY_ID = "id"; private static final String KEY_NAME = "name"; private static final String KEY_EMAIL = "user_email"; private static final String KEY_PHONE_NUMBER = "phone_number"; private static final String KEY_PASSWORD = "password"; public DatabaseHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { //create table String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + "(" + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ," + KEY_NAME + " TEXT," + KEY_EMAIL + " TEXT," + KEY_PHONE_NUMBER + " TEXT," + KEY_PASSWORD + " TEXT" + ")"; db.execSQL(CREATE_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME); } //add user in database public void addUser(String name, String email, String password, String phone) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_NAME, name); values.put(KEY_EMAIL, email); values.put(KEY_PHONE_NUMBER, phone); values.put(KEY_PASSWORD, password); db.insert(TABLE_NAME, null, values); db.close();//close database connection } //get user detail public ListgetUser(String id) { List userLists = new ArrayList<>(); String selectQuery = "SELECT * FROM " + TABLE_NAME + " WHERE " + KEY_ID + " = " + id; Log.d("Query_database_user", selectQuery); SQLiteDatabase db = this.getWritableDatabase(); @SuppressLint("Recycle") Cursor cursor = db.rawQuery(selectQuery, null); if (cursor.moveToFirst()) { do { UserList list = new UserList(); list.setName(cursor.getString(1)); list.setEmail(cursor.getString(2)); list.setPhone(cursor.getString(3)); list.setPassword(cursor.getString(4)); userLists.add(list); } while (cursor.moveToNext()); } // return user list return userLists; } //update user detail public void updateUser(String id, String name, String email, String password, String phoneNumber) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_NAME, name); values.put(KEY_EMAIL, email); if (!password.equals("")) { values.put(KEY_PASSWORD, password); } if (!phoneNumber.equals("")) { values.put(KEY_PHONE_NUMBER, phoneNumber); } db.update(TABLE_NAME, values, KEY_ID + "=" + id, null); } //check user login or not public boolean checkLogin(String userEmail, String userPassword) { String selectQuery = "SELECT " + KEY_ID + " FROM " + TABLE_NAME + " WHERE " + KEY_EMAIL + " =" + " " + "\'" + userEmail + "\'" + " AND " + KEY_PASSWORD + " = " + "\'" + userPassword + "\'"; Log.d("Query_database", selectQuery); SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); if (cursor.getCount() == 0) { return true; } else { return false; } } //check email id exit or not public boolean checkEmail(String userEmail) { String selectQuery = "SELECT * FROM " + TABLE_NAME + " WHERE " + KEY_EMAIL + " =?"; Log.d("Query_database", selectQuery); SQLiteDatabase db = this.getWritableDatabase(); @SuppressLint("Recycle") Cursor cursor = db.rawQuery(selectQuery, new String[]{userEmail}); if (cursor.getCount() == 0) { return true; } else { return false; } } //get current user login id public String getUserId(String userEmail) { String selectQuery = "SELECT * FROM " + TABLE_NAME + " WHERE " + KEY_EMAIL + " = " + "\'" + userEmail + "\'"; Log.d("Query_database", selectQuery); SQLiteDatabase db = this.getWritableDatabase(); @SuppressLint("Recycle") Cursor cursor = db.rawQuery(selectQuery, null); if (cursor.moveToFirst()) { String userId = cursor.getString(0); Log.d("user_id", String.valueOf(userId)); return userId; } else { return null; } } }
Item class
UserList.java
package com.app.databaseloginregister.Item; import java.io.Serializable; public class UserList implements Serializable { private String name, email, phone, password; public UserList() { } public UserList(String name, String email, String phone, String password) { this.name = name; this.email = email; this.phone = phone; this.password = password; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
Method class
Method.java
package com.app.databaseloginregister.Util; import android.app.Activity; import android.content.DialogInterface; import android.content.SharedPreferences; import android.support.v7.app.AlertDialog; import com.app.databaseloginregister.R; public class Method { private Activity activity; public SharedPreferences pref; public SharedPreferences.Editor editor; private final String myPreference = "login"; public String pref_login = "pref_login"; public String profileId = "profileId"; public Method(Activity activity) { this.activity = activity; pref = activity.getSharedPreferences(myPreference, 0); // 0 - for private mode editor = pref.edit(); } //show dialog box public void alertBox(String message) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(activity); alertDialogBuilder.setCancelable(false); alertDialogBuilder.setMessage(message); alertDialogBuilder.setPositiveButton(activity.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } }
How to download whatsapp status in android source code
public List imageArray = new ArrayList<>();
private String root = Environment.getExternalStorageDirectory() +"/WhatsApp/Media/.Statuses";
File file = new File(root);
imageArray=getListFiles(file)
private List getListFiles(File parentDir) {
List inFiles = new ArrayList<>();
try {
Queue files = new LinkedList<>();
files.addAll(Arrays.asList(parentDir.listFiles()));
while (!files.isEmpty()) {
File file = files.remove();
if (file.isDirectory()) {
files.addAll(Arrays.asList(file.listFiles()));
} else if (file.getName().endsWith(".jpg") || file.getName().endsWith(".gif")||
file.getName().endsWith(".mp4")) {
inFiles.add(file);
}
}
} catch (Exception e) {
Log.d("error", e.toString());
}
return inFiles;
}
Play Store Link:-click here
Instance video, image and media download
App Name: Instance video image download
Welcome to Instagram media download, the ultimate tool for downloading and enjoying images and videos from social media! With our app, you can effortlessly download single or multiple images and videos, watch videos within the app, and much more. Here’s what makes our application the best choice for your media needs
Key Features:
- Easy Downloads: Quickly download images and videos with a simple click.
- Batch Downloads: Download multiple images and videos from any user post with ease.
- Mixed Media Support: Seamlessly download posts containing both images and videos.
- Instant Downloads: Use our app to instantly download images and videos from social media.
- In-App Video Player: Watch your downloaded videos directly within the app.
- Pinch-to-Zoom: Enjoy the pinch-to-zoom feature for a better image viewing experience.
- Share and Set Wallpaper: Share images and videos on any social media app or set them as your wallpaper.
- Download Progress: Monitor your download progress with percentage indicators in the status bar.
How to Use This Application:
1. Open Instance: Launch our app to get started.
2. Open the Social Media App: Navigate to the social media app and find the image or video you want to download.
3. Copy Link: Use the 'Copy Link' option on the image or video post.
4. Download: Return to Instance App and past link, view your media, share it, or set it as wallpaper. Enjoy!
User Guide:
We provide a detailed video tutorial and information within the app to help you understand how to use Instance effortlessly. Follow these simple steps and maximize your experience.
Download Instance now and enjoy your favorite images and videos anytime, anywhere!
Contact Us:
If you have any questions or need support, feel free to reach out to us via krishna.app.worlds@gmail.com.
Rate Us:
If you love Our application, please take a moment to rate us on the Play Store. Your feedback helps us improve!
Kids Learning
Kids Learning (Alphabet, 123, Preschool Learning)
Play Store Link :- click here
Detail
- Learning abcd and one two three(123) number with sound and word image easy to learn before school of kids. - Easy to understand of word picture with small and capital alphabet with sound. - Easy to understand of word picture with one two three(123) number with sound. - Easy to remember with alphabet abcd animal name and picture. - Every word with alphabet and animal picture with sound - Easy to learning with without internet connection and share with your friend any type of alphabet and one two three (123) number picture - User can swap to the alphabet and one two three(123) number easy to change - User can drawing the abcd and number in the blackboard - User can easy to share and save the work. - Supporting in the android 10 dark mode Point 1)Small and capital alphabet 2)One two three 123 number 2)Sound and animal picture with every word 3)Easy to share with any social media 4)User can volume control with application 5)Automatic change the alphabet and one two three number feature 6)User can easy to change with next and previous alphabet and one two three number
How to Download WhatsApp Status
Play Store Link :- click here
App Name:- Status download and share (Image,video and gif)
Love your friend status and easy to share and download
easy to download status like image,video and gif.
easy to share with social media and easy to share with your friend.
you can also download status and then after share with your friend.
You can also watch video in application player.
Image status easy to set as wallpaper and home screen in phone.
pin touch feature also available in image view
Feature
1)You can also download business status
2)Share,download,set as wallpaper
3)Delete download status permanently
4)Full view image status
5)Video status easy to watch in application
How to use this application
1)First of view status in application
2)Then after view in this application or download share and set as wallpaper and enjoy application
Source code :- click here
Privacy Policy Krishna app worlds
Privacy Policy
Last Update :- 15-08-2023
Krishna app worlds built the open source applications app as an Ad Supported app. This SERVICE is provided by Krishna app worlds at no cost and is intended for use as is.
This page is used to inform visitors regarding our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our Service.
If you choose to use our Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that we collect is used for providing and improving the Service. We will not use or share your information with anyone except as described in this Privacy Policy.
Information Collection and Use
For a better experience, while using our Service, we may require you to provide us with certain personally identifiable information. The information that we request will be retained by us and used as described in this privacy policy.
The app does use third-party services that may collect information used to identify you.
Link to the privacy policy of third-party service providers used by the app
- Google Play Services
- AdMob
- Google Analytics for Firebase
- Firebase Crashlytics
- Log Data
We want to inform you that whenever you use our Service, in a case of an error in the app we 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 our 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
We 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.
- We want to inform users of this Service that these third parties have access to their 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
We 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 we 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 us. Therefore, we strongly advise you to review the Privacy Policy of these websites. We 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. We do not knowingly collect personally identifiable information from children under 13 years of age. In the case we discover that a child under 13 has provided us with personal information, we 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 us so that we will be able to do the necessary actions.
Changes to This Privacy Policy
We may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. We will notify you of any changes by posting the new Privacy Policy on this page.
The terms of condition used in the same meaning Privacy Policy .which is accessible at krishna app worlds unless otherwise defined in this Privacy Policy.
Krishna application follow the rule of GDPR(General Data Protection Regulation)
If you any query then feel free to contact krishna.app.worlds@gmail.com
Subscribe to:
Posts (Atom)