This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Refered Link: http://stackoverflow.com/questions/5490789/json-parsing-using-gson-for-java | |
// Refered Link: http://stackoverflow.com/a/10593838/1083093 | |
JSONObject refJson; | |
JSONArray jsonarray= null; | |
JsonElement gsonJelement; | |
JsonObject gsonJobject; | |
try { | |
// Retrieve JSON Objects from the given URL address | |
refJson = JSONfunctions.getJSONfromURL(url.trim()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Checking the backstack works perfectly | |
@Override | |
public boolean onKeyDown(int keyCode, KeyEvent event) | |
{ | |
if (keyCode == KeyEvent.KEYCODE_BACK) | |
{ | |
if (getFragmentManager().getBackStackEntryCount() == 1) | |
{ | |
// DO something here since there is only one fragment left |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.findmybuffet.utilities; | |
import java.io.IOException; | |
import java.util.HashMap; | |
import java.util.Map; | |
import org.apache.http.client.ClientProtocolException; | |
import org.apache.http.client.HttpClient; | |
import org.apache.http.client.ResponseHandler; | |
import org.apache.http.client.methods.HttpGet; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// REFER: http://stackoverflow.com/a/19828165/1083093 | |
//Step1: Add in the root of the layout, if its a scrollview add to the parent(eg:linearlayout) not the scroll view | |
android:clickable="true" | |
android:focusableInTouchMode="true" | |
//Step2: Add this method | |
public void hideKeyboard(View view) { | |
InputMethodManager inputMethodManager =(InputMethodManager)getSystemService(Activity.INPUT_METHOD_SERVICE); | |
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.apache.http.HttpEntity; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.NameValuePair; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listviewone.setOnItemClickListener(new AdapterView.OnItemClickListener() { | |
@Override | |
public void onItemClick(AdapterView<?> parent, View view,int position, long id) { | |
TextView mText = (TextView) view.findViewById(R.id.title); | |
String value= mText.getText().toString().trim(); | |
String str =(String) ((TextView) view.findViewById(R.id.title)).getText(); | |
Log.d("", ""); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new HttpClient and Post Header | |
HttpClient httpclient = new DefaultHttpClient(); | |
HttpPost httppost = new HttpPost("http://www.yoursite.com/script.php"); | |
try { | |
// Add your data | |
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); | |
nameValuePairs.add(new BasicNameValuePair("id", "12345")); | |
nameValuePairs.add(new BasicNameValuePair("stringdata", "AndDev is Cool!")); | |
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void getRequest(String urlString) { | |
URL url; | |
InputStream response = null; | |
try { | |
url = new URL(urlString); | |
HttpURLConnection connection; | |
connection = (HttpURLConnection) url.openConnection(); | |
connection.setRequestMethod("GET"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eReminderTime.setOnClickListener(new OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
// TODO Auto-generated method stub | |
Calendar mcurrentTime = Calendar.getInstance(); | |
int hour = mcurrentTime.get(Calendar.HOUR_OF_DAY); | |
int minute = mcurrentTime.get(Calendar.MINUTE); | |
TimePickerDialog mTimePicker; | |
mTimePicker = new TimePickerDialog(AddReminder.this, new TimePickerDialog.OnTimeSetListener() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//*****************CALLL THIS FUNCTION CALL IN ON CLICK OF A VIEW*****************// | |
selectDate(v); | |
//*****************CALLL THIS FUNCTION CALL IN ON CLICK OF A VIEW*****************// | |
//*******Date picker implementation******(Start)***// | |
public void selectDate(View view) { | |
DialogFragment fragment = new SelectDateFragment(); |
OlderNewer