This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pre-defined Functions | |
String functions | |
The string is represent by | |
“ABC” | |
or | |
‘ABC’ | |
Functions – | |
a. strlen($str) – it returns the length of string. | |
<?php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Recycle View | |
It allocates memory for only those elements which are visible on screen. On scroll of screen it automatically refreshes the memory. | |
Step 1 | |
Add Dependency for RecyclerView to gradle file | |
It already exists | |
implementation 'com.android.support:appcompat-v7:28.0.0-beta01' | |
add this line using the version of above line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fetching data from Table | |
Step 1 - Create following table in database android | |
Student(name,branch,roll) | |
Insert some records | |
Step 2 – Create PHP file to select data (show_students.php) | |
<?php | |
$cn=mysqli_connect("localhost","root","","android"); | |
if(!$cn) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Confirm Dialog | |
We can use Confirm Dialog of JavaScript in PHP. It is very useful when we try to perform sensitive data operation. Using it we can confirm before do operation on data like delete operation on data. | |
Example 1 | |
<form | |
method="post" | |
action="delete_record.php" | |
onSubmit="return confirm('Do you want to delete?')"> | |
<input type="submit" name="B1" value="Delete" /> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using Password Encryption | |
The general function md5() is used to create hash key of string. It takes the string input and produces 128 bit fingerprint. | |
To insert in database using following code | |
$email=$_POST["T1"]; | |
$password=$_POST["T2"]; | |
require_once("MyLib.php"); | |
$pass=md5($password); | |
//echo $pass; die(); | |
$sql="insert into logindata values('$email','$pass')"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Volley – Fetch Data as JSON | |
• Create following PHP script | |
<?php | |
$cn=mysqli_connect("localhost","root","","android"); | |
if(!$cn) | |
{ | |
echo "Unable to connect"; | |
die(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Volley – Save Data | |
Volley is an HTTP library that makes networking for Android apps easier and most importantly, faster. It was developed by google and introduced in 2013. It is available as AOSP (Android Open Source Repository) | |
Volley is available on GitHub. | |
Volley offers the following benefits: | |
• Automatic scheduling of network requests. | |
• Multiple concurrent network connections. | |
• Transparent disk and memory response caching with standard HTTP cache coherence. | |
• Support for request prioritization. | |
• Cancellation request API. You can cancel a single request, or you can set blocks or scopes of requests to cancel. | |
• Ease of customization, for example, for retry and backoff. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activity_main.xml | |
<TextView | |
android:id="@+id/textView" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Click the button to go to pip mode!" | |
android:textColor="@color/black" | |
android:textSize="20dp" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintLeft_toLeftOf="parent" |