Concept of Multithreading : Android Training in Chandigarh

Discussing Multi-threading with android training in Chandigarh

android training institute in chandigarh

Let us discuss about Multi-threading with android Training in Chandigarh.

Multi-threading is an applied constructed programming idea where a program (process) is partitioned 
into at least two subprograms (process), which can be executed in the meantime in parallel. A multi 
threaded program contains at least two sections that can run simultaneously. Some portion of such a
 program is known as a string, and each string characterizes a different way of execution.A procedure
 comprises of the memory space distributed by the working framework that can contain at least one 
strings. A string can't exist without anyone else; it must be a piece of a procedure.
There are two particular kinds of Multitasking i.e. Processor-Based and Thread-Based multitasking.

Q: What is the contrast between string based and process-based multitasking?

Ans: As both are sorts of multitasking there is extremely essential contrast between the two.
Process-Based multitasking is an element that enables your PC to run at least two programs simultaneously. 
For instance you can tune in to music and in the meantime talk with your companions on Face-book 
utilizing program. In Thread-based multitasking, string is the littlest
unit of code, which implies a solitary program can perform at least two assignments at the same time.
 For instance a word processor can print and in the meantime you can alter content gave that those two 
 are perform by separate strings.

Q: Why multitasking string requires less overhead than multitasking processor?

Ans: A multitasking string requires less overhead than multitasking processor in light of the
following reasons:

Procedures are heavyweight assignments where strings are lightweight

Procedures require their own particular separate address space where strings share the address
 space

Interprocess correspondence is costly and constrained where Inter thread correspondence is
 economical, and setting changing starting with one string then onto the next is bring down in cost.

Advantages of Multi-threading

1. Empowers developers to do various things at one time
2



2. Software engineers can separate a long program into strings and execute them in parallel

which in the end expands the speed of the program execution

3. Enhanced execution and simultaneousness

4. Concurrent access to various applications

Life Cycle of Thread

A string can be in any of the five after states

1. Infant State: When a string object is made another string is conceived and said to be

in Newborn state.

2. Runnable State: If a string is in this state it implies that the string is prepared for

execution and sitting tight for the accessibility of the processor. In the event that all strings in line are of

same need then they are given schedule openings for execution in round robin form

3. Running State: It implies that the processor has given its opportunity to the string for

execution. A string continues running until the point that the accompanying conditions happens

a. String surrender its control alone and it can occur in the accompanying

circumstances

I. A string gets suspended utilizing suspend() strategy which must be

resuscitated with continue() strategy

ii. A string is made to rest for a predefined time-frame utilizing

sleep(time) strategy, where time in milliseconds

iii. A string is made to sit tight for some occasion to happen utilizing hold up () strategy.

For this situation a string can be planned to run again utilizing inform ()

strategy.

b. A string is pr-empted by a higher need string

4. Blocked State: If a string is kept from going into runnable state and

in this way running state, at that point a string is said to be in Blocked state.

5. Dead State: A runnable string enters the Dead or ended state when it finishes

its undertaking or generally ends.



Fig: Life Cycle of Thread

Principle Thread

Each time a Java program begins up, one string starts running which is called as the fundamental

string of the program since the one is executed when your program starts.

Tyke strings are delivered from primary string

Regularly it is the last string to complete execution as it performs different close down

activities

Making a Thread

Java characterizes two manners by which this can be expert:

  1. You can actualize the Runnable interface.

  1. You can expand the Thread class, itself.

  1. Make Thread by Implementing Runnable

The most effortless approach to make a string is to make a class that executes the Runnable
 interface.

To execute Runnable, a class require just actualize a solitary strategy called run( ), which is

announced this way:

open void run( )


You will characterize the code that constitutes the new string inside run() strategy. It is vital
to comprehend that run() can call different strategies, utilize different classes, and proclaim factors, '
just like the principle string can.

After you make a class that actualizes Runnable, you will instantiate a protest of sort. String from
 inside that class. String characterizes a few constructors. The one that we will utilize is appeared
 here:

Thread(Runnable threadOb, String threadName);
Here threadOb is a case of a class that actualizes the Runnable interface and the name
of the new string is indicated by threadName. After the new string is made, it won't begin
running until the point when you call its begin( ) technique, which is pronounced inside Thread. The
 begin( ) technique is appeared here:

void begin( );

Case to Create a Thread utilizing Runnable Interface

Yield: Make Thread by Extending Thread The second method to make a string is to make another 
class that expands Thread, and after that to make a case of that class. The expanding class must 
abrogate the run( ) techniques.
CBitss Technologies is providing android training in Chandigarh. CBitss Technologies provides
 real-time and placement focused android training in Chandigarh. Our Android training course includes
 basic to advanced level and our android certification course is designed to get the placement in good
 MNC companies in Chandigarh as quickly as once you complete the Android certification training ..

To learn More concepts
Visit Once @
CBitss Technologies
SCO 23-24-25, level 3, sector 34 A
Chandigarh, 160022
Phone: 9988741983

Android XML Parser : Android Training in Chandigarh

Android - XML Parser 

android training in chandigarh 

XML stands for Extensible Markup Language.XML is a very famous arrangement and generally used for allocation information on the

 internet. This chapter analyze how to parse the XML file and quotation necessary advice from it. Android afford three types of XML

 parsers which are DOM,SAX and XMLPullParser. Surrounded by all of them android advocate XMLPullParser because it is active

 and easy to use. So we are functioning to use XMLPullParser for parsing XML.

The first step is to analyze the garden in the XML data in which you are absorbed in. For example. In the XML given below we absorbed 
 in getting condition only.

<?xml version="1.0"?>
<current>
  
  <city id="2643743" name="London">
     <coord lon="-0.12574" lat="51.50853"/>
     <country>GB</country>
     <sun rise="2013-10-08T06:13:56" set="2013-10-08T17:21:45"/>
  </city>
  
  <temperature value="289.54" min="289.15" max="290.15" unit="kelvin"/>
  <humidity value="77" unit="%"/>
  <pressure value="1025" unit="hPa"/>
</current>

XML - Elements

An xml file contains of many ingredients. Here is the table decide the components of an XML file and their confession.

Prolog
An XML file kick off with a prolog. The first line that accomodate the information about a file is prolog

Text
Apart from tags and events, and xml file also contains simple text. Similar as GB is a text in the country tag.

Attributes
Attributes are the additional properties of a tag such as value e.t.c

Events
An XML file has many actions. Event could be like this. Document starts , Document ends, Tag start , Tag end and Text e.t.c

Learn all the XML related concepts with android training in Chandigarh. Now, Let us discuss about the XML - Parsing.




XML - Parsing
XMLPullParser object in procedure to constitute that we will first create XmlPullParserFactory object and then call its
 newPullParser() method to build XMLPullParser. Its syntax is given below −

private XmlPullParserFactory xmlFactoryObject = XmlPullParserFactory.newInstance();
private XmlPullParser myparser = xmlFactoryObject.newPullParser();

The next step affect  determine the file for XmlPullParser that contains XML. It could be a case or could be a current.
 In our case it is a stream.Its syntax is given below −

myparser.setInput(stream, null);

The last step is to parse the XML. An XML file get along of accident, Name, Text, AttributesValue e.t.c. So XMLPullParser
 has a disparts function for define each of the basic of XML file.
Here we have given the syntax below:-

int event = myParser.getEventType();
while (event != XmlPullParser.END_DOCUMENT)  {
  String name=myParser.getName();
  switch (event){
     case XmlPullParser.START_TAG:
     break;
     
     case XmlPullParser.END_TAG:
     if(name.equals("temperature")){
        temperature = myParser.getAttributeValue(null,"value");
     }
     break;
  }       
  event = myParser.next();                    
}


The method getEventType appearance the type of causality that happens. e.g: Document start , tag start e.t.c. 
The method getName arrival the name of the tag and after all we are only interested in temperature , so we just
 check in limited allegation that if we got a climate tag , we call the approach getAttributeValue to arrival us 
the value of temperature tag.
Apart from the these approach, there are other ways to provide the class for improved parsing XML files. 
 Other methods are listed below −

getAttributeCount()
This method just arrival the number of attributes of the current start tag

getAttributeName(int index)
This method returns the name of the aspect described by the index value

getColumnNumber()
This method returns the Returns the current column number, starting from 0.

getDepth()
This method returns Returns the current depth of the element.

getLineNumber()
Returns the current line number, starting from 1.

getNamespace()
This method returns the namespace URI of the modern element.

getPrefix()
This method returns the prefix of the current element

getName()
This method returns the name of the tag

getText()
This method returns the text for that particular element

isWhitespace()
This method analysis even if the latest TEXT event accommodate only whitetops characters.


Android widget

A widget is a small gadget or authority of your android application arranged on the home screen. 
Widgets can be very accessible as they gives permission  to put your favourite applications on
 your home cover in order to rapidly approach them. You have doubtless seen some accepted
 widgets, such as music widget, weather widget, clock widget e.t.c
   
Widgets could be of many types such as information widgets, collection widgets, control widgets
 and hybrid widgets. Android provides us a complete framework to develop our own widgets.

Widget - XML file

To build an application widget, Starting you required is AppWidgetProviderInfo object, which you 
will agree a independent widget XML file. Right click on your program and create a new folder 
called xml. Now you have to  right click on the new created folder and create a XML file. 
The effectiveness of the XML file will be set to AppWidgetProvider.

Widget - Layout file

Now you have to define the layout of your widget in your default XML file. You can drag
 components to generate auto xml.

Widget - Java file

After defining layout, now create a new JAVA file or use existing one, and extend it with AppWidgetProvider 
 class and reverse its update method as follows.With this we  have to define the object of two classes 
which are RemoteViews and Pending Intent. Learn more about android parser at Android Training in Chandigarh.

Syntax is
PendingIntent pending = PendingIntent.getActivity(context, 0, intent, 0);
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.activity_main);

onDeleted(Context context, int[] appWidgetIds)
This is called when an instance of AppWidgetProvider is deleted.

onDisabled(Context context)
This is called when the last instance of AppWidgetProvider is deleted

onEnabled(Context context)
This is called when an instance of AppWidgetProvider is created.

onReceive(Context context, Intent intent)
It is used to dispatch calls to the various methods of the class

IT and Management Information : CBitss Technologies

CBitss Technologies is one of the best institute in Chandigarh. The another name of CBitss is Sukrala
 IT services pvt. ltd. CBitss is one of the best IT and Management Training institute in Chandigarh. It is 
one of the fast growing institute in Chandigarh.

 Android Training in Chandigarh

CBitss Provides IT courses..

2. Php training in Chandigarh.
3. Linux training in Chandigarh.
4. Web Designing course in Chandigarh sector 34a.
5. Seo Training in Chandigarh
6. Six Months industrial training in Chandigarh.

CBitss Provides Management Courses also..

1. Quickbooks Training in Chandigarh
2. Tally Training in Chandigarh
3. Miob Training in Chandigarh.
4. SAP Training in Chandigarh.
5 And Many More..
Computer related course in Chandigarh
Our mission

Our renowned coaching programs will allow you to:

  • Relationships with clients, with employees
  • Integrity in all we do to achieve full potential
  • Cut expenses without sacrificing quality
  • Integrity in all we do to achieve full potential
  • Leadership skills to manage your team
  • Manage your time so you'll get more done in less time

CBitss Technologies which are partner website of Sukrala IT Services Pvt. Ltd. is an ISO 9001:2008 
certified company. CBitss is one of the best training Institute in Chandigarh that offers various courses.
It is settled in the heart of beautiful city Chandigarh. We providing training in HR management, Finance
 Management, Marketing Management, Taxation, Payroll Process. We also provide the knowledge in 
numerous fields like IT training, various Accounting Software, Computer basics training and 
Management courses in Chandigarh.For as far back as couple of years, data innovation has 
significantly been acknowledged and picked up prominence past its proposed desires in the innovation 
world. Today, information technology stands as firm proprietor of computer world both in domestic and 
global arenas.It has not only created economic growth but has enormously enhanced the fast pace of
 of comprehensive headway as well.In their trip to rouse this standard change, CBitss has endeavored
 the endeavors of getting ready understudies, working specialists and understudies in various fields of 
advancement
CBitss has initiated the tasks of preparing students, working professionals and trainees in various
 fields of technology. Hopefuls are playact with different live rendezvous of modern fields to disburse 
with the frightening of industry behavior while obtaining their first job. Since worldwide gauges are
 international standards are of a higher demand in this era, its the sole aim of CBitss to produce
 numerous qualified candidates that can suit these appeal both in the domestic and international cites.
CBitss posture as an transitional between the requirement of information technology and 
corresponding preparation of students to learn, even ahead their assumption. The well-experienced
 staff in CBitss are always ready to take the students to the zenith of IT industry with their world class
 teaching techniques. In order to obtain these goals it is predominant for students to avail themselves
 to this passive opportunity. In Conclusion, CBitss concludes in making candidates for feeding the
 nation and world at large not just making the arrangements for today only..

For More information Visit :
CBitss Technologies
SCO 23-24-25, Level 3rd, SEC 34-A
Chandigarh,
Chandigarh
160022.
Phone: 9988741983