我想获取引用(这意味着我在_source中看到的完整对象)从每个突出显示的片段开始。
示例:
我想知道每个片段都突出显示了id。
我的ElasticSearch请求:
BackgroundTask Class,
public class BackgroundTask extends AsyncTask<String,Void,String> {
AlertDialog alertDialog;
Context ctx;
BackgroundTask(Context ctx)
{
this.ctx = ctx;
}
@Override
protected void onPreExecute(){
alertDialog = new AlertDialog.Builder(ctx).create();
alertDialog.setTitle("Login Information....");
}
@Override
protected String doInBackground(String... params) {
String reg_url = "http://127.0.0.1/Register.php";
String login_url = "http://127.0.0.1/Login.php";
String method = params[0];
if (method.equals("register"))
{
String isim = params [1];
String soyisim = params[2];
String plaka = params[3];
String saseno = params[4];
String email = params[5];
String sifre = params[6];
try {
URL url = new URL(reg_url);
HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoOutput(true);
//httpURLConnection.setDoInput(true);
OutputStream OS = httpURLConnection.getOutputStream();
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(OS,"UTF-8"));
String data = URLEncoder.encode("isim","UTF-8") +"="+URLEncoder.encode(isim,"UTF-8")+"&"+
URLEncoder.encode("soyisim","UTF-8") +"="+URLEncoder.encode(soyisim,"UTF-8")+"&"+
URLEncoder.encode("plaka","UTF-8") +"="+URLEncoder.encode(plaka,"UTF-8")+"&"+
URLEncoder.encode("saseno","UTF-8") +"="+URLEncoder.encode(saseno,"UTF-8")+"&"+
URLEncoder.encode("email","UTF-8") +"="+URLEncoder.encode(email,"UTF-8")+"&"+
URLEncoder.encode("sifre","UTF-8") +"="+URLEncoder.encode(sifre,"UTF-8");
bufferedWriter.write(data);
bufferedWriter.flush();
bufferedWriter.close();
OS.close();
InputStream IS = httpURLConnection.getInputStream();
IS.close();
//httpURLConnection.connect();
httpURLConnection.disconnect();
return "Registration Success...";
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
else if (method.equals("login"))
{
String loginmail = params[1];
String loginsifre = params[2];
try {
URL url = new URL(login_url);
HttpURLConnection httpURLConnection = (HttpURLConnection)
url.openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
OutputStream outputStream = httpURLConnection.getOutputStream();
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream,"UTF-8"));
String data = URLEncoder.encode("loginmail","UTF-8")+"="+URLEncoder.encode(loginmail,"UTF-8")+"&"+
URLEncoder.encode("loginsifre","UTF-8")+"="+URLEncoder.encode(loginsifre,"UTF-8");
bufferedWriter.write(data);
bufferedWriter.flush();
bufferedWriter.close();
outputStream.close();
InputStream inputStream = httpURLConnection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream,"iso-8859-1"));
String response = "";
String line = "";
while ((line = bufferedReader.readLine())!=null)
{
response+= line;
}
bufferedReader.close();
inputStream.close();
httpURLConnection.disconnect();
return response;
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
@Override
protected void onProgressUpdate(Void... values) {
super.onProgressUpdate(values);
}
@Override
protected void onPostExecute(String result) {
if (result.equals("Registration Success..."))
{
Toast.makeText(ctx,result,Toast.LENGTH_LONG).show();
}
else
{
alertDialog.setMessage(result);
alertDialog.show();
}
}
}
Login Javaclass,
package com.example.serdar.tipoff;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.EditText;
public class Login extends Activity {
EditText ET_EMAİL_LOGİN,ET_SİFRE_LOGİN;
String loginmail,loginsifre;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_login);
ET_EMAİL_LOGİN = (EditText)findViewById(R.id.etmaillogin);
ET_SİFRE_LOGİN = (EditText)findViewById(R.id.etsifrelogin);
}
public void Regkayit (View view)
{
startActivity(new Intent(this, Register.class));
}
public void LogGiris ( View view)
{
loginmail = ET_EMAİL_LOGİN.getText().toString();
loginsifre = ET_SİFRE_LOGİN.getText().toString();
String method = "login";
BackgroundTask backgroundTask = new BackgroundTask(this);
backgroundTask.execute(method,loginmail,loginsifre);
}
}
Register Javaclass,
package com.example.serdar.tipoff;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.EditText;
public class Register extends Activity {
EditText ET_İSİM_REG,ET_SOYİSİM_REG,ET_PLAKA_REG,ET_SASENOREG,ET_EMAİL_REG,ET_SİFRE_REG;
String isim,soyisim,plaka,saseno,email,sifre;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_register);
ET_İSİM_REG = (EditText)findViewById(R.id.etisimreg);
ET_SOYİSİM_REG = (EditText)findViewById(R.id.etsoyisimreg);
ET_PLAKA_REG = (EditText)findViewById(R.id.etplakareg);
ET_SASENOREG = (EditText)findViewById(R.id.etsasenoreg);
ET_EMAİL_REG = (EditText)findViewById(R.id.etmailreg);
ET_SİFRE_REG = (EditText)findViewById(R.id.etsifrereg);
}
public void Regkaydet (View view)
{
isim = ET_İSİM_REG.getText().toString();
soyisim = ET_SOYİSİM_REG.getText().toString();
plaka = ET_PLAKA_REG.getText().toString();
saseno = ET_SASENOREG.getText().toString();
email = ET_EMAİL_REG.getText().toString();
sifre = ET_SİFRE_REG.getText().toString();
String method = "register";
BackgroundTask backgroundTask = new BackgroundTask(this);
backgroundTask.execute(method,isim,soyisim,plaka,saseno,email,sifre);
finish();
}
}
目前,有了这个请求,我只有片段高亮,但我不知道哪个片段链接到哪个ID。
有人对此有任何想法吗?