How to create android app for website.?How to open website in android app

activity_main.xml

Just add webView to xml


Main Activity.Java

 import android.os.Bundle;  
 import android.support.annotation.Nullable;  
 import android.support.v7.app.AppCompatActivity;  
 import android.webkit.WebView;  
 import android.webkit.WebViewClient;  
 public class MainActivity extends AppCompatActivity {  
   private WebView mywebView;  
   String url="www.google.com";  
   @Override  
   protected void onCreate(@Nullable Bundle savedInstanceState) {  
     super.onCreate(savedInstanceState);  
     setContentView(R.layout.activity_main);  
     mywebView=findViewById(R.id.web);  
     mywebView.getSettings().setJavaScriptEnabled(true);  
     mywebView.getSettings().setSupportZoom(true);  
     mywebView.getSettings().setUseWideViewPort(true);  
     mywebView.getSettings().setLoadWithOverviewMode(true);  
     mywebView.loadUrl(url);  
     mywebView.setWebViewClient(new WebViewClient());  
   }  
   @Override  
   public void onBackPressed() {  
     if(mywebView.canGoBack()) {  
       mywebView.goBack();  
     } else {  
       super.onBackPressed();  
     }  
   }  
 }  


Why my android app is not working.? Why my android app crashes.?

Hello friends,

Here I am going to discuss what are the general and mistakes people do or they forget while making an android app.

Reason app do not open or crashes in between

1.Do not include permission in Android.manifest

2.Do not add activity in Android.manifest

3.xml file id to element is not mapped or connect to UI

4.Calling of a function that goes into a loop

5.Calling of a function directly in onCreate()

6.Xml file is not connected

There are many others error due to minor mistakes.

Try to avoid all these silly mistakes.

How to clear screen in cmd in windows.?

It's very simple one line command in cmd just run

 cls  



How to make caluculator app using android.?

activity_main.xml

 <?xml version="1.0" encoding="utf-8"?>  
 <android.support.constraint.ConstraintLayout  
   xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"  
   android:layout_height="match_parent">  
   <LinearLayout  
     android:layout_width="match_parent"  
     android:layout_height="match_parent"  
     android:orientation="vertical" >  
     <LinearLayout  
       android:layout_width="match_parent"  
       android:layout_height="wrap_content" >  
       <TextView  
         android:id="@+id/textView1"  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:text="Value 1"  
         android:textAppearance="?android:attr/textAppearanceLarge" />  
       <EditText  
         android:id="@+id/editText1"  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:layout_weight="1"  
         android:ems="10"  
         android:inputType="number" >  
         <requestFocus />  
       </EditText>  
     </LinearLayout>  
     <LinearLayout  
       android:layout_width="match_parent"  
       android:layout_height="wrap_content" >  
       <TextView  
         android:id="@+id/textView2"  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:text="Value2"  
         android:textAppearance="?android:attr/textAppearanceLarge" />  
       <EditText  
         android:id="@+id/editText2"  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:layout_weight="1"  
         android:ems="10"  
         android:inputType="number" />  
     </LinearLayout>  
     <LinearLayout  
       android:layout_width="match_parent"  
       android:layout_height="wrap_content" >  
       <Button  
         android:id="@+id/button1"  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:text="+" />  
       <Button  
         android:id="@+id/button2"  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:text="-" />  
       <Button  
         android:id="@+id/button3"  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:text="*" />  
       <Button  
         android:id="@+id/button4"  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:text="/" />  
       <Button  
         android:id="@+id/button5"  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:text="C" />  
     </LinearLayout>  
     <LinearLayout  
       android:layout_width="match_parent"  
       android:layout_height="wrap_content" >  
       <TextView  
         android:id="@+id/textView3"  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:text="Result"  
         android:textAppearance="?android:attr/textAppearanceLarge" />  
       <EditText  
         android:id="@+id/editText3"  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:layout_weight="1"  
         android:ems="10"  
         android:inputType="number" />  
     </LinearLayout>  
   </LinearLayout>  
 </android.support.constraint.ConstraintLayout>  

MainActivity.java

 package com.app.kapil.calculator;  
 import android.os.Bundle;  
 import android.support.v7.app.AppCompatActivity;  
 import android.view.View;  
 import android.widget.Button;  
 import android.widget.EditText;  
 public class MainActivity extends AppCompatActivity {  
   Button b1,b2,b3,b4,b5;  
   EditText t1,t2,t3;  
   @Override  
   protected void onCreate(Bundle savedInstanceState) {  
     super.onCreate(savedInstanceState);  
     setContentView(R.layout.activity_main);  
     b1=(Button) findViewById(R.id.button1);  
     b2=(Button) findViewById(R.id.button2);  
     b3=(Button) findViewById(R.id.button3);  
     b4=(Button) findViewById(R.id.button4);  
     b5=(Button) findViewById(R.id.button5);  
     t1=(EditText) findViewById(R.id.editText1);  
     t2=(EditText) findViewById(R.id.editText2);  
     t3=(EditText) findViewById(R.id.editText3);  
     b1.setOnClickListener(new A());  
     b2.setOnClickListener(new B());  
     b3.setOnClickListener(new C());  
     b4.setOnClickListener(new D());  
     b5.setOnClickListener(new E());  
   }  
   class A implements View.OnClickListener  
   {  
     @Override  
     public void onClick(View arg0) {  
       int a,b,ans;  
       a=Integer.parseInt(t1.getText().toString());  
       b=Integer.parseInt(t2.getText().toString());  
       ans=a+b;  
       t3.setText(""+ans);  
     }  
   }  
   class B implements View.OnClickListener  
   {  
     @Override  
     public void onClick(View arg0) {  
       int a,b,ans;  
       a=Integer.parseInt(t1.getText().toString());  
       b=Integer.parseInt(t2.getText().toString());  
       ans=a-b;  
       t3.setText(""+ans);  
     }  
   }  
   class C implements View.OnClickListener  
   {  
     @Override  
     public void onClick(View arg0) {  
       int a,b,ans;  
       a=Integer.parseInt(t1.getText().toString());  
       b=Integer.parseInt(t2.getText().toString());  
       ans=a*b;  
       t3.setText(""+ans);  
     }  
   }  
   class D implements View.OnClickListener  
   {  
     @Override  
     public void onClick(View arg0) {  
                try{  
                int a,b,ans;  
       a=Integer.parseInt(t1.getText().toString());  
       b=Integer.parseInt(t2.getText().toString());  
                ans=a/b;  
       t3.setText(""+ans);  
                }  
                catch(Exception e){  
        Toast.makeText(MainActivity.this,"Enter a number other than 0 "+e,Toast.LENGTH_LONG).show();  
                }  
     }  
   }  
   class E implements View.OnClickListener  
   {  
     @Override  
     public void onClick(View arg0) {  
       t1.setText("");  
       t2.setText("");  
       t3.setText("");  
       t1.requestFocus();  
     }  
   }  
 }  

Output



















I hope that helps :)

-Kapil Arora-

How to setup android studio.? How to install android studio.? Error in installing android studio.? Windows/Linux/MacOs

Hello friends,

The problem in installing an android studio is very common to all as it's huge setup includes everything in it required to build awesome apps.

Don't worry if it doe not installed in first go we will soon start in your pc and we will look into the issue and fix it.

Basically, you need two things to run the android studio.
  1. Java environment (JDK installed) Download Java
  2. Latest Android Studio(3.2 at this time) Download Android Studio
If you have already downloaded java and installed in your pc then you need to check which java version is installed on  your pc.

How to check which java version is installed.? 
 
For Windows/Linux 
  • Open cmd/terminal
  •  For Windows press window key+R and type cmd and run it.
  • For Linux, search terminal run it 

In both, you can use this command to know your java version installed javac -version

Below is the sample output in windows



For MacOs

Find Java Control Panel on Mac
Launch the Java Control Panel on Mac (10.7.3 and above)
  1. Click on Apple icon on upper left of the screen.
  2. Go to System Preferences
  3. Click on the Java icon to access the Java Control Panel.
 To know in more details for macos click here


Now, we are done with installation of java or checking of java version lets's come back to android studio installation.

It's recommended that you need to connect to wifi or a good internet connection with your system so if any file missing or any updation require it fixes it while installation only.

If you got "Hello World " on the screen in the first go then many congratulations to you as you have successfully running android studio and ready to go.

If there is some errors or red lines on the files don't worry there might be some updation require or SDK file location missing you just connect your system to the internet and start android studio again.
 
And in somecases it might not pick the sdk location automatically and you need to set the SDK path in case it could not pick the path for SDK.

How to set SDK path or How to find SDK location.?  

Your SDK location will be in

 Windows:- C:/user/<your system name>/AppData/Local/Android
Linux:- /home/AccountName/Android/Sdk
Mac:- /Library/Android/Sdk
  •  Ctrl+Alt+S 
  •  File->Setting  
  • Tools->Sdk Manager



I hope that help and worked  :)

-Kapil Arora-






How to click on the link in cmd.? How to click on link to verify Firebase CLI Login.?

Hey,

Once the same problem was with me..

I was deploying my project to firebase and it sends me the link to verify. But I was not able to click the link. After searching a bit I got this.

Follow these simple step

1. Search cmd

2. Right click on command prompt

3. Select run as administrator

4. Now you can start your work and you will be able to click any link and functional things here.

Hope that helps.

Thank you