Json_Post Post your credentials or any thing in your http site or API. NEVER DO Never write your network related function in your Main FUNCTION as it can cause issues which can take your lot of time. Try using ASYNC TASK . Thumbs up ! To external library.