//MainActivity.java //==================== package com.v3; import org.json.JSONObject; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends Activity { TextView Tname,TCountry,TDob,TCity; EditText Ename,ECountry,EDob,ECity; Button btnCreate; String data=""; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btnCreate = (Button) findViewById(R.id.btnGen); Tname = (TextView) findViewById(R.id.txtName); Ename = (EditText) findViewById(R.id.editName); TCity = (TextView) findViewById(R.id.txtCity); ECity = (EditText) findViewById(R.id.editCity); TCountry = (TextView) findViewById(R.id.txtCountry); ECountry = (EditText) findViewById(R.id.editCountry); TDob = (TextView) findViewById(R.id.txtDob); EDob = (EditText) findViewById(R.id.editDob); btnCreate.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { examineJSONFile(); } }); } void examineJSONFile() { try { JSONObject object=new JSONObject(); object.put("Name", Ename.getText()); object.put("City", ECity.getText()); object.put("Country", ECountry.getText()); object.put("Dob", EDob.getText()); Log.i("JsonString :", object.toString()); } catch (Exception je) { } } } //main.xml //============