Month: September 2017

What is IONIC :

It is an open source platform to make hybrid application. Hybrid applications are those who takes single language to make an app and which will run on all types of mobile devices. Some clients prefer to make hybrid application because of cost. And small applications are easy to go with hybrid.

How Start with IONIC

  • First Install Node.js package into machine.

https://nodejs.org/en/download/

  • Install IONIC, Open command prompt or terminal and use below command

npm install -g ionic cordova

  • After successfully installed, Create new app. For that, from same command prompt or terminal go to folder location where you want to create project. And run below command

ionic start app_name

After this it will ask for project type like, blank, tab, tutorial etc.

Select your option using down and up arrow keys and press Enter.

It will again take some time and will create project into that location.

  • Now Check newly created app on browser by running below command.

ionic serve

It will run project on browser with full screen. And If you want to run project like mobile device interface then       

run below command

ionic serve –lab

It will open project into mobile interface screen with ios, android and windows.

  • Now you can check project structure from project location. You will get

Config.xml : Here if you need any plugin to be install then you can add. Or any  hardware setting should be go here.

Resources : We need to add all resources inside this folder.

Src       : Our all functionality will go from this folder. You can find various folders inside it. Check those you will get an idea what it does.

  • Now try to create new views.

ionic g page page_title

It will generate all necessary files into “page_title” folder like its model, view and controller

But to access it you need to import file into “app.component.ts” and “app.module.ts”. After checking  those files you will come to know where to change.

  • Now you can edit those view as per your requirement.
  • Run your app on android device

ionic cordova run android –device

But make sure you have enable USB debugging and Developer Mode on your android device

  • To make production build, you need to run below command

ionic cordova run android –prod –release
# or
ionic cordova build android –prod –release

  • In this way you can successfully create your first app in ionic

 

If you feel this blog is really helpful for you then do comment. Thank you.

 

 

Read More Beginning with IONIC 2

Mobile Development

PHP Web Development wordPress

     Objective : The main purpose of this post   to learn facebook integrate in swift      OUTPUT  : If  I Integrate Facebook In My Application Then I will Get…

Read More Facebook Integration using Swift

iPhone

The Model-View-Controller (MVC) is an architectural design pattern that seperates an application in three components : first is Model, second is View, third is Controller.

Here is the flow-diagram of MVC :-

 

MVC-basic.svg

 

Diagram shows the single flow layout of data, how it is passed between each components, and show the relationship between each component works.

Model

The Model component corresponds to all the data-related logic that the user works with.The Model is the name given to the permanent storage of the data used in the overall design.

Model represents shape of the data and business logic. It maintains the data of the application. Model objects retrieve and store model state in a database.

One important aspect of the Model is that it’s technically “blind” – that means the model has no connection or knowledge of what happens to the data when it is passed to the View or Controller components.

Model is a data and business logic.

View

View display data using model to the user and also enables them to modify the data.

The View component is used for all the UI logic of the application

The View is where data, requested from the Model, is viewed and its final output is determined.

In web apps built using MVC, the View is the part of the system where the HTML is generated and displayed.

View is a user interface.

Controller

Controller act as an interface between Model and view components to precess all the incoming requests.

It handles the users request.User interact with View, which in-tern raises appropriate URL request, this request will be handled by a controller.

Controller is a request handler.

Read More What is MVC ?

PHP Web Development

Dialog box is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the full-screen and is normally used for modal events that require users to take an action before they can proceed.

And a Custom-dialog-box is same as dialog-box only difference is that in custom dialog-box you design dialog-box  on  your requirement. For Example- create dialog-box to enter four digit OTP number  in Which  you  take  four edit Text  with  equal distance to enter password and take one  “submit “ button.

 To create Custom-dialog-box follows step-by-step:

i)First create a new project in android studio and design layout for dialogBox.

 Android Layout File:

XML file, for custom  dialog.

File : res/layout/custom_dialog.xml

To, design layout you set  accordingly  margin,padding-left,right,top and bottom,height and width etc.

<LinearLayout

android:id=“@+id/layout_header”
android:layout_width=“match_parent”
android:layout_height=“44sp”
android:background=“@color/light_green”>

<TextView
android:layout_width=“match_parent”
android:layout_height=“44sp”
android:gravity=“center”
android:text=“Enter One Time Password”
android:textColor=“@color/white”
android:textSize=“@dimen/dm_20sp” />

</LinearLayout>
<LinearLayout
android:id=“@+id/layout_otp”
android:layout_width=“match_parent”
android:layout_height=“@dimen/dm_90sp”
android:layout_below=“@+id/layout_header”
android:orientation=“horizontal”>

<EditText
android:id=“@+id/editTextone”
android:layout_width=“@dimen/dm_40sp”
android:layout_height=“@dimen/dm_42sp”
android:inputType=“numberPassword”
android:maxLength=“1”
android:nextFocusRight=“@+id/editText_two”>

<requestFocus />
</EditText>

<EditText
android:id=“@+id/editTexttwo”
android:layout_width=“@dimen/dm_40sp”
android:layout_height=“@dimen/dm_42sp”
android:inputType=“numberPassword”
android:maxLength=“1”/>

<EditText
android:id=“@+id/editTextthree”
android:layout_width=“@dimen/dm_40sp”
android:layout_height=“@dimen/dm_42sp”
android:inputType=“numberPassword”
android:maxLength=“1”/>

<EditText
android:id=“@+id/editTextfour”
android:layout_width=“@dimen/dm_40sp”
android:layout_height=“@dimen/dm_42sp”
android:inputType=“numberPassword”
android:maxLength=“1”/>

</LinearLayout>

<Button
android:layout_width=“match_parent”
android:layout_height=“@dimen/dm_42sp”
android:layout_below=“@+id/layout_otp”
android:text=“SUBMIT” />

ii) In Activity

First create Custom_DialogBox.java class and write the code below

File : Custom_DialogBox.java

First  use changedListener in  onCreate  method:

 editText_one.addTextChangedListener(this);
editText_two.addTextChangedListener(this);
editText_three.addTextChangedListener(this);
editText_four.addTextChangedListener(this); 

And final class of  “Custom_DialogBox.java ”  :-

public class Custom_dialogbox extends Dialog implements TextWatcher

 And then Create automatically override method for TextWatcher. 

@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}

To enter only one value to edit Text and cursor move on next edit Text automatically and when we want to remove password one by one sequencially in which cursor move back automatically,to write the cobe below on this method: 

@Override
public void afterTextChanged(Editable editable) {if (editable.length() == 1) {
if (editText_one.length() == 1) {
editText_two.requestFocus();
}

if (editText_two.length() == 1) {
editText_three.requestFocus();
}
if (editText_three.length() == 1) {
editText_four.requestFocus();
}
} else if (editable.length() == 0) {
if (editText_four.length() == 0) {
editText_three.requestFocus();
}
if (editText_three.length() == 0) {
editText_two.requestFocus();
}
if (editText_two.length() == 0) {
editText_one.requestFocus();
}
}

 After you add this Custom_DialogBox.java class in your MainActivity.java

Custom_DialogBox custom_dialog = new Custom_DialogBox(this);
custom_dialog.show();

 Follow the above steps and see a custom-dialog-box accurately.

Read More Steps To Create a Custom-Dialog-Box to Enter Four Digit OTP Number in Android

Android