Sadaqat Academy provides free learning courses, scholarships, guidance, Test Preparations, videos lectures, past papers for all class.

No More Tension: All is here

Guidances, TimeTable, News etc.

Welcome Here in Sadaqat Academy

Free Learning Courses, scholarship, guidance, Test Preparation, Video Lectures, Past Papers of All Classes

Past Papers

Past Papers of All classes and All universities

Download Our Mobile Application

Educational Related Applications, Fun related and much more, from download section.

Educational news

Be Updated in detail with us

All is here

Video lectures, Motivational Videos and too much more here

Wednesday, March 25, 2020

Terminologies - RAPID RESEARCH & INNOVATION INITIATIVE (RRII)

COVID-19

COVID-19: is the name given by the World Health Organization (WHO) on February 11, 2020  for the disease caused by the novel coronavirus SARS-CoV-2. It started in Wuhan, China in late 2019 and has since spread worldwide. COVID-19 is an acronym that stands for coronavirus disease of 2019.

What does COVID-19 mean?
COVID-19 is the name of the disease caused by the SARS-CoV-2 virus. Viruses and the diseases they cause have different names. For example, AIDS is the disease caused by the human immunodeficiency virus, HIV.

Who named COVID-19?
The coronavirus disease of 2019 was named COVID-19 by the WHO in a press release on February 11, 2020.

When was the coronavirus given the “COVID-19” name?
On December 31, 2019, a strange new pneumonia of unknown cause was reported to the Chinese WHO Country Office. A cluster of these cases had appeared in Wuhan, a city in the Hubei Province of China. These infections were found to be caused by a new coronavirus which was given the name “2019 novel coronavirus” (2019-nCoV).

Why was the coronavirus renamed to COVID-19?
The WHO press release of February 11 explained why a name was needed for this new disease: “to enable discussion on disease prevention, spread, transmissibility, severity, and treatment.”

Diseases are officially named by WHO in the International Classification of Diseases (ICD). For COVID-19, the name was decided based on agreed guidelines between the WHO, the World Organization for Animal Health, and the Food and Agriculture Organization of the United Nations. The name was chosen because it didn’t refer to a specific geographic location, a specific animal, or a specific group of people. It also had to be easy to pronounce and related to the disease.

(It was later renamed “severe acute respiratory syndrome coronavirus 2,” or SARS-CoV-2 by the International Committee on Taxonomy of Viruses on February 11, 2020. It was named SARS-CoV-2 because the virus is a genetic cousin of the coronavirus which caused the SARS outbreak in 2002 (SARS-CoV). )

What is a coronavirus?
Coronaviruses are common human and animal viruses. They were first discovered in domestic poultry in the 1930s. In animals, coronaviruses cause a range of respiratory, gastrointestinal, liver, and neurologic diseases.

Only seven coronaviruses are known to cause disease in humans:

Four human coronaviruses cause symptoms of the “common cold.” These have catchy names which you’ll be forgiven for forgetting: 229E, OC43, NL63, and HUK1.
Three human coronaviruses cause much more serious lung infections, also called pneumonia: SARS-CoV in 2002 (severe acute respiratory syndrome or “SARS”), MERS-CoV in 2012 (Middle East respiratory syndrome or “MERS”), and SARS-CoV-2 (the current pandemic known as COVID-19).

What is a novel coronavirus?
A “novel” coronavirus means that it is a new coronavirus that has not been previously identified in humans. This means it is different from coronaviruses that cause the common cold, and those that caused SARS in 2002 and MERS in 2012.

Like, SARS and MERS, the novel coronavirus is a zoonotic disease. The definition of a zoonotic disease is one that begins in animals and is transmitted from animals to people.

OBJECTIVE OF QUICK RESPONSE RESEARCH ON COVID - 19

HEC's RAPID Research and Innovation Initiative will support applied research, product Innovation and development, and commercialization of potential solutions. RAPID Research Grants will support ideas for applied research. RAPID Technology Transfer Grants is intended for supporting research needed to assist the private sector to provide solutions. RAPID Innovation Seed Fund is intended to support innovators in commercializing their ideas.



EXPLORING BRAINSTORMING  ON HEC QUICK RESPONSE RESEARCH ON COVID-19:
    It means that the objective of this research is that the following outcomes shall become possible:-

  • After Research, Product Innovation and Development become possible.
  • After Research, Commercialization of Potential solutions become possible.
Make Clear Some points at the most initial Steps:
  • RAPID Research Grants will support ideas for applied research. There are three level of funding. This is the 1st category of funding and maximum fund is allocated to these researcher is Rs. 15 million and Maximum duration for this research is 12 months to support ideas for applied research in the field of the topic mention as on picture used in this blog post. 
  • RAPID Technology Transfer Grants is intended for supporting research needed to assist the private sector to provide solutions. This is the 2nd category of funding as you can see the picture used in this blog post and the  maximum funds for this researcher are allocated Rs. 7.5 million and Maximum duration for this research is 6 months for supporting research needed to assist the private sector to provide solutions (It means that there is need of researcher in private sector whose are in finding solutions....first of all, you should must know this kind of opportunity so that your research assist the pricate sector to provide solution and then you can sent your proposal) in the field of the topic mention as on picture used in this blog post. 
  • RAPID Innovation Seed Fund is intended to support innovators in commercializing their ideas. This is the 3rd category of funding as you can see the picture used in this blog post and the  maximum funds for this researcher are allocated Rs. 5 million and Maximum duration for this research is 6 months and is intended to support innovator in commercializing ideas. Hence, the proposal needed in such a way so that research should be conducted for the outcome of supporting researcher in commercializing ideas.
You  can categories these categories from highest to lowest level of researcher. For example, commercializing ideas may be restricted to some specific location and have limited numbers of factors. it may also  include some better ideas but people ownself need to prepare final item. similiarly, assist the private sector to provide solution may be the category as in this case private sector  is preparing some solution while people have to pay for it. While the Grant research may be the level of the research to support ideas with examples or data collection to support at the board level (at government level or policy maker level) and have considered numbers of factors and provide the solution of numbers of factors.

CLEAR TO YOUR MIND:
For clarity after brainstorming,  Read complete details on this link https://hec.gov.pk/english/services/RnD/RRIF/Pages/default.aspx and ignore the details mentions on picture used in this  blog post.

  • It is better to understand complete details of  research  and then start your research: The COVID-19. RAPID Research and Innovation Initiative (RRII) invites researchers to use the RAPID Research and Innovation funding mechanism, which allows HEC to receive and review proposals dealing with topics and issues of severe urgency with regard to the availability of or access to data, facilities or specialized equipment as well as quick-response research on COVID-19. There is an urgent and immediate need for research in order to gain a better understanding of the epidemic, to understand and contain the patterns of spread, develop diagnostics and improve patient care and the public health response. (I hope after reading this you got clear objective of research). The said fund is supported by the World Bank and implemented by the Higher Education Commission (HEC). The RRIF will provide funds to selected institutions based upon a competitive, yet swift peer-review of proposals.
(Now for more clarity and  complete details about topic and different categories of research, you may read the following topic from the link of HEC as mention above)

The priority themes for RRIF support include:
    • Development of Infectious Diseases Surveillance Systems Systems using big data analytics and artificial intelligence: Including integrating the response into the entire medical system, from primary to secondary to tertiary
    • Disease Epidemiological Modelling: Data systems and evidence-informed modelling for disease prediction, outcome prediction and impact assessment of interventions
    • Immune Patterns of COVID-19: Immune Mechanisms of COVID-19 infections and recovery, implications for diagnostics and therapeutics, including understanding localized factors and responses (such as ethnic, genetic, social, behavioral, and climatic factors, etc.)
    • Treatment modalities and strategies including concentration on local and traditional medicine
    • Diagnostics kits: Rapid diagnostics based on antigen detection vide RTPCR systems, Gene EXPERT systems or alternatives
    • Indigenous manufacture of Low cost Intensive-care equipment: Oxygen supply and monitoring equipment, Intravenous fluid devices, Ventilators/CPAP units, Cardio-respiratory monitors etc.
    • Development of disinfectants particularly using indigenous herbal ingredients: low-cost sterilization and sanitation material for hospitals, general-purpose consumer hand sanitization material
    • Personal Protective Equipment: N-95 Masks, other Personal Protective Gear (clothing gowns, goggles, and gloves), preferably reusable materials
    • Information Collection and Dissemination IT platforms: Identify hotspots and growth patterns, Contact tracing modeling of affected people
    • An additional priority area for the funding instrument RAPID Innovation Seed Fund (RISF) is Education Technology to facilitate learning at the basic and secondary education levels in a COVID-19 environment
(I hope till you had understand the topics details, but you have lot of questions in your mind still about the categories of funding, these details is also completely mentions on HEC website and I am going to explore step by step here in this blog... be cool. you just write all of questions on your note book that come in your mind, I hope the sequence I had followed, that will clear your all queries. Now I am exploring details categories of funding mention of HEC website on link https://hec.gov.pk/english/services/RnD/RRIF/Pages/default.aspx. I am exploring details of categories and there link are as:

     Each applicant seeking funding through the RAPID Research and Innovation Fund can propose an idea based on one of the above-mentioned priority themes and can apply through one of the following three funding instruments:
  1. RAPID Innovation Seed Fund (RISF)
).

The objective of exploring these category is that you can select your category and topic for your research. Exploring these categories will help you to know the objective of each category in clear way.

RAPID RESEARCH GRANT: 

The RAPID Research Grant will support multidimensional research projects of strategic importance related to the above-mentioned priority themes.  The present call is for research proposals that have the potential to contribute to the understanding of coronaviruses, including the Severe Acute Respiratory Syndrome coronavirus (SARS-CoV) and Coronavirus disease 2019 (COVID-19), in order to improve the clinical management or public health response. Projects should include relevant and cutting-edge research activities and should ensure WHO alignment. Research conducted in RRG projects must address specific challenges associated with the targeted priority theme and must clearly demonstrate a solution or significant progress in addressing a grand challenge.

Budgets for RRG awards will be up to a maximum of Rs. 15 million (USD 100 000), with a maximum project duration of 12 months. Principal Investigators are encouraged to seek co- and complementary financing from other sources.

Rapid Research Grant Proposals must be designed to include milestones and key performance indicators that should (ideally) begin providing valuable information and advice right from the start of the project and not wait for all the results at the tail end of the proposed project. To the extent possible, the project must also be designed in a manner that research teams can begin working right away rather than waiting for lengthy procurement or hiring. Those projects that have a steady stream of high-value immediate outputs and outcomes will be preferred. The Project Steering Committee may review progress on a bi-monthly or quarterly basis.



Funding Details

RRG funding may be used for:

Salaries for PI and co-PIs based on the amount of time spent on the project
Stipends for bachelors, masters, doctoral students and postdoctoral scholars to conduct the research proposed
The purchase and maintenance of appropriate approved equipment to conduct the research proposed
The purchase of research supplies necessary to conduct the research proposed

Limited research and development costs

Patent filing

Grants to attract visiting researchers from outside Pakistan to conduct research that contributes to the grant objectives. These visiting researchers can be either expatriate Pakistani scientists or foreign scientists.
A component of the grant will be earmarked for the problem solving (i.e., it will be released only if there is demonstrable evidence of success in solving the chosen problem).



Eligibility Criteria

Lead Principal Investigators (PIs) must:

Be university faculty member (PhD or FCPS/MCPS/FRCS) from medical institute or research-intensive institution as specified for GCF-2020 call (The VC/Rector shall ensure that max. two exceptional proposals per HEI will be submitted)
Project Team may include:

A consortia of faculty members from multiple university departments and/or multiple universities
Private sector participants, particularly when they bring prior IP or capability to the consortium and/or significant deployment, implementation, or scale up capability
International partners
International collaborations are encouraged:


When the international partner brings a unique added value to the project team
(Finally, Now  it has been cleared from the eligible criteria that whose are eligible for this  research)


RAPID TECHNOLOGY TRANSFER GRANT:

The RAPID Technology Transfer Grant (RTTG) seeks to support university-industry technology transfer of a previously developed an existing prototype or an advanced model (or equivalent). Owing to the nature of the COVID-19 crisis, the RTTG shall be ideally utilized to quickly transition science or technology to an actual industrial partner (or partners) that will result in significant and qualitative improvement in the latter's capacity to meet the emerging challenge of COVID-19.


Budgets for RTTG awards will be up to a maximum of Rs. 7.5 million (USD 50 000) with a maximum project duration of 6 months.  Principal Investigators are encouraged to obtain co-financing – including in-kind and/or cash contributions – from the industry collaborators. The requested amount of RTTG funding for the academic institution cannot exceed the co-financing committed by the industry collaborators.


 The RTTG Proposals must be designed to include milestones and key performance indicators that should (ideally) begin delivering an impact right from the start of the project and not wait for all the results at the tail end of the proposed project. To the extent possible, the project must also be designed in a manner that teams can begin working right away rather than waiting for lengthy procurement or hiring. Those projects that have a steady stream of high-value immediate outputs and outcomes will be preferred. The Project Steering Committee may review progress on a bi-monthly or quarterly basis.




Funding Details


Budget requests should be consistent with the proposed research and development activities. RTTG funding may be used for:


Salaries for PI and co-PIs based on the amount of time spent on the project

Stipends for bachelors, masters, doctoral students and post-doctoral scholars to help take the prototype or proposed product to market.

Limited prototype development costs

Laboratory tests or access to data

Patent filing

Producing licensing agreements

Legal and financial investment advice

Marketing of the prototype or proposed product to appropriate investors or stakeholders.



Eligibility Criteria


Principal Investigator (PI) must;


be a regular faculty member (PhD or FCPS/MCPS/FRCS) of universities (Public or private sector) (The VC/Rector shall ensure that max. two exceptional proposals per HEI will be submitted)

Co-financing (including in kind or cash contribution) by the industry partner is mandatory




The RAPID Innovation Seed Fund (RISF) will be implemented through the existing BICs located at HEIs.  Within the RISF competition, the Higher Education Commission aims to support a portfolio of entrepreneurial teams that, as a whole, will lead to successful start-ups addressing the COVID-19 national response. To take full advantage of the national research and innovation capacity in Pakistan, the portfolio of awards will reflect the diversity of potential entrepreneurs in Pakistan, including current students, recent graduates, and faculty members.
The budgets for RISF projects will be Rs. 5 million (USD 35,000) for a period of 6 months. The project budget will finance the following activities:
  • Working capital or initial order costs
  • Certification, registration or endorsement
  • Laboratory testing
  • Marketing costs or arranging demonstration
  • Funds to scale the venture
  • Financial management, or other (please specify)

Eligibility Criteria
Students, recent graduates and/or faculty from universities (Public or private sector) (The VC/Rector shall ensure that max. two exceptional proposals per HEI will be submitted)




REFERENCE OF ORIGINAL DETAILS:

HIGHER EDUCATION COMMISSION PAKISTAN Quick-response Research on COVID-19 RAPID Research and Innovation Proposals 

HEC, with assistance of the World Bank, invites universities, technologists and researchers to submit research and innovation proposals that can help address the challenges created by the Coronavirus pandemic.

HEC's RAPID Research and Innovation Initiative will support applied research, product Innovation and development, and commercialization of potential solutions. RAPID Research Grants will support ideas for applied research. RAPID Technology Transfer Grants is intended for supporting research needed to assist the private sector to provide solutions. RAPID Innovation Seed Fund is intended to support innovators in commercializing their ideas.

The specific themes include, but are not limited to any one of the following:

■ Infectious Diseases Surveillance Systems Al and Big Data

■ Analysis of success and weaknesses of alternative epidemic control measures

■ Disease Epidemiological Modelling

■ Immune Patterns of COVID-19

■ Treatment Modalities and Strategies

■ Information collection and dissemination on IT platforms

■ Indigenous manufacturing of low-cost using  equipment or materials, e.g., diagnostic  kits, intensive care equipment (e.g., ventilators), or personal protective equipment 

■ Development of disinfectants, particularly using indigenous herbal or natural ingredients 
 
 
       The amount of funding for each proposal will depend on its nature and proposed duration as well as the approved budget, but will not exceed the amounts given below.

   RAPID Research Grant    Rs. 15 million (USD 100 000)    12 months
   RAPID Technology Transfer Grant    Rs. 7.5 million (USD 50 000)     6 months
   RAPID Innovation Seed Fund    Rs. 5 million (USD 35,000)    6 months

HEC will use a transparent, accelerated evaluation process, based on the World Bank guidelines, to select the best proposals.The proposals will be reviewed on a first-come-first-served basis.

Deadline for Proposal Submission: April 3, 2020.
For further information, please visit 
https://hec.gov.pk/english/services/RnD/RRIF, or contact 
Director General, R&D Division, HEC, H-9 Islamabad, Pakistan, 
Email: Info-r&d@hec.gov.pk 

Note: I spent 8 hours continuously to write all details and understanding this about this research as first time in life for such  opportunity and then I  made video. I hope next time it will be a piece of cake of me. 
Share:

RAPID RESEARCH & INNOVATION INITIATIVE (RRII)


The COVID-19 RAPID Research and Innovation Initiative (RRII) invites researchers to use the RAPID Research and Innovation funding mechanism, which allows HEC to receive and review proposals dealing with topics and issues of severe urgency with regard to the availability of or access to data, facilities or specialized equipment as well as quick-response research on COVID-19. There is an urgent and immediate need for research in order to gain a better understanding of the epidemic, to understand and contain the patterns of spread, develop diagnostics and improve patient care and the public health response. The said fund is supported by the World Bank and implemented by the Higher Education Commission (HEC). The RRIF will provide funds to selected institutions based upon a competitive, yet swift peer-review of proposals. 

The priority themes for RRIF support include:
  • Development of Infectious Diseases Surveillance Systems Systems using big data analytics and artificial intelligence: Including integrating the response into the entire medical system, from primary to secondary to tertiary
  • Disease Epidemiological Modelling: Data systems and evidence-informed modelling for disease prediction, outcome prediction and impact assessment of interventions
  • Immune Patterns of COVID-19: Immune Mechanisms of COVID-19 infections and recovery, implications for diagnostics and therapeutics, including understanding localized factors and responses (such as ethnic, genetic, social, behavioral, and climatic factors, etc.)
  • Treatment modalities and strategies including concentration on local and traditional medicine
  • Diagnostics kits: Rapid diagnostics based on antigen detection vide RTPCR systems, Gene EXPERT systems or alternatives
  • Indigenous manufacture of Low cost Intensive-care equipment: Oxygen supply and monitoring equipment, Intravenous fluid devices, Ventilators/CPAP units, Cardio-respiratory monitors etc.
  • Development of disinfectants particularly using indigenous herbal ingredients: low-cost sterilization and sanitation material for hospitals, general-purpose consumer hand sanitization material
  • Personal Protective Equipment: N-95 Masks, other Personal Protective Gear (clothing gowns, goggles, and gloves), preferably reusable materials
  • Information Collection and Dissemination IT platforms: Identify hotspots and growth patterns, Contact tracing modeling of affected people
  • An additional priority area for the funding instrument RAPID Innovation Seed Fund (RISF) is Education Technology to facilitate learning at the basic and secondary education levels in a COVID-19 environment
Each applicant seeking funding through the RAPID Research and Innovation Fund can propose an idea based on one of the above-mentioned priority themes and can apply through one of the following three funding instruments:
  1. RAPID Innovation Seed Fund (RISF)


Call for Proposal for RAPID Research and Innovation Initiative (RRII) is now open and applications can be submitted through the online portal (eportal.hec.gov.pk) after 25.3.2020

Deadline for submission of applications is 3rd ​April 2020 (23.59 Pakistan Standard Time)


Share:

Development of Android MCQs App

In this project, we shall build an android MCQs App

Module 1: 

         We will using Firebase to store data (Question, Answer, User, Ranking...etc)

Be ready for learning

 - Firebase setup
 - Sign Up/ Sign In layout
 - Register / Login functional

Now create new Empty Project from Android Studio. Then,

Now we need to create new project on Firebase.

Click on Add Project
Create a project
Enter Project Name


Setting of android studio on Firebase and Vice Versa:
Create new android app on Firebase
While create new android app on Firebase, copy package name from MainActivity.java and put in Firebase as per requirement.
Now Steps to Read SHA1: open on android studio as

Copy SHA1 from 

Paste on Firebase as

Add FireBase to Your Android App
Download file when the above screen is come and put into your android studio as shown in above.

When you click on Continue Gradle, you need to follow Gradle instructions...

Copy code and paste as 

Next Step
    

Next Step:


Paste of file into android studio after downloading from Firebase


Now Make Sync Gradle.

We had done Firebase to our Android Project.

Now, we need to add some  required Libraries to add into android project such as firebase, design, etc... then we need to work with xml file and finally with java file... 


Libraries includes:
  • Firebase core
  • Firebase database
  • Material Edit Text
  • Card View


apply plugin: 'com.android.application'
android {
    compileSdkVersion 29    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.example.generalknowledgequizapp"        minSdkVersion 16        targetSdkVersion 29        versionCode 1        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"    }

    buildTypes {
        release {
            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.google.firebase:firebase-core:17.2.3'    implementation 'com.google.firebase:firebase-database:19.2.1'    implementation 'com.google.firebase:firebase-analytics:17.2.3'    implementation 'com.rengwuxian.materialedittext:library:2.1.4'    implementation 'androidx.appcompat:appcompat:1.1.0'    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'    testImplementation 'junit:junit:4.13'    androidTestImplementation 'androidx.test.ext:junit:1.1.1'    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'    implementation 'androidx.cardview:cardview:1.0.0'}
apply plugin: 'com.google.gms.google-services'


Next, we will create Model

our user will have three main information
- User name
- password
- Email

Hence, Java-->Model-->User.java


package Model;

import android.text.Editable;

public class User {
    private String userName;
    private String password;
    private String email;

    public User() {
    }

    public User(String userName, String password, String email){
        this.userName = userName;
        this.password = password;
        this.email = email;
    }


    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
}



Now we will create layout for signup


<?xml version="1.0" encoding="utf-8"?><androidx.cardview.widget.CardView    xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:layout_margin="8dp"
    app:cardElevation="4dp"    >
<LinearLayout    android:orientation="vertical"    android:layout_width="match_parent"    android:layout_height="wrap_content">

    <com.rengwuxian.materialedittext.MaterialEditText        android:id="@+id/edtNewUserName"        android:hint="User name"        android:textColorHint="@color/colorPrimary"        android:textColor="@color/colorPrimary"        android:textSize="24sp"        android:layout_width="match_parent"        android:layout_height="wrap_content"        app:met_baseColor="@color/colorPrimary"        app:met_floatingLabel="highlight"        app:met_singleLineEllipsis="true"        />

    <com.rengwuxian.materialedittext.MaterialEditText        android:id="@+id/edtNewPassword"        android:hint="Password"        android:textColorHint="@color/colorPrimary"        android:textColor="@color/colorPrimary"        android:textSize="24sp"        android:inputType="textPassword"        android:layout_width="match_parent"        android:layout_height="wrap_content"        app:met_baseColor="@color/colorPrimary"        app:met_floatingLabel="highlight"        app:met_singleLineEllipsis="true"        />

    <com.rengwuxian.materialedittext.MaterialEditText        android:id="@+id/edtNewEmail"        android:hint="Email"        android:textColorHint="@color/colorPrimary"        android:textColor="@color/colorPrimary"        android:textSize="24sp"        android:inputType="textEmailAddress"        android:layout_width="match_parent"        android:layout_height="wrap_content"        app:met_baseColor="@color/colorPrimary"        app:met_floatingLabel="highlight"        app:met_singleLineEllipsis="true"        />
</LinearLayout>


</androidx.cardview.widget.CardView>


Now, coding start...

package com.example.generalknowledgequizapp;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.rengwuxian.materialedittext.MaterialEditText;

import Model.User;

public class MainActivity extends AppCompatActivity
{
    MaterialEditText edtNewUser, edtNewPassword, edtNewEmail; // For Sign Up    MaterialEditText edtUser, edtPassword; // For Sign In
    Button btnSignUp, btnSignIn;

    FirebaseDatabase database;
    DatabaseReference users;

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //Firebase        database = FirebaseDatabase.getInstance();
        users = database.getReference("Users");

        edtUser = (MaterialEditText)findViewById(R.id.edtUser);
        edtPassword = (MaterialEditText)findViewById(R.id.edtPassword);

        btnSignIn = (Button)findViewById(R.id.btn_sign_in);
        btnSignUp = (Button)findViewById(R.id.btn_sign_up);

        btnSignUp.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {
                showSignUpDialog();
            }
        });
        btnSignIn.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View v) {
                signIn(edtUser.getText().toString(),edtPassword.getText().toString());
            }
        });
    }

    private void signIn(final String user, final String pwd) {
        users.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                if(dataSnapshot.child(user).exists())
                {
                    if(!user.isEmpty())
                    {
                        User login = dataSnapshot.child(user).getValue(User.class);
                        if(login.getPassword().equals(pwd))
                            Toast.makeText(MainActivity.this, "Login ok!", Toast.LENGTH_SHORT).show();
                        else                            Toast.makeText(MainActivity.this, "Wrong password", Toast.LENGTH_SHORT).show();
                    }
                    else                        {
                        Toast.makeText(MainActivity.this, "Please enter your user name", Toast.LENGTH_SHORT).show();
                    }
                }
                else                {
                    Toast.makeText(MainActivity.this, "User is not exists", Toast.LENGTH_SHORT).show();
                }

            }

            @Override            public void onCancelled(@NonNull DatabaseError databaseError) {

            }
        });
    }



    private void showSignUpDialog() {
        AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this);
        alertDialog.setTitle("Sign Up");
        alertDialog.setMessage("Please Enter Required Information");

        LayoutInflater inflater = this.getLayoutInflater();
        View sign_up_layout = inflater.inflate(R.layout.sign_up_layout,null);


        edtNewUser = (MaterialEditText)sign_up_layout.findViewById(R.id.edtNewUserName);
        edtNewEmail = (MaterialEditText)sign_up_layout.findViewById(R.id.edtNewEmail);
        edtNewPassword = (MaterialEditText)sign_up_layout.findViewById(R.id.edtNewPassword);

        alertDialog.setView(sign_up_layout);
        alertDialog.setIcon(R.drawable.ic_account_circle_black_24dp);

        alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
            @Override            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
            }
        });

        alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
            @Override            public void onClick(DialogInterface dialogInterface, int i) {
                final User user = new User(edtNewUser.getText().toString(),
                        edtNewPassword.getText().toString(),
                        edtNewEmail.getText().toString());

                users.addListenerForSingleValueEvent(new ValueEventListener() {
                    @Override                    public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                        if (dataSnapshot.child(user.getUserName()).exists())
                            Toast.makeText(MainActivity.this, "User already exists !", Toast.LENGTH_SHORT).show();
                        else {
                            users.child(user.getUserName())
                                    .setValue(user);
                            Toast.makeText(MainActivity.this, "User registration success!", Toast.LENGTH_SHORT).show();
                        }

                    }

                    @Override                    public void onCancelled(@NonNull DatabaseError databaseError) {

                    }
                });
                dialogInterface.dismiss();

            }

        });
        alertDialog.show();
        }
}

All had been done. Now go to firebase, click on database and update rules to true value and start signup work.










Share:

Tuesday, March 24, 2020

Development of Digital Counter - Taasbi Application

In this post, I am describing complete procedure for the Development of Digital Counter - Taasbi Application to be developed in the Android Studio.


Step 1: Open empty project on android studio.

Step 2: Open activity_main.xml and code as

<?xml version="1.0" encoding="utf-8"?><RelativeLayout 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"    tools:context=".MainActivity">

    <TextView        android:id="@+id/counterTxt"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_centerHorizontal="true"        android:layout_marginTop="40dp"        android:textSize="120sp"        android:text="25"/>

    <LinearLayout        android:layout_below="@+id/counterTxt"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_centerHorizontal="true"        android:orientation="horizontal"        android:layout_marginTop="80dp">

        <Button            android:id="@+id/minusBtn"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="-"            android:textSize="50sp"/>

        <Button            android:id="@+id/resetBtn"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Reset"            android:textSize="50sp"            android:layout_marginLeft="5dp"            android:layout_marginRight="5dp"/>

        <Button            android:id="@+id/plusBtn"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="+"            android:textSize="50sp"/>

    </LinearLayout>

</RelativeLayout>


Step 3: Open MainActivity.java and code as

package com.example.taasbi_digitalcounter;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    private TextView counterTxt;
    private Button minusBtn;
    private Button plusBtn;
    private Button resetBtn;

    private  int counter;

    private View.OnClickListener clickListener = new View.OnClickListener() {
        @Override        public void onClick(View v) {
            switch (v.getId()){
                case R.id.minusBtn :
                    minusCounter();
                    break;
                case R.id.plusBtn :
                    plusCounter();
                    break;
                case R.id.resetBtn :
                    initCounter();
                    break;
            }
        }
    };
    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        counterTxt = (TextView) findViewById(R.id.counterTxt);
        minusBtn = (Button) findViewById(R.id.minusBtn);
        minusBtn.setOnClickListener(clickListener);
        plusBtn = (Button) findViewById(R.id.plusBtn);
        plusBtn.setOnClickListener(clickListener);
        resetBtn = (Button) findViewById(R.id.resetBtn);
        resetBtn.setOnClickListener(clickListener);

        initCounter();
    }

    private void initCounter(){
        counter = 0;
        counterTxt.setText(counter + "");
    }

    private void plusCounter(){
        counter++;
        counterTxt.setText(counter + "");
    }

    private void minusCounter(){
        counter--;
        counterTxt.setText(counter + "");
    }
}


Share:

Hello World Application

In the last post, I described the process of setting up the android studio on PC. Now, In this blog post, I tell you the development of Hello World Application.



Step 1: Open android Studio. New Project --> Select Empty Project

Step 2: As already buildin Empty Project with Hello World in android  Studio as you can check activity_main.xml from layout. Now, you can build APK.




Your Hello World Application is ready to use.

Your Task:
             Replace the Hello World !... with some other words.....




Share:

Installation of Android Studio

Here, I am talking about installation of Android Studio on Window Platform. First of all, you should clear in your mind that there is about a little bit same process of installation of Android Studio on different Operating System but I am using android studion on both Window 32 bit and 64 bit Operating System. Okay, Let starts, now I guide you about


The installation of Android studio on 32 bit system step by step:


Step 1: Open www.google.com and write Download JDK 8. From the first link you may download jdk for window 32 bit. After downloading, you may install this jdk by default (without any change in path). (Remember that this is the java installation for Android Studio)

Step 2: Open www.google.com and write Download Android Studio. Open the first link and you may download android studio. After downloading, you need to setup by default (without any change in path) to set up android studio.


Installation of Android Studio on 64 bit system Step by Step:


Step 1: Open www.google.com and write Download JDK 8. From the first link you may download jdk for window 64 bit. After downloading, you may install this jdk by default (without any change in path). (Remember that this is the java installation for Android Studio)

Step 2: Open www.google.com and write Download latest JDK. From the first link you may download jdk for window 64 bit. After downloading, you may install this jdk by default (without any change in path).

Step 3: Open www.google.com and write Download Android Studio. Open the first link and you may download android studio. After downloading, you need to setup by default (without any change in path) to set up android studio.


You had all is done to setup android studio.

Share:

Sunday, February 23, 2020

English paper Gujranwala board 10th class Annual 2020



Objective Answer Keys
1. A
2. B
3. D
4. B
5. B
6. A
7. B
8. C
9. A
10. B
11. A
12. A
13. A
14. B
15. C
16. C
17. D
18. B
19. A
Share:

Search This Blog

Recent Posts