Recent Posts

Site Creator

By

By

By

Day 3 : Playing with Android Programming

Posted on

Day 3 

Dear  Friends

Today we just gonna create a simple application in Android that can take 5 names input in 5 different EditText and then on button click program will show names in sorted fashion in those EditText. 

for ex 

E1 -> anil

E2 -> sunil

E3 -> akhilesh

E4 -> aditya

E5 -> kittu 

E6 -> tillu

So after pressing button output of program would be 

E1 -> Aditya

E2 -> akhilesh

E3 -> anil

E4 -> kittu

E5 -> sunil

E6 -> tillu

Simple right ?  🙂

Solution : 

Approach we can take:

In java you must have heard term like String Array. 

Now every name is a string. So we will be having a String array to hold names. 

String [ ] inputArray = new String [5];

So in our activity we will be having a method that will read data into inputArray on the click of Button. 

5148818784070924636-account_id=3

String str = ed.getText().toString();

and this str would be then added to inputArray.

Doing this for all the five EditTexts we will be having a String Array that is populated after clicking button. 

Now we sort this array and store back results in some auxiliary array or same array. 

After this, result can again  be used to populate Edittexts to show in UX. 

Output image.

8765987301431973360-account_id=3

Homework 

Smriti has many friends which are categorised in different study groups.  Please help Smriti’s mother to find Smriti if she is present in particular group. 

Group 1 -> [akash,subash,devesh,manoj,kushal]

Group 2 -> [brijesh,suresh,pinkesh,mitali,sonal]

Group 3-> [Smriti, Gurvir,Rajan,Rahul,Pooja]

Group 4->[Chandan,Rachit,Birender,Divya,Geeta]

Write an android application using Edittexts and Textviews to take input as a name of Smriti and there is button that can be clicked to show results.    

Cheers ! Now we are playing with Android Programming. 







Disclaimer: The aforesaid writeup by Relsell Global writer is for the general understanding of the readers. It does not render any professional advice or opinion.

SHARE THIS PAGE!

Leave a Reply

Your email address will not be published. Required fields are marked *