Android: ListView Pagination Get link Facebook X Pinterest Email Other Apps March 11, 2016 While having pagination do not re create the adapter object, instead update the existing adapter object. so that the list view will not be refreshed or re created. It will be updated with new items. Get link Facebook X Pinterest Email Other Apps Comments
change svg android drawable color March 06, 2017 private void changeSearchDrawable() { Drawable drawable = ResourcesCompat. getDrawable (getResources(), R.drawable. icon_search , getTheme()); int colorVal; if (Build.VERSION. SDK_INT >= Build.VERSION_CODES. M ) { colorVal = this .getResources().getColor(R.color. nnnow_pink , getTheme()); } else { colorVal = this .getResources().getColor(R.color. nnnow_pink ); } drawable.setColorFilter(colorVal, PorterDuff.Mode. SRC_ATOP ); check .setImageDrawable(drawable); } Read more
Android: Ping an external server from android device March 11, 2016 // ping external servers public static final String PING_ONE = "ping -c 1 your server IP" ; public static final String PING_TWO = "ping -c 1 your server IP " ; try { Process p1 = java.lang.Runtime. getRuntime ().exec( PING_ONE ); int p1RetExitVal = p1.waitFor(); if (p1RetExitVal == 0 ) { // Internet available networkState = true ; } else { Process p2 = java.lang.Runtime. getRuntime ().exec( PING_TWO ); int p2RetExitVal = p2.waitFor(); if (p2RetExitVal == 0 ) { // Internet available networkState = true ; } } } catch (Exception e) { networkState = false ; e.printStackTrace(); } Read more
network request using urlconnection February 22, 2017 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... Read more
Comments
Post a Comment