import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Date;
+import javax.net.ssl.HttpsURLConnection;
+
import ro.ieval.unical.R;
import com.google.gson.Gson;
+import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.widget.EditText;
import android.widget.TextView;
+import com.facebook.*;
+
+import com.facebook.model.*;
public class mainActivity extends android.app.Activity {
Event[] getEventList() {
InputStreamReader in;
try {
hostUrlJson=new URL(Constants.searchUrl);
- URLConnection calConnection = hostUrlJson.openConnection();
+ HttpsURLConnection calConnection = (HttpsURLConnection) hostUrlJson.openConnection();
+ calConnection.setDoOutput(true);
+ calConnection.setUseCaches(false);
calConnection.setRequestProperty("Authorization", "Basic "+Base64.encodeToString( (Constants.user+':'+Constants.password).getBytes(), Base64.NO_WRAP));
+ //calConnection.setRequestMethod("POST");
+ //calConnection.setDoInput(true);
+ //calConnection.connect();
+
+ final PrintWriter ps=new PrintWriter(calConnection.getOutputStream());
+ ps.print("{}");
+ ps.close();
+
in = new InputStreamReader(calConnection.getInputStream());
Gson gson=new Gson();
events=gson.fromJson(in,Event[].class);
in.close();
+
return events;
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
protected void onCreate(Bundle savedInstanceState) {
// All Begins here :)
// And here it began the olympic app that does olympic thing
- setContentView(R.layout.eventview);
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.login);
+
+ /*setContentView(R.layout.eventview);
final TextView eventTitle= (TextView) findViewById(R.id.eventTitle);
final TextView date=(TextView) findViewById(R.id.date);
final TextView description=(TextView) findViewById(R.id.description);
- super.onCreate(savedInstanceState);
- System.err.println("MuieLaComisie");
+
final Handler h=new Handler();
new Thread(new Runnable() {
public void run() {
h.post(new Runnable() {
public void run() {
// aici incepe
+
eventTitle.setText(events[0].title);
date.setText((new Date(events[0].date)).toString());
description.setText(events[0].description);
+ DatabaseInteract db=new DatabaseInteract(mainActivity.this);
}
});
}
- }).start();
+ }).start();*/
}
}