Posts

Showing posts from February, 2017

Activity lifecycle on configuration change

 onResume  onPause  onSaveInstanceState(Bundle outState)  onStop  onDestroy  onCreate  onStart  onRestoreInstanceState(Bundle savedInstanceState)  onResume

network request using urlconnection

try { String response = null ; URL url = new URL( url ); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); String payload = "{ \" pageSize \" :30, \" pageNumber \" :1, \" currentPriceRanges \" :[], \" filters \" :{ \" newArrivals \" :false, \" onSale \" :false, \" articleType \" :[], \" filterBy \" :{ \" Brand \" :[]}}, \" isFiltersRequired \" :true, \" source \" : \" listing \" , \" collections \" :[ \" FL-Top Nav-ALL-Mens Shirts \" ]}" ; connection.setDoInput( true ); connection.setDoOutput( true ); connection.setRequestMethod( "POST" ); connection.setRequestProperty( "Accept" , "application/json" ); connection.setRequestProperty( "Content-Type" , "application/json; charset=UTF-8" ); OutputStreamWriter writer = new OutputSt