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
| 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
| 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
| 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
| 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
| 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
| 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
| Fragments | |
| A Fragment is a piece of an activity which enable more modular activity design. It will not be wrong if we say, a fragment is a kind of sub-activity. | |
| • A fragment has its own layout and its own behaviour with its own life cycle callbacks. | |
| • You can add or remove fragments in an activity while the activity is running. | |
| • You can combine multiple fragments in a single activity to build a multi-plane UI. | |
| • A fragment can be used in multiple activities. | |
| • Fragment life cycle is closely related to the life cycle of its host activity which means when the activity is paused, all the fragments available in the activity will also be stopped. | |
| • A fragment can implement a behaviour that has no user interface component. | |
| • Fragments were added to the Android API in Honeycomb version of Android which API version 11. | |