Sharecodepoint App Download Qrcode Sharecodepoint Android App Banner
Now You can search anything in sharecodepoint using your voice. Click on mic button. Sharecodepoint Voice Sharecodepoint Youtube Channel



Sharecodepoint popular queries
Search results for Android App
Showing posts with label Android App. Show all posts

Saturday, 2 June 2018

How to add admob ads in android app - Mobile app monetization the smart way

AdMob helps app developers monetize their mobile apps by showing ads in their mobile apps. - Admob. How to generate Ads for Android apps ...
AdMob helps app developers monetize their mobile apps by showing ads in their mobile apps. - Admob.

How to generate Ads for Android apps !

How to monetize your android application using AdMob.

AdMob is a mobile ad network from google.

In this tutorial i will show you how to place AdMob simple banner ad in your android application.

What is Admob ?
adMob can be used for Android and iOS apps... Full Details


Step 1 : Add complie line to build.gradle
Go to > build.gradle (Module: app) 
compile 'com.google.firebase:firebase-ads:10.0.1' 

compile 'com.google.android.gms:play-services-ads:10.0.1'


Step 2 : Add string to string.xml
Even resource part-system glitch.
<string name="banner_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string>

Step 3 : Add xmlns to main_activity.xml
xmlns:ads="http://schemas.android.com/apk/res-auto"
<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    ads:adSize="BANNER"
    ads:adUnitId="ca-app-pub-3940256099942544/6300978111" >
    </com.google.android.gms.ads.AdView>

Step 4 : Import class into MainActivity.java
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;

AdView adView = (AdView) findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder()
                .setRequestAgent("android_studio:ad_template").build();
        adView.loadAd(adRequest);

Step 5 : Add user permission to AndroidMainfest.xml
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

That's it! To place AdMob simple banner ad in your android application. Thanks for reading!

 If you have any doubt regarding the tutorial then leave your doubts in the comment box.

Sunday, 19 November 2017

Make login page android app using android studio with validation : Part 1

This tutorial in on how to make login page android app using android studio with validation. Login Page project is an android app is ...
This tutorial in on how to make login page android app using android studio with validation.

Login Page project is an android app is implemented in android studio. You can download login page android app with source code.

How to import the project :
Create new project . You just need to copy the code then paste that code into your project.Create new project . You just need to copy the code then paste that code into your project.

Login Information : 
Username : sy@scp.com
Password : abc@123

LoginPage android app features :
  • Add all validation : like 
    • username & password incorrect.
    •  username & password blank error and more.
  • Clear focus
  • Reset Fields
Step 1:
Firstly import the package of android files.
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
Step 2 :
First we want to create a login page layout. Add 2 EditText  (one is for take username from user & second is use to take the password from the user.) , 2 Button (one is login button & second is reset button) and 1 TextView (show the error status).
activity_main.xml
<?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"
    android:padding="10dp"
    tools:context="com.sharecodepoint.loginpage.MainActivity">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Email Address"
        android:id="@+id/username"
        android:layout_marginTop="20dp"
        android:textSize="17dp"
        android:inputType="textEmailAddress"
        android:padding="10dp"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Password"
        android:id="@+id/password"
        android:textSize="17dp"
        android:inputType="textPassword"
        android:padding="10dp"
        android:layout_below="@id/username"
        android:layout_marginTop="20dp"/>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/login"
        android:text="Login"
        android:layout_below="@id/password"
        android:layout_marginTop="20dp"
        android:background="#009688"
        android:textColor="#f5f5f5"
        android:textSize="17dp"
        android:onClick="dothis"
        />

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/reset"
        android:text="Reset"
        android:layout_below="@id/login"
        android:layout_marginTop="20dp"
        android:background="#AD1457"
        android:textColor="#f5f5f5"
        android:textSize="17dp"
        android:onClick="dorest"
        />
    
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/reset"
        android:layout_marginTop="40dp"
        android:id="@+id/showerror"
        android:textSize="20dp"
        android:padding="10dp"
        android:textAlignment="center"
        android:textColor="#f5f5f5"/>
</RelativeLayout>

Step 3 :
In this code you get :
1. How to clear focus from EditText.
2. How to change the background color of TextView with color string.
3. How to set Visibility of TextView (INVISIBLE & VISIBLE).
4. How to use if else in android.
5. How to compare the string value in android.
6. How to use not operator in android.
7. How to change the main activity title when login is successfully.

MainActivity.java
public class MainActivity extends AppCompatActivity {

    EditText user, pass;
    Button btn,rest;
    TextView error;

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

        user = (EditText) findViewById(R.id.username);
        pass = (EditText) findViewById(R.id.password);
        btn = (Button) findViewById(R.id.login);
        rest = (Button) findViewById(R.id.reset);
        error = (TextView)findViewById(R.id.showerror);
        error.setVisibility(View.INVISIBLE);
    }

    public void dothis(View v) {
        String u = user.getText().toString();
        String p = pass.getText().toString();
        String check_email = "sy@scp.com";
        String check_pass = "abc@123";

        if (u.equals("")) {
            error.setVisibility(View.VISIBLE);
            error.setBackgroundColor(Color.parseColor("#D50000"));
            error.setText("Please enter your email");

        } 
        else if (p.equals("")) {
            error.setVisibility(View.VISIBLE);
            error.setBackgroundColor(Color.parseColor("#D50000"));
            error.setText("Please enter your password");
            pass.onEditorAction(EditorInfo.IME_ACTION_DONE);

        }
        else if (!u.equals(check_email) && !p.equals(check_pass)) {
            error.setVisibility(View.VISIBLE);
            error.setBackgroundColor(Color.parseColor("#D50000"));
            error.setText("Invalid Email or Invalid Password");
            user.onEditorAction(EditorInfo.IME_ACTION_DONE);
            pass.onEditorAction(EditorInfo.IME_ACTION_DONE);
        }
        else if (!u.equals(check_email)) {
            error.setVisibility(View.VISIBLE);
            error.setText("Invalid Email");
            error.setBackgroundColor(Color.parseColor("#D50000"));
        }
        else if (!p.equals(check_pass)) {
            error.setVisibility(View.VISIBLE);
            error.setBackgroundColor(Color.parseColor("#D50000"));
            error.setText("Invalid Password");
            pass.onEditorAction(EditorInfo.IME_ACTION_DONE);
        }
        else if (u.equals(check_email) && p.equals(check_pass)) {
            error.setVisibility(View.VISIBLE);
            error.setBackgroundColor(Color.parseColor("#D50000"));
            error.setText("Login Successfully !!");
            error.setBackgroundColor(Color.parseColor("#00C853"));
            pass.onEditorAction(EditorInfo.IME_ACTION_DONE);
            setTitle("Welcome: " + u);
        }
    }
    public  void dorest(View v){
        user.setText("");
        pass.setText("");
        pass.clearFocus();
    }
}

Output : 




That's it! Download apk files. Thanks for reading!

If you have any doubt regarding the creation of android app then leave your doubts in the comment box.

How to create simple notepad  in android: check out

 Animated Bouncing Balls Using HTML and CSS3

Friday, 3 November 2017

How to create simple notepad android app using android studio

This tutorial in on how to create a simple (notepoint) notepad android  app using android studio. A simple notepad that support Select All/...
This tutorial in on how to create a simple (notepoint) notepad android  app using android studio. A simple notepad that support Select All/ Copy/ Font size/  Font style and New document. Missing functions & features coming next version.

Notepoint project is a android app is implemented in android studio. You can download notepoint android app with source code.

How to import the project : 
Create new project . You just need to copy the code then paste that code into your project.
Notepoint android app features :
  • Menu bar for style, edit, format and view
  • Edit text with copy function with toast.
  • Format texts with changing the font size.
  • To create a new document.txt file.

Step 1: 
Firstly import the package of android files.
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;
import android.graphics.Typeface;
 
Step 2:
First we want to create a notepoint layout. Add 6 buttons for operations (like : bold, italic, normal, copy and more). Add 1 MultiAutoCompleteTextView Or EditText.

activity_main.xml
<Button
    android:layout_width="40dp"
    android:layout_height="wrap_content"
    android:text="B"
    android:textStyle="bold"
    android:id="@+id/boldtext"
    android:onClick="onClick()"
    />
    <Button
        android:layout_width="40dp"
        android:layout_height="wrap_content"
        android:textStyle="italic"
        android:layout_toRightOf="@+id/boldtext"
        android:text="I"
        android:id="@+id/italictext"
        android:onClick="onClick"
        />
    <Button
        android:layout_width="40dp"
        android:layout_height="wrap_content"
        android:textStyle="normal"
        android:text="N"
        android:layout_toRightOf="@+id/italictext"
        android:id="@+id/normaltext"
        android:onClick="onClick"
        />
    <Button
        android:layout_height="wrap_content"
        android:text="Size"
        android:layout_width="wrap_content"
        android:id="@+id/fontsize"
        android:layout_toRightOf="@+id/normaltext"
        />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Copy"
        android:id="@+id/copytext"
        android:layout_toRightOf="@+id/fontsize"
        />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="new"
        android:layout_toRightOf="@+id/copytext"
        android:id="@+id/newdoc"
        />
 
      <MultiAutoCompleteTextView
        android:id="@+id/mainpart"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:ems="100"
        android:gravity="top|left"
          android:padding="10dp"
        android:inputType="textMultiLine"
        android:hint="Welcome to Notepoint"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
          android:layout_below="@+id/boldtext"
          android:background="@color/editbordercolor"/>
 
 
For each operation, we created a ActionListner and give the appropriate for each.

Step 3: 
In this code you get following :
1. How to change the text color in android studio.
2. How to change the text font size in android studio.
3. How to show the message in Toast.
4. How to create contextmenu in android studio and more.

MainActivity.java
import android.content.res.TypedArray;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.*;
import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;
import android.graphics.Typeface;
import  android.widget.PopupMenu;
 
public class MainActivity extends AppCompatActivity implements OnClickListener {
 
    MultiAutoCompleteTextView mainview;
    String copydata;
    Button btn_bold,btn_italic,btn_normal,btn_size,btn_copydata,btn_new,btn_save;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        btn_bold = (Button) findViewById(R.id.boldtext);
        btn_italic =(Button) findViewById(R.id.italictext);
        btn_normal =(Button) findViewById(R.id.normaltext);
        btn_size =(Button) findViewById(R.id.fontsize);
        btn_copydata =(Button) findViewById(R.id.copytext);
        btn_new =(Button) findViewById(R.id.newdoc);
 
 
        mainview = (MultiAutoCompleteTextView) findViewById(R.id.mainpart);
 
        btn_bold.setOnClickListener(this);
        btn_italic.setOnClickListener(this);
        btn_normal.setOnClickListener(this);
        btn_size.setOnClickListener(this);
        btn_new.setOnClickListener(this);
        btn_copydata.setOnClickListener(this);
 
        registerForContextMenu(btn_size);
    }
    public  void onClick(View view) {
        if (view == btn_bold) {
            Typeface setfontstyle = Typeface.defaultFromStyle(Typeface.BOLD);
            mainview.setTypeface(setfontstyle);
            Toast.makeText(getApplicationContext(), "Bold", Toast.LENGTH_LONG).show();
        } else if (view == btn_italic) {
                Typeface setfontstyle = Typeface.defaultFromStyle(Typeface.ITALIC);
                mainview.setTypeface(setfontstyle);
            Toast.makeText(getApplicationContext(), "Italic", Toast.LENGTH_LONG).show();
        } else if (view == btn_normal) {
            Typeface setfontstyle = Typeface.defaultFromStyle(Typeface.NORMAL);
            mainview.setTypeface(setfontstyle);
            Toast.makeText(getApplicationContext(), "Normal", Toast.LENGTH_LONG).show();
        }
        else if (view == btn_size) {
            view.showContextMenu();
            Toast.makeText(getApplicationContext(), "Font Size", Toast.LENGTH_LONG).show();
        }
        else if(view == btn_new)
        {
            String appnametitle ="Notepoint";
            setTitle(appnametitle+" - New Document.txt");
            mainview.setText("");
            mainview.setHint("New Document");
            mainview.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
            Toast.makeText(getApplicationContext(), "New Document", Toast.LENGTH_LONG).show();
        }
        else if(view == btn_copydata)
        {
 
 
            copydata = mainview.getText().toString();
                copydata = mainview.getText().toString();
                Toast.makeText(getApplicationContext(), "Copied Successfully !!", Toast.LENGTH_LONG).show();
 
        }
    }
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
    {
        super.onCreateContextMenu(menu, v, menuInfo);
 
        menu.setHeaderTitle("Select Font Size");
        menu.add(0, v.getId(), 0, "5+");
        menu.add(0, v.getId(), 0, "10+");
        menu.add(0, v.getId(), 0, "20+");
        menu.add(0, v.getId(), 0, "25+");
        menu.add(0, v.getId(), 0, "30+");
        menu.add(0, v.getId(), 0, "35+");
        menu.add(0, v.getId(), 0, "40+");
        menu.add(0, v.getId(), 0, "45+");
        menu.add(0, v.getId(), 0, "50");
    }
    @Override
    public boolean onContextItemSelected(MenuItem item){
 
            if (item.getTitle() == "5+") {
                mainview.setTextSize(TypedValue.COMPLEX_UNIT_SP, 8);
            } else if (item.getTitle() == "10+") {
                mainview.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
            } else if (item.getTitle() == "20+") {
                mainview.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
            } else if (item.getTitle() == "25+") {
                mainview.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24);
            } else if (item.getTitle() == "30+") {
                mainview.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
            } else if (item.getTitle() == "35+") {
                mainview.setTextSize(TypedValue.COMPLEX_UNIT_SP, 33);
            } else if (item.getTitle() == "40+") {
                mainview.setTextSize(TypedValue.COMPLEX_UNIT_SP, 43);
            } else if (item.getTitle() == "45+") {
                mainview.setTextSize(TypedValue.COMPLEX_UNIT_SP, 48);
            } else if (item.getTitle() == "50") {
                mainview.setTextSize(TypedValue.COMPLEX_UNIT_SP, 50);
            } else {
                Toast.makeText(getApplicationContext(), "Something is Worng", Toast.LENGTH_LONG).show();
            }
        return true;
    }
} 
 
Step 4:
How to change line color in ( EditText and MultiAutoCompleteTextView ).
Add one xml file in you project. Give any name what you want.

bordercolor.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <solid android:color="#ffffff" />
    <stroke android:width="1dip" android:color="#ffffff" />
</selector>
That's it! Download the files. Thanks for reading!

Video : create simple notepad android app

If you have any doubt regarding the creation of android app then leave your doubts in the comment box.

How to create notepad in java : check out

 

Version 23.2.3.4 - 2016 - 2019 - © Sharecodepoint | Made in India. | Copyright Content