Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Friday, 16 October 2015

How to set only Numeric password restriction From user Into android app

Numeric password restriction means set automatic restriction so application user cannot enter alphabets, special characters as password. There are a automatic limitation applied on application's EditText box so user are unable to set alphabetic characters, special characters as passwords. It will allow the application to only open numeric keypad .

Setting up only numeric password enter restriction on android application.


Code for activity_main.xml file .

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.tutorials2make.getnumericpasswordandroidapp.MainActivity" >

    <EditText
        android:id="@+id/PasswordRestriction"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="50dp"
        android:ems="10"
        android:inputType="numberPassword" >

        <requestFocus />
    </EditText>

    <Button
        android:id="@+id/GetOnlyNumericPassword"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="Get Only Numeric Password" />

</RelativeLayout>

Code for MainActivity.java programming file .

package com.tutorials2make.getnumericpasswordandroidapp;

import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;


public class MainActivity extends Activity {
Editable HoldNumericPassword;
Button GetNumericPassword;
EditText GetNumericPasswordinAndroid;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        GetNumericPassword = (Button)findViewById(R.id.GetOnlyNumericPassword);
        GetNumericPasswordinAndroid = (EditText)findViewById(R.id.PasswordRestriction);
        
        GetNumericPassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
HoldNumericPassword = GetNumericPasswordinAndroid.getText();
Toast.makeText(MainActivity.this, HoldNumericPassword, Toast.LENGTH_LONG).show();
}
});
    }
}



How to get Alphabetic, Numeric, Special Symbol password from user in Android Application

On android applications EditText box is applied to demand text from user, text can be any type of

Alphabetic ( A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z )
Numeric ( 0,1,2,3,4,5,6,7,8,9 )
Special symbols ( ! @ # $ % ^ & * ( ) _ + { } " : ? > < | ) .

 EditText box also used to get password from user into android application. Because password is very protective thing and when you enter your password in some one's front you don't want to recognize them your password so android EditText gives us an attribute property to take password from user into android application with showing * ( Star ) symbol every time key enters a password.

How to get Alphabet + Numeric + Special symbol as password in android app using EditText.

Code for MainActivity.java file .


package com.tutorials2make.edittextgetpassword;

import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;


public class MainActivity extends Activity {

Editable getPassword;
Button GetTextPassword;
EditText EntertextPassword;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        GetTextPassword = (Button)findViewById(R.id.get_password_in_android);
        EntertextPassword = (EditText)findViewById(R.id.EnterPasswordBoxInAndroid);
        
        GetTextPassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getPassword = EntertextPassword.getText();
Toast.makeText(MainActivity.this, getPassword,Toast.LENGTH_SHORT).show();
}
});
    }

}

Code for activity_main.xml file .

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.tutorials2make.edittextgetpassword.MainActivity" >

    <EditText
        android:id="@+id/EnterPasswordBoxInAndroid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="83dp"
        android:ems="10"
        android:inputType="textPassword" >

        <requestFocus />
    </EditText>

    <Button
        android:id="@+id/get_password_in_android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="Click Here to obtain Password form application user" />

</RelativeLayout>



Sunday, 11 October 2015

How to get EditText box entered value on android application

EditText box entered value is accessible by getText() function. This function is used with combination of EditText box id assign variable. After get EditText box value i am showing this selected value on Toast message through button click event.

Code for MainActivity.java file .

package com.example.getenterededittextboxvalue;
import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;


public class MainActivity extends Activity {

    EditText GetvalueBox;
    Button AccessButton;
    Editable HoldValue;
    
@Override   
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        GetvalueBox = (EditText)findViewById(R.id.editText1);
        AccessButton = (Button)findViewById(R.id.access_value);
        
        AccessButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
HoldValue = GetvalueBox.getText();
Toast.makeText(MainActivity.this, HoldValue, Toast.LENGTH_SHORT).show();
}
});
        
    }

}

Code for activity_main.xml file .

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.getenterededittextboxvalue.MainActivity" >

     <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="47dp"
        android:ems="10"
        android:inputType="textPersonName" >

       
    </EditText>

    <Button
        android:id="@+id/access_value"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/editText1"
        android:layout_below="@+id/editText1"
        android:layout_marginTop="45dp"
        android:text="Access EditText Box value" />

</RelativeLayout>



Android EditText person name example tutorial

What is EditText .

EditText view is used to obtain text from user into android application. Its equal as text boxes present in web applications like forms. With the use of Multiple EditText boxes into single application you can make a entry submission form. This is the single line edit text box commonly applied to enter single line person name.

activity_main.xml file .

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.Tutorials2Make.edittext.MainActivity" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="47dp"
        android:ems="10"
        android:inputType="textPersonName" >

        <requestFocus />
    </EditText>

</RelativeLayout>

MainActivity.java programming file

package com.Tutorials2Make.edittext;

import android.support.v7.app.ActionBarActivity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;


@SuppressLint("NewApi") public class MainActivity extends ActionBarActivity {

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


Tuesday, 6 October 2015

Android Simple TextView example tutorial

Android TextView tag is applied to display user generated text on android applications. TextView tag is the most common generic tag to develop static android apps. TextView tag also gives the facility to change the text bye application developer. TextView dose not function single there are some of it's attributes to provide TextView ground support.

Textview tag is already written in blank activity application therefore each & every time you have create a new application project using Android Studio or Eclipse the textView tag is already written there in activity_main.xml file.

Android Plain TextView example including tutorial.

This below tag code is TextView tag with width, height and text attributes.

<TextView
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="This the text view text box." />



Note : When you create textview tag in android application then you don't have to define any external code in MainActivity.java programming file to display text box. if you write TextView tag in activity_main.xml layout file then it will be automatically called and show text on app screen.

activity_main.xml file 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.tutorials2make.androidplaintext.MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="This the text view text box." />

</RelativeLayout>

Source code for MainActivity.java file

package com.tutorials2make.androidplaintext;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;


public class MainActivity extends ActionBarActivity {

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

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

Saturday, 3 October 2015

How to start fresh Android project using Eclipse

Eclipse is the extremely used IDE for android development purpose.Eclipse is also an alternative of Android studio because android studio must needs 2GB ram and works perfectly on 4GB of ram however eclipse dose not required 4GB ram. So eclipse ide is also an choice for low configuration older computer systems. Because every one on the earth cannot afford high performance costly computer to start their career as android developer. So if you have lower configuration pc then you don't need to be worry because eclipse is here. In this tutorial i am exposing you to start your first android application project via Eclipse Juno IDE.

Step by step setting up Eclipse IDE for android app development.

Before start making apps via eclipse you need to stabilize eclipse ide platform to android app development platform. So follow the below steps very carefully.

1. Download Eclipse.


3. After done all procedure your Eclipse is ready to develop android apps. Now click on File > New > Android Application project.


4. Enter application name, Project name, Package name other settings leave same.


5. Renounce all the options same.


6. Configure launcher icon ( Launcher icon is the app launching icon shows on the mobile phone menu ). If you do not have the icon at app configuration time so you can also replace icon after all this process form eclipse project window.


7. Create activity, if this is your first application project on eclipse then select blank activity.


8. Set the activity name and layout name then click on Finish button.


Now enjoy app developing with Eclipse.

Friday, 2 October 2015

Things need to know Before start android app development

Android is one of the largest selling mobile operating system all over the globe. Android is an mobile os so its offers thousands of mobile applications through Google play store. You can download free apps like Mobile gaming applications, other utility apps. Android apps covered more than 60% mobile gaming market all over the earth, So seeing future as an android mobile app developer is nice. There are lot's of online institutes providing online app learning facility. Therefore i am giving a little introduction about how to start your own online android app designing & development.

Why Android app development is extremely superior then others..?

Opportunity :
If you are looking in order to start your own online development career then i preferred  you to pick android application development as your future career because there are so much possibilities inside it. Android is growing all over the world covering up thousands of mobile devices, tablets, wearable devices, TV's even cars. Supposing you can create one working usable android app that will be run on every android device without adding extra coding, Therefore your application will be device friendly. 

Platform friendly :
Android supports platform friendly development because single application can run though all device platform there is no need to design unique app for each & every device.

Free development Tools :
Android is free mobile phone operating system so its development tools also freely available on Google developers. You can get Android studio + SDK manger. 

Also read: 

Brief introduction about android files, Most usable assignment functions, Variables, Launcher icon, Activity, .xml layout files, String file.


This above is the programmatic folder structure for of android application.

Android development objective Files :

  1. MainActivity.java programming file - MainActivity.java programming file is the extreme part of android application development because all the application beginning to finish core programming is written on this file. You can add more programming files but this is the main file, all other files function, classes would call from this file.
  2. Activity_main.xml file - Activity_main.xml file is layout file. Layout file represents all the layout blue print of application including designing part like setting up text box, check box, images, videos...etc.
  3. Strings.xml file - Strings.xml file contains all the string values that can be used in applications, you can define any custom string character value on here and call anywhere in program.
  4. AndroidManifest.xml file - AndroidManifest.xml file restrain application package name, android minimum sdk version, android target sdk version, app icon path, permissions etc.