don't know where is my error
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
import java.io.InputStreamReader;
import org.apache.http.message.BasicNameValuePair;
public class MainActivity extends Activity {
EditText email;
EditText passsword;
Button btn_send;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn_send = (Button)findViewById(R.id.send_session);
btn_send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Send();
}
});
}
public void Send(){
String text ="";
try {
email = (EditText)findViewById(R.id.email);
passsword = (EditText)findViewById(R.id.password);
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://172.16.1.196:3000/clients/login.json");
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("email",email.getText().toString()));
params.add(new BasicNameValuePair("password",passsword.getText().toString()));
httppost.setEntity(new UrlEncodedFormEntity(params));
Log.v("URL" , httppost.toString());
HttpResponse resp = httpclient.execute(httppost);
HttpEntity ent= resp.getEntity();
text = EntityUtils.toString(ent);
}
catch (Exception e) {
Log.v("mesage" , e.getMessage().toString());
}
email.setText(text);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
And My Activity
<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:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
android:background="#283439">
<EditText
android:layout_width="wrap_content"
android:layout_height="50dip"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/email"
android:layout_marginTop="132dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textColor="#00c189"
android:textAlignment="center"
android:clickable="false"
android:background="@drawable/customs_borders"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="50dip"
android:inputType="textPassword"
android:ems="10"
android:id="@+id/password"
android:textAlignment="center"
android:textColor="#00c189"
android:clickable="false"
android:background="@drawable/customs_borders"
android:layout_centerVertical="true"
android:layout_alignLeft="@+id/email"
android:layout_alignStart="@+id/email" />
<Button
android:layout_width="218dip"
android:layout_height="50dip"
android:text="Login"
android:id="@+id/send_session"
android:textColor="#0cc189"
android:background="#282934"
android:layout_marginTop="50dp"
android:layout_below="@+id/password"
android:layout_alignRight="@+id/password"
android:layout_alignEnd="@+id/password" />
</RelativeLayout>
And My Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.xxxxx.xxxxxx" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.xxxxx.xxxxxx.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
</manifest
>
a part of log console
20:21.178 27635-27635/com.example.xxxx.xxxxx W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40ffb930) 10-24 13:20:21.178 27635-27635/com.example.xxxx.xxxxx E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at com.example.xxxx.xxxxx.MainActivity.Send(MainActivity.java:81) at com.example.xxxx.xxxxx.MainActivity$1.onClick(MainActivity.java:49) at android.view.View.performClick(View.java:4421) at android.view.View$PerformClick.run(View.java:18190) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:175) at android.app.ActivityThread.main(ActivityThread.java:5279) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) at dalvik.system.NativeStart.main(Native Method)
Please help!