Search

Sunday, 8 January 2017

HELP

https://drive.google.com/file/d/0B9Kk-u-2rTX3cmJzcUZfWnBfZkU/view












https://drive.google.com/file/d/0B9Kk-u-2rTX3VzgzR3pNNzBnRzg/view?usp=sharing

Wednesday, 7 December 2016

All In one [ splash screen ,time picker ,date picker , scroll layout , intent ,tween animation]

All in One

Activity_main.xml



    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"

        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" 
        android:background="@drawable/shape">

        <LinearLayout

            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            
             >

    
</LinearLayout>
    </ScrollView>


Activity_second.xml



    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="50dp"
            android:orientation="vertical" >

            <EditText
                android:id="@+id/name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ems="10"
                android:hint="Enter Name" >

              
            </EditText>

            <EditText
                android:id="@+id/mail"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ems="10"
               android:hint="Email Address"
                android:inputType="textEmailAddress" />
         
<TimePicker 
     android:layout_width="match_parent"
                android:layout_height="wrap_content"
                
                android:id="@+id/tp"/>
<DatePicker
   android:layout_width="match_parent"
                android:layout_height="wrap_content"
                  android:id="@+id/dp"/>
            <Spinner android:entries="@array/str"
                  android:id="@+id/Stream"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
            <TextView 
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Gender" />
            <LinearLayout       
                android:layout_width="match_parent"
            android:layout_height="match_parent"
           
            android:orientation="horizontal"  >
            <RadioGroup android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/rg">

<RadioButton
   android:id="@+id/m"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="Male" />

<RadioButton
   android:id="@+id/f"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="Female" />
                
            </RadioGroup>
            
            </LinearLayout>
            <TextView 
   android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Lang"/> 
<LinearLayout       
                android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/darker_gray"
            android:orientation="horizontal"  >
<CheckBox 
   android:id="@+id/g"
   android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Guj"/>
<CheckBox 
   android:id="@+id/h"
   android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hindi"/>
<CheckBox 
   android:id="@+id/e"
   android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="English"/>
</LinearLayout>

<LinearLayout       
                android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/darker_gray"
            android:orientation="horizontal"  >
<Button  
    android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:id="@+id/submit"/>
<Button   
   android:text="Reset"
   android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Clear"/>
</LinearLayout>

      
</LinearLayout>
    </ScrollView>



Activity_third.xml


    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
 <RelativeLayout 
     android:layout_width="match_parent"
        android:layout_height="match_parent">
 <Button
        android:id="@+id/time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:text="Button" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/time"
        android:text="Rotate" 
        android:onClick="rotate"/>

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/button1"
        android:layout_alignBottom="@+id/button1"
        android:layout_toRightOf="@+id/button1"
        android:text="Translate"
        android:onClick="translate" />

    <Button
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/button2"
        android:layout_alignBottom="@+id/button2"
        android:layout_toRightOf="@+id/button2"
        android:text="Alpha"
        android:onClick="alpha" />

    <Button
        android:id="@+id/button4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/button3"
        android:layout_alignBottom="@+id/button3"
        android:layout_toRightOf="@+id/button3"
        android:text="Scale" 
        android:onClick="scale"/>

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button2"
        android:layout_below="@+id/button2"
        android:layout_marginLeft="30dp"
        android:layout_marginTop="99dp"
       
        android:src="@drawable/ic_launcher" />
        </RelativeLayout>
    </ScrollView>


MainActivity.java

package com.example.allinone;

import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
int secondsDelayed = 1;
        new Handler().postDelayed(new Runnable() {
                public void run() {
                        startActivity(new Intent(MainActivity.this, Second.class));
                        finish();
                }
        }, secondsDelayed * 1000);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}

}

Second.java


package com.example.allinone;



import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.Spinner;
import android.widget.TimePicker;
import android.widget.TimePicker.OnTimeChangedListener;
import android.widget.Toast;

public class Second extends Activity {
Button sbmt,clear;
EditText name,mail;
DatePicker dp;
TimePicker tp;
Spinner sp;
RadioGroup rg;
RadioButton m,f;
CheckBox g,h,e;
String nm,ml,dt,tt,str,gen,lang,tm;
@Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_second);
  sbmt=(Button)findViewById(R.id.submit);
  clear=(Button)findViewById(R.id.Clear);
  name=(EditText)findViewById(R.id.name);
  mail=(EditText)findViewById(R.id.mail);
  dp=(DatePicker)findViewById(R.id.dp);
  tp=(TimePicker)findViewById(R.id.tp);
  sp=(Spinner)findViewById(R.id.Stream);
  rg=(RadioGroup)findViewById(R.id.rg);
  g=(CheckBox)findViewById(R.id.g);
  h=(CheckBox)findViewById(R.id.h);
  e=(CheckBox)findViewById(R.id.e);
 
  sbmt.setOnClickListener(new View.OnClickListener() {
 
   @Override
   public void onClick(View arg0) {
    // TODO Auto-generated method stub
   nm=name.getText().toString();
   ml=mail.getText().toString();
   dt=dp.getDayOfMonth()+"/"+dp.getMonth()+"/"+dp.getYear();
   tp.setIs24HourView(false);
   tt=getTime();
   tp.setOnTimeChangedListener(new OnTimeChangedListener() {
   
    @Override
    public void onTimeChanged(TimePicker arg0, int arg1, int arg2) {
     // TODO Auto-generated method stub
      tt=getTime();
      Toast.makeText(getApplicationContext(), ""+tt, 50).show();
    }
   
   });
 
 
 
   int id=rg.getCheckedRadioButtonId();
   if(id == R.id.m)
    gen="Male";
   else
    gen="Female";
   Toast.makeText(getApplicationContext(), "Gen : " + gen, 50).show();
   str=sp.getSelectedItem().toString();
 
   if(g.isChecked() && h.isChecked() && e.isChecked()){
    lang=g.getText()+","+h.getText()+","+e.getText();
   }else if(  h.isChecked() && e.isChecked())
    {
    lang=h.getText()+","+e.getText();
    }
   else if(g.isChecked() &&  h.isChecked() ){
    lang=g.getText()+","+h.getText();
 
   }
   else if(g.isChecked() &&  e.isChecked() ){
    lang=g.getText()+","+e.getText();
 
   }
   else if(g.isChecked() ){
    lang=g.getText().toString();
   }
   else if(e.isChecked() ){
    lang=e.getText().toString();
   }else if(h.isChecked() ){
    lang=h.getText().toString();
   }
   else{
    lang="Un Educated";
   }
   Log.e("intent pahela" ,"pass");
   Intent i=new Intent(getApplicationContext(),Third.class);
   i.putExtra("name", nm);
   i.putExtra("mail", ml);
 
   i.putExtra("date", dt);
   i.putExtra("time", tt);
   i.putExtra("gender",gen);
 
   i.putExtra("stream",str);
   i.putExtra("lang",lang);
   startActivity(i);
 
 
  }
  public String getTime(){
   tm=tp.getCurrentHour()+":"+tp.getCurrentMinute();
   return tm;
  }
 
  });
 }

 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
  // Inflate the menu; this adds items to the action bar if it is present.
  getMenuInflater().inflate(R.menu.activity_second, menu);
  return true;
 }

}

Third.java


package com.example.allinone;

import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

public class Third extends Activity {
Button time;
ImageView iv;
Button r,t,s,a;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_third);
  s=(Button)findViewById(R.id.button4);
  a=(Button)findViewById(R.id.button3);
  t=(Button)findViewById(R.id.button2);
  r=(Button)findViewById(R.id.button1);
  time=(Button)findViewById(R.id.time);
  iv=(ImageView)findViewById(R.id.imageView1);
 Bundle b;
 b=getIntent().getExtras();
 Log.e("intent pachi" ,"pass");

 String n=b.getString("name").toString();
 String m=b.getString("mail").toString();
 String g=b.getString("gender").toString();
 String d=b.getString("date").toString();
 String t=b.getString("time").toString();
 String s=b.getString("stream").toString();
 String l=b.getString("lang").toString();

 time.setText("Name : " + n + " \n Gen : " + g+ " \n Mail : " + m + " \n Date : " +  d + " \n Time : " + t + " \n Stream : " + s + " \n Language : " + l + " \n ") ;


 }
 public void rotate(View v){
  Animation anim=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.r);
  iv.startAnimation(anim);
 }
 public void translate(View v){
  Animation anim=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.t);
  iv.startAnimation(anim);
 }
 public void alpha(View v){
  Animation anim=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.a);
  iv.startAnimation(anim);
 }
 public void scale(View v){
  Animation anim=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.s);
  iv.startAnimation(anim);
 }

 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
  // Inflate the menu; this adds items to the action bar if it is present.
  getMenuInflater().inflate(R.menu.activity_third, menu);
  return true;
 }

}


Animatoin Files


a.xml {alpha}

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
   
    <set>
 <alpha android:fromAlpha="0.5"
     android:toAlpha="1"
     android:duration="2000"
     android:startOffset="2000"
     >

 </alpha>
</set>
</set>


r.xml {rotate}

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<set><rotate
    android:fromDegrees="0"
    android:toDegrees="360"
    android:duration="4000"
    android:pivotX="50%"
    android:pivotY="50%"
    android:repeatCount="infinite">

</rotate>
</set></set>

s.xml {scale}

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
   
    <set>
        <scale
            android:toXScale="1"
            android:fromYScale="0.5"
             android:toYScale="1"
            android:fromXScale="0.5"
           
         
            android:duration="2000"
            android:repeatCount="infinite"/>
    </set>
</set>

t.xml {translate}

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
   
    <set>
<translate android:fromXDelta="0%p"
    android:toXDelta="75%p"
    android:duration="800"
    >
</translate>

</set></set>


all in one


all in one

all in one




Custome ListView

Activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <ListView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" >
    </ListView>

</RelativeLayout>

Activity_cust.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Cust" 

    android:orientation="horizontal">

    <TextView
        android:id="@+id/bb"
        android:layout_width="96dp"
        android:layout_height="wrap_content"
                android:background="#4DFF0000"
        android:text="A"
        android:textSize="40dp" />

    <TextView
        android:id="@+id/bb2"
        android:layout_width="108dp"
        android:layout_height="wrap_content"
        android:background="#4D00FF00"
        android:text="S"
        android:gravity="center"
        android:textSize="40dp" />

    <TextView
        android:id="@+id/bb3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="right"
        android:background="#4D0000FF"
        android:text="l"
        android:textSize="40dp" />


</LinearLayout>




MainActivity.java

package com.example.listview;

import com.example.listview.R.drawable;

import android.os.Bundle;
import android.R.anim;
import android.app.Activity;
import android.content.Context;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class MainActivity extends Activity {
ListView ls;
Context context;
public static int[] images={R.drawable.a,R.drawable.c,R.drawable.ss,R.drawable.z};
public static String [] iname={"A","B","C","D"};
public static String [] iname2={"1","2","3","4"};
public static String [] iname3={"Z","Z","Z","Z"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ls=(ListView)findViewById(R.id.listView1);
String[] ss={"A","V"};
context=this;
ls.setAdapter(new Cust(MainActivity.this,iname,iname2,iname3));
Toast.makeText(getApplicationContext(), "aa", 50).show();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}


}

Cust.java


package com.example.listview;

import java.util.zip.Inflater;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.text.Layout;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

public class Cust extends BaseAdapter {
View vi;
int [] imgId;
String[]  Result;
String[]  Result2;
String[]  Result3;
static Context context;
private static LayoutInflater inflater=null;

public Cust(MainActivity mainActivity, String[] iname, String[] iname2,
String[] iname3) {
// TODO Auto-generated constructor stub
Result=iname;
Result2=iname2;
Result3=iname3;
context=mainActivity;
Toast.makeText(mainActivity, "saaaaaa", 50).show();
}

@Override
public int getCount() {
// TODO Auto-generated method stub
return Result.length;
}

public String getItem(String arg0) {
// TODO Auto-generated method stub
return arg0;
}

@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
public class A{
TextView tt,tt2,tt3;
}
@Override
public View getView( int arg0, View arg1, ViewGroup arg2) {
// TODO Auto-generated method stub
TextView tt,tt2,tt3;
ImageView imp;
vi=arg1;
  if (vi == null) {
           LayoutInflater mInflater = (LayoutInflater) context
                   .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
           vi= mInflater.inflate(R.layout.activity_cust, null);
       }

tt=(TextView)vi.findViewById(R.id.bb);
tt2=(TextView)vi.findViewById(R.id.bb2);
tt3=(TextView)vi.findViewById(R.id.bb3);
tt.setText(Result[arg0].toString());
tt2.setText(Result2[arg0].toString());
tt3.setText(Result3[arg0].toString());
vi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Toast.makeText(null, "Click", 50).show();
}
});
return vi;
}

@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return null;
}

}


custome list


splash screen

splash screen is a graphical control element consisting of window containing an image, a logo and the current version of the software. A splash screen usually appears while a game or program is launching.

JAVA FILE

package com.example.spalce;

import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

int secondsDelayed = 1;
        new Handler().postDelayed(new Runnable() {
                public void run() {
                        startActivity(new Intent(MainActivity.this, Second.class));
                        finish();
                }
        }, secondsDelayed * 5000);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}


}


Custome Toast

Customize Toast as per your choice



JAVA FILE

package com.example.custometoast;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Toast t=Toast.makeText(getApplicationContext(), "Hello world", 50);
t.setGravity(Gravity.CENTER|Gravity.TOP, 0, 0);
View view=t.getView();
view.setBackgroundColor(Color.GREEN);
t.setView(view);
TextView tv=(TextView)t.getView().findViewById(android.R.id.message);
tv.setTextColor(Color.WHITE);
t.setDuration(50);
t.show();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}

}

custome toast





JSON Delete Data

Delete Data From MySQL DataBase

XML FILE

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="66dp"
  android:hint="Enter name "
        android:ems="10" >

        <requestFocus />
    </EditText>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/editText1"
        android:layout_alignRight="@+id/editText1"
        android:layout_below="@+id/editText1"
        android:layout_marginTop="46dp"
        android:text="Delete" />

</RelativeLayout>

JAVA FILE

package com.example.delete;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends Activity {

private EditText edname;
private Button delete;
InputStream IS;String line,result;
int code;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
edname=(EditText)findViewById(R.id.editText1);
delete=(Button)findViewById(R.id.button1);
delete.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if(edname.getText().toString().equals("")){
Toast.makeText(getApplicationContext(), "All Field Compulsory", 50).show();
}else{
new DeleteData().execute(edname.getText().toString());
}
}
});
}
class DeleteData extends AsyncTask<String, String, String>{

@Override
protected String doInBackground(String... params) {
// TODO Auto-generated method stub

          ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
               nameValuePairs.add(new BasicNameValuePair("name", params[0]));
               try {
                   HttpClient httpclient = new DefaultHttpClient();
                  HttpPost httppost = new //HttpPost("http://10.0.2.2/MCA/delete.php");
              HttpPost httppost = new HttpPost("http://mca.freeoda.com/MCA/delete.php");
                   httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                   HttpResponse response = httpclient.execute(httppost);
                   HttpEntity entity = response.getEntity();
                   IS = entity.getContent();
                   Log.e("pass 1", "connection success ");
               } catch (Exception e) {
                   Log.e("Fail 1", "Error Delete"+e.toString());
                   Toast.makeText(getApplicationContext(), "Invalid IP Address",
                           Toast.LENGTH_LONG).show();
               }
               try {
                   BufferedReader reader = new BufferedReader
                           (new InputStreamReader(IS, "iso-8859-1"), 8);
                   StringBuilder sb = new StringBuilder();
                   while ((line = reader.readLine()) != null) {
                       sb.append(line);
                   }
                   IS.close();
                   result = sb.toString();


                   Log.e("pass 2", "connection success ");

               } catch (Exception e) {
                   Log.e("Fail 2","Error at Delete"+e.toString());
               }
               try {
                   JSONObject j_data=new JSONObject(result);
                   code=j_data.getInt("code");
                   if(code==1){
                       Log.e("Pass 3", "Done");
                       runOnUiThread(new Runnable() {
                           @Override
                           public void run() {
                               Toast.makeText(getApplicationContext(), "Record Deleted", Toast.LENGTH_LONG).show();
                           }
                       });
                   }else{
                       runOnUiThread(new Runnable() {
                           @Override
                           public void run() {
                               Toast.makeText(getApplicationContext(), "Record not Deleted", Toast.LENGTH_LONG).show();
                           }
                       });


                   }

                   Log.e("pass 3", "pass 3");
               } catch (Exception we) {
                   Log.e("Fail 3", "Error At Delete"+we.toString());
               }
return null;
}

} @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}


}