Meta tags:
description= Android Hub 4 you is a blog related to android development it s content topic related to android programming and development.;
Headings (most frequently used words):
kotlin, android, php, example, material, design, web, simple, stack, me, array, code, services, 2015, demo, monday, blog, follow, on, loop, to, for, fragment, with, json, sunday, login, hello, bar, back, examples, and, while, button, webservices, action, application, service, lolypop, collaps, layout, snackbar, download, zip, maintain, full, fragmnet, return, introduction, facebook, posts, 29, com, github, https, 2016, 31, january, 2019, july, materialdesign, pages, tutorial, programming, free, the, you, manishsri01, december, popular, contact, archive, followers, hub, overflow, support, donate, twitter, pageviews, 28, total, this, search, 18, october, 26, november, thursday, handle,
Text of the page (most frequently used words):
#android (158), view (48), #import (44), #kotlin (34), the (28), #fragment (28), public (27), for (27), com (25), #num1 (21), #number (20), #with (18), #share (18), from (18), main (18), override (17), transaction (17), json (17), array (17), androidhub4you (16), println (16), container (15), and (15), true (14), int (14), bundle (14), class (13), app (13), match_parent (13), new (12), savedinstancestate (12), dimen (12), #this (12), email (12), support (11), void (11), fun (11), layout_height (11), code (11), layout_width (11), return (11), manish (11), use (11), php (10), layoutinflater (10), increment (10), val (10), design (10), hello (9), activity (9), button (9), wrap_content (9), keyword (9), layout (9), num2 (8), viewgroup (8), relativelayout (8), fragmentchild (8), back (8), web (8), inflate (8), stack (8), how (8), fragmentmain (8), will (8), oncreate (8), example (8), snackbar (8), else (7), status (7), message (7), data (7), name (7), false (7), var (7), java (7), mainactivity (7), action (7), qur (7), 2015 (7), database (7), phone (7), services (7), activity_horizontal_margin (6), text (6), decrement (6), output (6), activity_vertical_margin (6), fab (6), fragmenttransaction (6), widget (6), inflater (6), assignment (6), open (6), getactivity (6), one (6), textsize (6), toast (6), floatingactionbutton (6), package (6), material (6), december (6), october (6), friends (6), extends (6), are (6), question (6), july (6), super (6), start (6), sql (6), commit (6), menu (6), facebook (6), twitter (6), home (6), set (5), string (5), count (5), actionbar (5), method (5), getfragmentmanager (5), materialdesign (5), add (5), login (5), sqlite (5), image (5), without (5), examples (5), paddingtop (5), write (5), con (5), take (5), have (5), onclick (5), case (5), you (5), onclicklistener (5), break (5), answer (5), findviewbyid (5), comments (5), replace (5), xmlns (5), http (5), schemas (5), paddingbottom (5), labels (5), log (5), loop (5), pinterest (5), january (5), blogthis (5), into (4), begintransaction (4), 15dp (4), contact (4), setonclicklistener (4), bar (4), actionbaractivity (4), let (4), comment (4), programming (4), boolean (4), today (4), apk (4), create (4), textview (4), arr (4), root (4), line (4), res (4), blog (4), test (4), oncreateview (4), thanks (4), full (4), may (4), below (4), november (4), type (4), handle (4), hub (4), bold (4), september (4), variables (4), mydb (4), xml (4), till (4), fragmentdemo (4), textstyle (4), variable (4), screen (4), child (4), done (3), result (3), important (3), make (3), store (3), connection (3), password (3), info (3), item (3), values (3), handlebackstack (3), floatingfragment (3), tools (3), loginactivity (3), language (3), intent (3), content (3), button__activity_main (3), show (3), while (3), check (3), simple (3), keycode (3), snackbarfragment (3), title (3), row (3), post (3), 2016 (3), types (3), call (3), layout_centerhorizontal (3), demo (3), june (3), download (3), april (3), than (3), billing (3), paddingleft (3), paddingright (3), get (3), final (3), layout_centerinparent (3), setactionbartitle (3), booleans (3), 26sp (3), very (3), posts (3), going (3), purchase (3), want (3), your (3), max (3), 2019 (3), follow (3), keyevent (3), srivastava (3), downto (2), step (2), response (2), mysql_num_rows (2), define (2), 110 (2), only (2), monday (2), forloopkotlin (2), until (2), smaller (2), including (2), include (2), hellokotlin (2), whileloopkotlin (2), single (2), print (2), ifelsekotlin (2), uses (2), error (2), header (2), well (2), functions (2), some (2), homefragment (2), collapsfragment (2), collasps (2), fragments (2), what (2), country (2), compile (2), jetbrains (2), tolist (2), strings (2), more (2), function (2), arraynumbers (2), num (2), development (2), germany (2), usa (2), sweden (2), position (2), elements (2), represented (2), maketext (2), using (2), now (2), multiline (2), same (2), reassigned (2), num3 (2), length_long (2), todo (2), auto (2), arraykotlin (2), arrays (2), generated (2), characters (2), stub (2), listof (2), free (2), arraycountry (2), tutorial (2), mysql_query (2), protected (2), 20dp (2), button__fragment_main (2), 20sp (2), fragment_main (2), mbuttonfragmentmain (2), addtobackstack (2), activity_main (2), menuitem (2), setcontentview (2), getsupportactionbar (2), onoptionsitemselected (2), switch (2), hardware (2), press (2), onkeydown (2), event (2), layout_margintop (2), tile (2), finish (2), useful (2), camera (2), gallery (2), getting (2), detail (2), all (2), popular (2), august (2), february (2), constructor (2), march (2), introduction (2), look (2), can (2), git (2), fragment_child (2), required (2), empty (2), then (2), util (2), application (2), mysql_connect (2), sunday (2), user (2), cannot (2), activity_login (2), mysql_select_db (2), connect (2), die (2), query (2), select (2), mintent (2), localhost (2), json_decode, programmatic, 2012, mysql_close, arguments, close, better, understanding, block, details, end, contacts, other, languages, pick, lines, not, sum, match, layout_above, greater, pageviews, server, echo, object, older, exclude, brackets, atom, subscribe, search, total, 2013, donate, overflow, followers, archive, just, comparaisen, varaible, varaiable, 2014, delete, save, 220, blogger, char, powered, cross, platform, statically, typed, developed, projects, quick, next, theme, specially, which, software, been, days, dear, these, about, ask, inerview, interview, learn, pages, travel, represent, google, but, payment, writing, value, change, demands, many, read, basically, there, two, getaway, later, byte, see, inegrate, that, has, faculty, provide, almost, keywords, double, float, long, short, json_encode, onnavigationdraweritemselected, context, setaction, steps, here, coordinatorlayout, fragment_snackbar, ssnackbar, getsupportfragmentmanager, top, nothing, developer, update, floating, replacing, action_settings, calling, navigation, drawer, https, github, manishsri01, getitemid, cardview, startactivity, lolypop, point, keycode_back, menu_main, gravity, studio, build, gradle, file, src, folder, dependencies, inside, modify, according, 18sp, zip, center, settitle, layout_marginbottom, 50dp, popbackstackimmediate, remove, project, length_short, work, progress, given, fragment_floating, valueof, getbackstackentrycount, collaps, note, service, numbers, framelayout, found, record, where, mysql, mysql_fetch_assoc, client, file_get_contents, input, gmail, thursday, visual, webservices, tes, display, order, run, programmes, eclipse, plugin, intellij, ide, getmenuinflater, know, need, present, assistance, items, fragmnet, adds, oncreateoptionsmenu, side, setdisplayhomeasupenabled, setdisplayshowhomeenabled, maintain,
Text of the page (random words):
ort byte strings in kotlin strings are represented by the string keyword arrays in kotlin arrays are represented by the array class that has get and set functions we will see some examples in later post question how to use write variables in kotlin answer basically there are two types of use of variables in kotlin language i read only or final variable define with val keyword val num1 int 110 int with assignment val num3 int without assignment val name string manish string type with assignment ii reassigned variables define with var keyword var num1 int 110 with assignment num1 num1 90 we change the value of reassigned variables var num3 int without assignment var num2 220 with assignment but without type var name manish question how to write kotlin functions answer we write kotlin function with f un keyword and arguments with keyword an example of kotlin function to add 2 number fun sum num1 int num2 int int return num1 num2 question how to use comment lines in kotlin answer it is the same as java and other programming languages i single line or end of line comment this is test comment line ii multiline or block this is multiline test comment for kotlin let us take some examples for better understanding 1 hellokotlin class hellokotlin kotlin fun with androidhub4you com fun main println hello from androidhub4you com output hello from androidhub4you com 2 ifelsekotlin class ifelsekotlin kotlin fun with androidhub4you com val num1 int 50 val num2 int 60 fun main if num1 num2 println num1 is greater than num2 else println num1 is smaller than num2 output num1 is smaller than num2 3 whileloopkotlin class whileloopkotlin kotlin fun with androidhub4you com fun main var start 1 use var as we want to do increment on start varaiable val max 10 use val as we just want to comparaisen with max varaible while start max println start start output 1 2 3 4 5 6 7 8 9 10 4 forloopkotlin class forloopkotlin kotlin fun with androidhub4you com fun main increment one by one it will include 15 as well println increment by 1 number including till number for num1 in 10 15 println num1 increment one by one it will include 15 as well println increment by 1 number without till number for num1 in 15 until 20 println num1 increment by 2 number println increment by 2 number for num1 in 20 until 30 step 2 println num1 println decrement by 1 number for loop for decrement for num1 in 40 downto 30 println num1 we can exclude brackets if we want to write single line only println decrement by 2 number for loop for decrement for num1 in 50 downto 40 step 2 println num1 output increment by 1 number including till number 10 11 12 13 14 15 increment by 1 number without till number 15 16 17 18 19 increment by 2 number 20 22 24 26 28 decrement by 1 number 40 39 38 37 36 35 34 33 32 31 30 decrement by 2 number 50 48 46 44 42 40 5 arraykotlin class arraykotlin kotlin fun with androidhub4you com fun main use listof keyword to store array elements val arraycountry listof germany usa uk sweden use for loop to print all elements in array for country in arraycountry println country let us take one more example how to create array of numbers using tolist keyword val arraynumbers 50 60 tolist for num in arraynumbers println num output germany usa uk sweden 50 51 52 53 54 55 56 57 58 59 60 note in order to run kotlin programmes you may use eclipse with kotlin plugin or use intellij ide let me know if need more assistance thanks manish at july 29 2019 no comments email this blogthis share to twitter share to facebook share to pinterest labels androidhub4you jetbrains kotlin kotlin examples sunday january 31 2016 android material design demo android lolypop material design example material design collaps layout material design snackbar hello friends here a useful example for android material design important steps are given below 1 create a new android project using visual studio 2 open your build gradle file from src folder and import below dependencies compile com android support design 22 2 1 compile com android support cardview v7 22 2 1 3 and now import full code from git hub and modify according to your use https github com manishsri01 materialdesign important code 1 calling fragments from navigation drawer override public void onnavigationdraweritemselected int position update the main content by replacing fragments fragmenttransaction transaction getsupportfragmentmanager begintransaction switch position case 0 floatingfragment homefragment new floatingfragment transaction replace r id container homefragment transaction commit break case 1 snackbarfragment snackbar new snackbarfragment transaction replace r id container snackbar transaction commit break case 2 collapsfragment collasps new collapsfragment transaction replace r id container collasps transaction commit break 2 ssnackbar action package com android materialdesign fragment import android os bundle import android support design widget floatingactionbutton import android support design widget snackbar import android support v4 app fragment import android view layoutinflater import android view view import android view viewgroup import android widget toast import com android materialdesign r public class snackbarfragment extends fragment override public void oncreate bundle savedinstancestate todo auto generated method stub super oncreate savedinstancestate override public view oncreateview layoutinflater inflater viewgroup container bundle savedinstancestate final view v layoutinflater from getactivity inflate r layout fragment_snackbar container false floatingactionbutton fab floatingactionbutton v findviewbyid r id fab fab setonclicklistener new view onclicklistener override public void onclick view view snackbar make v findviewbyid r id coordinatorlayout i am a snackbar snackbar length_long setaction action new view onclicklistener override public void onclick view v toast maketext getactivity snackbar action toast length_long show show return v 3 floating point package com android materialdesign fragment import android os bundle import android support design widget floatingactionbutton import android support v4 app fragment import android view layoutinflater import android view view import android view viewgroup import android widget toast import com android materialdesign r public class floatingfragment extends fragment override public void oncreate bundle savedinstancestate todo auto generated method stub super oncreate savedinstancestate override public view oncreateview layoutinflater inflater viewgroup container bundle savedinstancestate view v layoutinflater from getactivity inflate r layout fragment_floating container false floatingactionbutton fab floatingactionbutton v findviewbyid r id fab fab setonclicklistener new view onclicklistener override public void onclick view view toast maketext getactivity work in progress toast length_short show return v download zip code thanks manish at january 31 2016 3 comments email this blogthis share to twitter share to facebook share to pinterest labels android android developer androidhub4you material design monday december 28 2015 php web services to return json array php web services simple json array web services php open database connection con mysql_connect localhost root root or die cannot connect to the db mysql_select_db mydb con make a sql query to store data sql select from mydb user qur mysql_query sql check the database response is it true or false if qur if mysql_num_rows qur 0 write data into json array info array while row mysql_fetch_assoc qur arr array arr name row name arr email row email info arr json array status 1 message done result info else json array status 0 message no record found else json array status 0 message error output status 1 message done result name manish email manish gmail com name test email test tes com thanks manish at december 28 2015 no comments email this blogthis share to twitter share to facebook share to pinterest labels json array php web services web services thursday november 26 2015 php login web service php code for login php simple webservices php take the values from client as json json file_get_contents php input open database connection con mysql_connect localhost root root or die cannot connect to the db mysql_select_db mydb con take json values into data variable data json_decode json make a sql query to store data sql select from mydb user where email data email and password data password qur mysql_query sql check the database response it is true or false if qur if mysql_num_rows qur 1 json array status 1 message done else json array status 0 message email or password not match else json array status 0 message error close the database connection mysql_close con set header header content type application json print the result as json object echo json_encode json at november 26 2015 no comments email this blogthis share to twitter share to facebook share to pinterest labels login mysql php web services sunday october 18 2015 android fragmnet example code with full stack maintain fragment demo application simple fragment example with action bar back button stack handle hello friends today i am going to share code for how to create android fragment and how to handle back stack have a look at below code or you can download full code from git server 1 loginactivity java package com androidhub4you fragmentdemo import android content intent import android os bundle import android support v7 app actionbaractivity import android view view public class loginactivity extends actionbaractivity override protected void oncreate bundle savedinstancestate super oncreate savedinstancestate setcontentview r layout activity_login findviewbyid r id button__activity_main setonclicklistener new view onclicklistener override public void onclick view view intent mintent new intent loginactivity this mainactivity class startactivity mintent 2 activity_login xml 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 mainactivity textview android layout_width wrap_content android text login activity android textsize 26sp android textstyle bold android layout_margintop 20dp android layout_centerhorizontal true android layout_height wrap_content textview android layout_above id button__activity_main android layout_width match_parent android text from login activity we will open main activity and inside main activity we will add main fragment in container android textsize 18sp android textstyle bold android gravity center android layout_marginbottom 50dp android layout_centerhorizontal true android layout_height wrap_content button android id id button__activity_main android layout_width match_parent android layout_height wrap_content android paddingbottom 15dp android text open main activity android textsize 20sp android layout_centerinparent true android paddingtop 15dp relativelayout 3 mainactivity java package com androidhub4you fragmentdemo import android app fragmenttransaction import android os bundle import android support v7 app actionbar import android support v7 app actionbaractivity import android util log import android view keyevent import android view menu import android view menuitem manish srivastava public class mainactivity extends actionbaractivity override protected void oncreate bundle savedinstancestate super oncreate savedinstancestate setcontentview r layout activity_main log v main activity screen display home back button actionbar actionbar getsupportactionbar actionbar setdisplayshowhomeenabled true actionbar setdisplayhomeasupenabled true in side create method of mainactivity we will add main fragment fragmenttransaction transaction getfragmentmanager begintransaction fragmentmain fragmentmain new fragmentmain transaction addtobackstack fragmentmain transaction replace r id container fragmentmain transaction commit override public boolean oncreateoptionsmenu menu menu inflate the menu this adds items to the action bar if it is present getmenuinflater inflate r menu menu_main menu return true override public boolean onoptionsitemselected menuitem item switch item getitemid case android r id home handlebackstack break case r id action_settings do nothing break return super onoptionsitemselected item handle back stack from hardware back button and top action bar home back button public boolean handlebackstack on back press check the count of fragment in stack int count getfragmentmanager getbackstackentrycount log v fragment in stack string valueof count if count 1 if count is 0 then finish main activity finish else else remove one fragment from the stack fragmenttransaction transaction getfragmentmanager begintransaction getfragmentmanager popbackstackimmediate transaction commit return true set action bar title name public void setactionbartitle string title getsupportactionbar settitle title handle the hardware back press override public boolean onkeydown int keycode keyevent event if keycode keyevent keycode_back handlebackstack return true return super onkeydown keycode event 4 activity_main xml relativelayout xmlns android http schemas android com apk res android android layout_width match_parent android layout_height match_parent framelayout android id id container android layout_width match_parent android layout_height match_parent relativelayout 5 fragmentmain java package com androidhub4you fragmentdemo import android app fragmenttransaction import android os bundle import android app fragment import android util log import android view layoutinflater import android view view import android view viewgroup import android widget button manish srivastava public class fragmentmain extends fragment public fragmentmain required empty public constructor override public view oncreateview layoutinflater inflater viewgroup container bundle savedinstancestate inflate the layout for this fragment view view inflater inflate r layout fragment_main container false final button mbuttonfragmentmain button view findviewbyid r id button__fragment_main log v main fragment screen mbuttonfragmentmain setonclicklistener new view onclicklistener override public void onclick view view call the child fragment fragmenttransaction transaction getfragmentmanager begintransaction fragmentchild fragmentchild new fragmentchild transaction addtobackstack fragmentchild transaction replace r id container fragmentchild transaction commit call the main activity set tile method mainactivity getactivity setactionbartitle home fragment return view 6 fragment_main xml relativelayout xmlns android http schemas android com apk res android android layout_width match_parent android ...
|