More Related Content Similar to technomantra (20) technomantra2. ii
TECHNOMANTRA
By 5th
Year M.sc IT (2015 – 2016)
Prepared By:
No. Student Name Div Roll no.
1 Pradip D. Jinjala A 5020
2 Romil D. Modi B 5203
3 Avatarsinh G. Vaghela B 5168
Date of Submission: 19 December, 2015
SUBMITTED TO:
K.S School of Business Management,
M.sc in (Computer Application & Information Technology)
(Gujarat University)
3. Index
No. Subject Page
1. Project Profile 1
2. System Required Specification 2
3. Database Design
3.1 E-R Diagram 3
3.2 Data Dictionary 4
3
4. Screen Shots 5
5. Coding 16
6. Bibliography 69
4. 1
1. Project Profile
Project Name: TECHNOMANTRA App.
Group Id: 15.
Group Member: 3.
We develop Technomantra app for students. By this app they can register with their
android mobile and participate in singles event. For this they has not meet to any
volunteer of event it’s reduce some work of volunteer also and students can easily get
access of technomatra app and participate in the event and get information about the
event and also see the gallery of the event and they can also watch the schedule of the
event.this app is very helpful to technomatra’s volunteer and for our collage who
organise this event.
Tools & Technology Used
• JDK (Java Development Kit)
• Android SDK(By Google)
Front End Tools
• Eclipse
• Adobe Photoshop
Back End Tools
• SQL Server Management Studio – 2012
• Microsoft Visual Studio 2013 for Web Service
5. 2
2. System Required Specification (SRS)
Scope of Project
• JDK (Java Development Kit)
• Android SDK(By Google)
Users
• Students
Features and Requirement
• Student Can View Event Detail.
• Student Can Register Them In Technomantra.
• Student Can Participate In Any Event.
• Student Can Also View Schedule of the All Event.
6. 3
3. Database Design
3.1 E-R Diagram
Visitor Can View
EventRegistration &
Login
Student Can View &
Participate
userid
password
degree
name
collage_name
phone
event_name
userid
id
7. 4
3.2 Data Dictionary
Event_Participate
Name Data Type
Id int
user_name varchar(100)
event_name varchar(100)
Student_Info
Name Data Type
Regid int
Name varchar(50)
Email varchar(100)
Password varchar(30)
Phone varchar(11)
Collage varchar(100)
Degree varchar(50)
Year varchar(50)
City varchar(50)
22. 19
android:hint="Enter E-Mail Id"
android:inputType="textEmailAddress" >
<requestFocus />
</EditText>
<Button
android:id="@+id/btn_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/lgn_edt_password"
android:layout_centerHorizontal="true"
android:layout_marginTop="36dp"
android:background="@drawable/buttonshape"
android:shadowColor="#A1A2A8"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="5"
android:text="@string/submit"
android:textColor="#FFF7FD"
android:textSize="30sp" />
<EditText
android:id="@+id/lgn_edt_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/lgn_edt_mail"
android:layout_below="@+id/lgn_edt_mail"
android:layout_marginTop="36dp"
android:ems="10"
android:hint="Enter Password"
android:inputType="textPassword" />
</RelativeLayout>
activity_logout.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"
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=".LogoutActivity" >
</RelativeLayout>
31. 28
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="26dp"
android:text="User Id" />
</RelativeLayout>
SplashActivity.java
package com.example.technomantra;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
public class SplashActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
getActionBar().hide();
new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Intent intent = new
Intent(getApplicationContext(),HomeActivity.class);
startActivity(intent);
finish();
}
}).start();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.splash, menu);
return true;
}
}
32. 29
RegistrationActivity.java
public class RegistrationActivity extends Activity implements
OnItemSelectedListener {
EditText edt_name, edt_email, edt_password, edt_confirm, edt_mobile;
AutoCompleteTextView acv_college, acv_city;
Spinner spn_degree, spn_year;
Button btn_registration;
private String name, email, confirm_password, password, mobile, college,
degree, city, year;
// DatabaseHelper databaseHelper;
/*
* SQLiteDatabase database; ContentValues contentValues; Cursor cursor;
*/
String Year[] = { "Select Year", "First Year", "Second Year", "Third Year",
"Fourth Year", "Fifth Year" };
final String[] Degree = { "Select Your Degree", "B.Sc(IT)", "BCA",
"B.E (IT)", "M.Sc(IT)", "MCA" };
RegistrationBean registrationBean = new RegistrationBean();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration);
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new
ColorDrawable(Color.parseColor("#00B9F5")));
bar.setTitle(Html.fromHtml("<font color='#ffffff'>Technomantra</font>"));
// databaseHelper = new DatabaseHelper(this);
Log.i("Create Object", "1");
edt_name = (EditText) findViewById(R.id.lgn_edt_mail);
edt_email = (EditText) findViewById(R.id.lgn_edt_password);
edt_password = (EditText) findViewById(R.id.edt_password);
edt_confirm = (EditText) findViewById(R.id.edit_confirm_password);
edt_mobile = (EditText) findViewById(R.id.edt_mobile);
acv_college = (AutoCompleteTextView)
findViewById(R.id.autoComplete_college);
spn_degree = (Spinner) findViewById(R.id.spinner1);
spn_year = (Spinner) findViewById(R.id.spinner2);
acv_city = (AutoCompleteTextView) findViewById(R.id.autoComplete_city);
btn_registration = (Button) findViewById(R.id.btn_registration);
ArrayAdapter<String> DegreeList = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_dropdown_item, Degree);
33. 30
spn_degree.setAdapter(DegreeList);
spn_degree.setOnItemSelectedListener(this);
ArrayAdapter<String> AcadamicYear = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_dropdown_item, Year);
spn_year.setAdapter(AcadamicYear);
spn_year.setOnItemSelectedListener(this);
getViews();
btn_registration.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
getAllStrings();
Log.i("", name);
Log.i("", degree);
Log.i("", year);
Log.i("", college);
Log.i("", city);
if (name.equals("")) {
edt_name.requestFocus();
edt_name.setText("");
edt_name.setHintTextColor(Color.parseColor("#122345"));
edt_name.setHint("Field can not be empty");
} else if (email.equals("")) {
edt_email.requestFocus();
edt_email.setText("");
edt_email.setHintTextColor(Color.parseColor("#122345"));
edt_email.setHint("Field can not be empty");
} else if (password.equals("")) {
edt_password.requestFocus();
edt_password.setText("");
edt_password.setHintTextColor(Color.parseColor("#122345"));
edt_password.setHint("Field can not be empty");
} else if (confirm_password.equals("")) {
edt_confirm.requestFocus();
edt_confirm.setText("");
edt_confirm.setHintTextColor(Color.parseColor("#122345"));
edt_confirm.setHint("Field can not be empty");
} else if (mobile.equals("")) {
edt_mobile.requestFocus();
edt_mobile.setText("");
edt_mobile.setHintTextColor(Color.parseColor("#122345"));
edt_mobile.setHint("Field can not be empty");
} else if (college.equals("")) {
34. 31
acv_college.requestFocus();
acv_college.setText("");
acv_college.setHintTextColor(Color.parseColor("#122345"));
acv_college.setHint("Field can not be empty");
} else if (!password.equals(confirm_password)) {
Toast.makeText(getApplicationContext(),
"Password does not match",
Toast.LENGTH_SHORT)
.show();
} else if (degree.equals("")) {
spn_degree.requestFocus();
} else if (year.equals("")) {
Toast.makeText(getApplicationContext(),
"Please select Your Acadamic Year",
Toast.LENGTH_SHORT).show();
} else if (city.equals("")) {
acv_city.requestFocus();
acv_city.setText("");
acv_city.setHintTextColor(Color.parseColor("#122345"));
acv_city.setHint("Field can not be empty");
} else {
Log.i("", "Cll the class");
new GetRegister().execute();
}
}
private void getAllStrings() {
// TODO Auto-generated method stub
name = edt_name.getText().toString().trim();
name = name.replaceAll(" ", "%20");
email = edt_email.getText().toString().trim();
password = edt_password.getText().toString().trim();
confirm_password = edt_confirm.getText().toString().trim();
mobile = edt_mobile.getText().toString().trim();
college = acv_college.getText().toString().trim();
college = college.replaceAll(" ", "%20");
degree = spn_degree.getSelectedItem().toString().trim();
degree = degree.replaceAll(" ", "%20");
year = spn_year.getSelectedItem().toString().trim();
year = year.replaceAll(" ", "%20");
city = acv_city.getText().toString().trim();
}
});
}
private void getViews() {
35. 32
// TODO Auto-generated method stub
edt_name = (EditText) findViewById(R.id.lgn_edt_mail);
edt_email = (EditText) findViewById(R.id.lgn_edt_password);
edt_password = (EditText) findViewById(R.id.edt_password);
edt_confirm = (EditText) findViewById(R.id.edit_confirm_password);
edt_mobile = (EditText) findViewById(R.id.edt_mobile);
acv_college = (AutoCompleteTextView)
findViewById(R.id.autoComplete_college);
spn_degree = (Spinner) findViewById(R.id.spinner1);
spn_year = (Spinner) findViewById(R.id.spinner2);
acv_city = (AutoCompleteTextView) findViewById(R.id.autoComplete_city);
btn_registration = (Button) findViewById(R.id.btn_registration);
}
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
public class GetRegister extends AsyncTask<Void, Void, Void> {
ProgressDialog pDialog;
HttpURLConnection urlConnection;
StringBuffer response;
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(RegistrationActivity.this);
pDialog.setMessage("Registering ...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
// OutputStream os;
Log.i("", "doInBackground");
try {
Log.i("", "try block");
URL url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/registration_user?name="
+ name
+ "&email="
+ email
36. 33
+ "&password="
+ password
+ "&phone="
+ mobile
+ "&college="
+ college
+ "°ree="
+ degree
+ "&year="
+ year + "&city=" + city);
// URL url = new
// URL("http://lalitjadav-001-
site1.atempurl.com/QDMasterService.asmx/Login?email=jadav.lalit57@gmail.com&pass=la
lit");
Log.i("", url + "");
urlConnection = (HttpURLConnection) url.openConnection();
Log.i("", urlConnection + "");
InputStream is = urlConnection.getInputStream();
Log.i("", is + "");
BufferedReader br = new BufferedReader(
new InputStreamReader(is));
String inputLine;
response = new StringBuffer();
while ((inputLine = br.readLine()) != null) {
Log.i("intput line values", inputLine + "");
response.append(inputLine);
}
br.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
Log.i("", "Call on post");
if (pDialog.isShowing()) {
Log.i("web responce return", response + "");
pDialog.cancel();
Log.i("web responce return", response + "");
String str = response.toString();
str = str.replace("<?xml version="1.0" encoding="utf-8"?>",
"");
37. 34
if (str.contains("1")) {
Toast.makeText(getApplicationContext(),
"Register successfully",
Toast.LENGTH_SHORT).show();
onBackPressed();
startActivity(new Intent(getApplicationContext(),
HomeActivity.class));
} else if (str.contains("0")) {
Toast.makeText(getApplicationContext(),
"User Already Exists",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(),
"Response not found",
Toast.LENGTH_SHORT).show();
}
}
}
}
}
HomeActivity.java
public class HomeActivity extends Activity {
Button btn_registration, btn_login;
Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new
ColorDrawable(Color.parseColor("#00B9F5")));
bar.setTitle(Html.fromHtml("<font color='#ffffff'>Technomantra</font>"));
// getSupportActionBar().setBackgroundDrawable(new
// ColorDrawable(Color.parseColor("#00b668")));
btn_registration = (Button) findViewById(R.id.btn_registration);
btn_login = (Button) findViewById(R.id.btn_login);
btn_registration.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
intent = new Intent(getApplicationContext(),
RegistrationActivity.class);
startActivity(intent);
}
38. 35
});
btn_login.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
intent = new Intent(getApplicationContext(),
LoginActivity.class);
startActivity(intent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.home, menu);
return true;
}
}
LoginActivity.java
public class LoginActivity extends Activity {
EditText username, password;
Button btn_submit;
static String user;
String pass;
public static SharedPreferences preferences;
static String MYPreference="";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new
ColorDrawable(Color.parseColor("#00B9F5")));
bar.setTitle(Html.fromHtml("<font color='#ffffff'>Technomantra</font>"));
preferences = getSharedPreferences(LoginActivity.MYPreference,
Context.MODE_PRIVATE);
username = (EditText) findViewById(R.id.lgn_edt_mail);
password = (EditText) findViewById(R.id.lgn_edt_password);
39. 36
Log.i("", username + "");
Log.i("", password + "");
btn_submit = (Button) findViewById(R.id.btn_submit);
btn_submit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
setValues();
if (user.equals("")) {
username.requestFocus();
username.setText("");
username.setHintTextColor(Color.parseColor("#122345"));
username.setHint("Enter User Id");
} else if (pass.equals("")) {
password.requestFocus();
password.setText("");
password.setHintTextColor(Color.parseColor("#122345"));
password.setHint("Enter Password");
} else {
// Check to the username and password
new GetLogin().execute();
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.login, menu);
return true;
}
public void setValues() {
user = username.getText().toString().trim();
user.replaceAll(" ", "%20");
pass = password.getText().toString().trim();
pass.replaceAll(" ", "%20");
}
public class GetLogin extends AsyncTask<Void, Void, Void> {
ProgressDialog dialog;
HttpURLConnection urlConnection;
StringBuffer buffer;
40. 37
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
dialog = new ProgressDialog(LoginActivity.this);
dialog.setMessage("Wait...");
dialog.setCancelable(false);
dialog.show();
}
@Override
protected Void doInBackground(Void... arg0) {
// TODO Auto-generated method stub
try {
URL url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/login_check?email="
+ user + "&password=" + pass);
Log.i("", url + "");
urlConnection = (HttpURLConnection) url.openConnection();
Log.i("", urlConnection + "");
InputStream is = urlConnection.getInputStream();
Log.i("", is + "");
BufferedReader br = new BufferedReader(
new InputStreamReader(is));
String inputLine;
buffer = new StringBuffer();
while ((inputLine = br.readLine()) != null) {
Log.i("intput line values", inputLine + "");
buffer.append(inputLine);
}
br.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
Log.i("", "Call on post");
if (dialog.isShowing()) {
Log.i("web responce return", buffer + "");
41. 38
dialog.cancel();
Log.i("web responce return", buffer + "");
String str = buffer.toString();
str = str.replace("<?xml version="1.0" encoding="utf-8"?>",
"");
if (str.contains("1")) {
Toast.makeText(getApplicationContext(),
"Login successfully",
Toast.LENGTH_SHORT).show();
//onBackPressed();
final GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
globalVariable.setIsLogin(true);
globalVariable.setUsername(user);
Editor editor = preferences.edit();
editor.putString("user_id", user);
editor.commit();
startActivity(new Intent(getApplicationContext(),
MainActivity.class));
} else if (str.contains("0")) {
Toast.makeText(getApplicationContext(),
"Enter Valid Email Id or Password",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(),
"Response not found",
Toast.LENGTH_SHORT).show();
}
}
}
}
}
MainActivity.java
public class MainActivity extends Activity {
Button btn_gallery, btn_events, btn_contact, btn_about, btn_schedule,
btn_user_account, btn_logout;
SharedPreferences preferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar bar = getActionBar();
42. 39
bar.setBackgroundDrawable(new
ColorDrawable(Color.parseColor("#00B9F5")));
bar.setTitle(Html.fromHtml("<font color='#ffffff'>Technomantra</font>"));
btn_gallery = (Button) findViewById(R.id.btn_gallery);
btn_events = (Button) findViewById(R.id.btn_events);
btn_schedule = (Button) findViewById(R.id.btn_schedule);
btn_contact = (Button) findViewById(R.id.btn_contact);
btn_about = (Button) findViewById(R.id.btn_about);
btn_logout = (Button) findViewById(R.id.btn_add_sense);
btn_user_account = (Button) findViewById(R.id.btn_user_account);
btn_gallery.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent(getApplicationContext(),
GalleryActivity.class);
startActivity(intent);
}
});
btn_about.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
startActivity(new Intent(getApplicationContext(),
AboutusActivity.class));
}
});
btn_contact.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent(getApplicationContext(),
ContactusActivity.class));
}
});
btn_events.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
startActivity(new Intent(getApplicationContext(),
EventActivity.class));
}
});
btn_user_account.setOnClickListener(new OnClickListener() {
43. 40
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
new EventParticipant().execute();
}
});
btn_logout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
preferences =
getSharedPreferences(LoginActivity.MYPreference,
Context.MODE_PRIVATE);
String isLogin = preferences.getString(LoginActivity.user, "");
if (isLogin != null) {
Editor editor = preferences.edit();
editor.clear();
GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
if (globalVariable.getIsLogin()) {
globalVariable.setIsLogin(false);
startActivity(new
Intent(getApplicationContext(),
HomeActivity.class));
}
}
}
});
}
@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;
}
public class EventParticipant extends AsyncTask<Void, Void, Void> {
ProgressDialog pDialog;
HttpURLConnection urlConnection;
StringBuffer response;
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
pDialog = new ProgressDialog(MainActivity.this);
pDialog.setMessage("Wait ...");
pDialog.setCancelable(false);
pDialog.show();
44. 41
}
@Override
protected Void doInBackground(Void... params) {
// TODO Auto-generated method stub
Log.i("", "doInBackground");
try {
Log.i("", "try block");
GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
URL url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_part?userid="
+ globalVariable.getUsername());
// URL url = new
// URL("http://lalitjadav-001-
site1.atempurl.com/QDMasterService.asmx/Login?email=jadav.lalit57@gmail.com&pass=la
lit");
Log.i("URL : ", url + "");
urlConnection = (HttpURLConnection) url.openConnection();
Log.i("", urlConnection + "");
InputStream is = urlConnection.getInputStream();
Log.i("", is + "");
BufferedReader br = new BufferedReader(
new InputStreamReader(is));
String inputLine;
response = new StringBuffer();
while ((inputLine = br.readLine()) != null) {
Log.i("intput line values", inputLine + "");
response.append(inputLine);
}
br.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
Log.i("", "Call on post");
if (pDialog.isShowing()) {
Log.i("web responce return", response + "");
pDialog.cancel();
45. 42
Log.i("web responce return", response + "");
String str = response.toString();
str = str.replace("<?xml version="1.0" encoding="utf-8"?>",
"");
if (str.contains("1")) {
startActivity(new Intent(getApplicationContext(),
UserProfileActivity.class));
/*
* Toast.makeText(getApplicationContext(),
* "Successful Participed",
Toast.LENGTH_SHORT).show();
*/
// onBackPressed();
} else if (str.contains("0")) {
Toast.makeText(getApplicationContext(),
"Your are not participate in any events",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(),
"Response not found",
Toast.LENGTH_SHORT).show();
}
}
}
}
}
TechnicalEventActivity.java
public class TechnicalEventActivity extends Activity {
Button btn_technopreneur, btn_codewar, btn_database, btn_apps;
String techno_event = "technopreneur";
String code_event = "codewar";
String database_event = "database";
String app_event = "app";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_technical_event);
/*
* ActionBar bar = getActionBar(); bar.setBackgroundDrawable(new
* ColorDrawable(Color.parseColor("#00B9F5")));
* bar.setTitle(Html.fromHtml
* ("<font color='#ffffff'>Technomantra</font>"));
*/
46. 43
btn_technopreneur = (Button) findViewById(R.id.btn_add_sense);
btn_codewar = (Button) findViewById(R.id.btn_quiz_master);
btn_database = (Button) findViewById(R.id.btn_fashionista);
btn_apps = (Button) findViewById(R.id.btn_trade_fb);
final GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
final Boolean text = globalVariable.getIsLogin();
Log.i("isLogin", text + "");
Log.i("isLogin", globalVariable.getUsername());
btn_technopreneur.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if (text) {
new CheckEventParticipant(techno_event).execute();
}
}
});
btn_codewar.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (text) {
new CheckEventParticipant(code_event).execute();
}
}
});
btn_database.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (text) {
new CheckEventParticipant(database_event).execute();
}
}
});
btn_apps.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (text) {
new CheckEventParticipant(app_event).execute();
}
47. 44
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.technical_event, menu);
return true;
}
public class CheckEventParticipant extends AsyncTask<Void, Void, Void> {
ProgressDialog pDialog;
HttpURLConnection urlConnection;
StringBuffer response;
String event = null;
public CheckEventParticipant(String event) {
// TODO Auto-generated constructor stub
Log.i("Event con", event);
this.event = event;
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
pDialog = new ProgressDialog(TechnicalEventActivity.this);
pDialog.setMessage("Wait ...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... arg0) {
// TODO Auto-generated method stub
URL url = null;
try {
Log.i("", "try block");
GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
if (event.equals(techno_event)) {
Log.i("Events", techno_event);
url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_event_participant?email="
+
globalVariable.getUsername()
+ "&event_name=" +
event);
48. 45
} else if (event.equals(code_event)) {
Log.i("Events", code_event);
url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_event_participant?email="
+
globalVariable.getUsername()
+ "&event_name=" +
event);
} else if (event.equals(database_event)) {
Log.i("Events", database_event);
url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_event_participant?email="
+
globalVariable.getUsername()
+ "&event_name=" +
event);
} else if (event.equals(app_event)) {
Log.i("Events", app_event);
url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_event_participant?email="
+
globalVariable.getUsername()
+ "&event_name=" +
event);
} else {
}
// URL url = new
// URL("http://lalitjadav-001-
site1.atempurl.com/QDMasterService.asmx/Login?email=jadav.lalit57@gmail.com&pass=la
lit");
Log.i("", url + "");
urlConnection = (HttpURLConnection) url.openConnection();
Log.i("", urlConnection + "");
InputStream is = urlConnection.getInputStream();
Log.i("", is + "");
BufferedReader br = new BufferedReader(
new InputStreamReader(is));
String inputLine;
response = new StringBuffer();
while ((inputLine = br.readLine()) != null) {
Log.i("intput line values", inputLine + "");
response.append(inputLine);
}
49. 46
br.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
Log.i("", "Call on post");
if (pDialog.isShowing()) {
Log.i("web responce return", response + "");
pDialog.cancel();
Log.i("web responce return", response + "");
String str = response.toString();
str = str.replace("<?xml version="1.0" encoding="utf-8"?>",
"");
if (str.contains("1")) {
/*
* Toast.makeText(getApplicationContext(),
* "Successful Participed",
Toast.LENGTH_SHORT).show();
*/
// onBackPressed();
if (event.equals(techno_event)) {
globalVariable.setChecktechno("1");
startActivity(new
Intent(getApplicationContext(),
TechnopreneurActivity.class));
} else if (event.equals(code_event)) {
globalVariable.setCheckCodewar("1");
startActivity(new
Intent(getApplicationContext(),
CodewarActivity.class));
} else if (event.equals(database_event)) {
globalVariable.setCheckDatabase("1");
startActivity(new
Intent(getApplicationContext(),
DatabaseMasterActivity.class));
} else if (app_event.equals(app_event)) {
50. 47
globalVariable.setCheckApp("1");
startActivity(new
Intent(getApplicationContext(),
AppEtizerActivity.class));
}
} else if (str.contains("0")) {
/*
* startActivity(new Intent(getApplicationContext(),
* TechnopreneurActivity.class));
*/
/*
* Toast.makeText(getApplicationContext(),
* "User Already Participate",
Toast.LENGTH_SHORT) .show();
*/
if (event.equals("technopreneur")) {
Log.i("Event", "technopreneur");
globalVariable.setChecktechno("0");
startActivity(new
Intent(getApplicationContext(),
TechnopreneurActivity.class));
} else if (event.equals("codewar")) {
globalVariable.setCheckCodewar("0");
startActivity(new
Intent(getApplicationContext(),
CodewarActivity.class));
} else if (event.equals("database")) {
globalVariable.setCheckDatabase("0");
startActivity(new
Intent(getApplicationContext(),
DatabaseMasterActivity.class));
} else if (event.equals("app")) {
globalVariable.setCheckApp("0");
startActivity(new
Intent(getApplicationContext(),
AppEtizerActivity.class));
}
} else {
Toast.makeText(getApplicationContext(),
"Response not found",
Toast.LENGTH_SHORT).show();
}
}
}
}
}
51. 48
SoftSkillEventActivity.java
public class SoftSkillEventActivity extends Activity {
Button btn_add_sense, btn_quiz_master, btn_fashionista, btn_trade_fb;
String addsense_event = "addsense";
String quizmaster_event = "quizmaster";
String fashionista_event = "fashionista";
String tradefb_event = "tradefb";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_soft_skill_event);
btn_add_sense = (Button) findViewById(R.id.btn_add_sense);
btn_quiz_master = (Button) findViewById(R.id.btn_quiz_master);
btn_fashionista = (Button) findViewById(R.id.btn_fashionista);
btn_trade_fb = (Button) findViewById(R.id.btn_trade_fb);
final GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
final Boolean text = globalVariable.getIsLogin();
Log.i("isLogin", text + "");
Log.i("isLogin", globalVariable.getUsername());
btn_add_sense.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if (text) {
new CheckEventParticipant(addsense_event).execute();
}
}
});
btn_quiz_master.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (text) {
new
CheckEventParticipant(quizmaster_event).execute();
}
}
});
btn_fashionista.setOnClickListener(new OnClickListener() {
@Override
52. 49
public void onClick(View v) {
// TODO Auto-generated method stub
if (text) {
new
CheckEventParticipant(fashionista_event).execute();
}
}
});
btn_trade_fb.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (text) {
new CheckEventParticipant(tradefb_event).execute();
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.soft_skill_event, menu);
return true;
}
public class CheckEventParticipant extends AsyncTask<Void, Void, Void> {
ProgressDialog pDialog;
HttpURLConnection urlConnection;
StringBuffer response;
String event = null;
public CheckEventParticipant(String event) {
// TODO Auto-generated constructor stub
this.event = event;
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
pDialog = new ProgressDialog(SoftSkillEventActivity.this);
pDialog.setMessage("Wait ...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
53. 50
protected Void doInBackground(Void... arg0) {
// TODO Auto-generated method stub
URL url = null;
try {
Log.i("", "try block");
GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
if (event.equals(addsense_event)) {
Log.i("Events", addsense_event);
addsense_event.replaceAll(" ", "%20");
url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_event_participant?email="
+
globalVariable.getUsername()
+ "&event_name=" +
addsense_event);
} else if (event.equals(quizmaster_event)) {
Log.i("Events", quizmaster_event);
quizmaster_event.replaceAll(" ", "%20");
url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_event_participant?email="
+
globalVariable.getUsername()
+ "&event_name=" +
quizmaster_event);
} else if (event.equals(fashionista_event)) {
fashionista_event.replaceAll(" ", "%20");
Log.i("Events", fashionista_event);
url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_event_participant?email="
+
globalVariable.getUsername()
+ "&event_name=" +
fashionista_event);
} else if (event.equals(tradefb_event)) {
Log.i("Events", tradefb_event);
tradefb_event.replaceAll(" ", "%20");
url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_event_participant?email="
+
globalVariable.getUsername()
+ "&event_name=" +
tradefb_event);
} else {
54. 51
}
// URL url = new
// URL("http://lalitjadav-001-
site1.atempurl.com/QDMasterService.asmx/Login?email=jadav.lalit57@gmail.com&pass=la
lit");
Log.i("", url + "");
urlConnection = (HttpURLConnection) url.openConnection();
Log.i("", urlConnection + "");
InputStream is = urlConnection.getInputStream();
Log.i("", is + "");
BufferedReader br = new BufferedReader(
new InputStreamReader(is));
String inputLine;
response = new StringBuffer();
while ((inputLine = br.readLine()) != null) {
Log.i("intput line values", inputLine + "");
response.append(inputLine);
}
br.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
Log.i("", "Call on post");
if (pDialog.isShowing()) {
Log.i("web responce return", response + "");
pDialog.cancel();
Log.i("web responce return", response + "");
String str = response.toString();
str = str.replace("<?xml version="1.0" encoding="utf-8"?>",
"");
if (str.contains("1")) {
/*
* Toast.makeText(getApplicationContext(),
55. 52
* "Successful Participed",
Toast.LENGTH_SHORT).show();
*/
// onBackPressed();
if (event.equals(addsense_event)) {
globalVariable.setChecktechno("1");
startActivity(new
Intent(getApplicationContext(),
Add_Sense_Activity.class));
} else if (event.equals(quizmaster_event)) {
globalVariable.setCheckCodewar("1");
startActivity(new
Intent(getApplicationContext(),
Quiz_Master_Activity.class));
} else if (event.equals(fashionista_event)) {
globalVariable.setCheckDatabase("1");
startActivity(new
Intent(getApplicationContext(),
FashionistaActivity.class));
} else if (event.equals(tradefb_event)) {
globalVariable.setCheckApp("1");
startActivity(new
Intent(getApplicationContext(),
Trade_FbActivity.class));
}
} else if (str.contains("0")) {
/*
* startActivity(new Intent(getApplicationContext(),
* TechnopreneurActivity.class));
*/
/*
* Toast.makeText(getApplicationContext(),
* "User Already Participate",
Toast.LENGTH_SHORT) .show();
*/
if (event.equals(addsense_event)) {
Log.i("Event", "addsense_event");
globalVariable.setChecktechno("0");
startActivity(new
Intent(getApplicationContext(),
Add_Sense_Activity.class));
} else if (event.equals(quizmaster_event)) {
globalVariable.setCheckCodewar("0");
startActivity(new
Intent(getApplicationContext(),
Quiz_Master_Activity.class));
} else if (event.equals(fashionista_event)) {
56. 53
globalVariable.setCheckDatabase("0");
startActivity(new
Intent(getApplicationContext(),
FashionistaActivity.class));
} else if (event.equals(tradefb_event)) {
globalVariable.setCheckApp("0");
startActivity(new
Intent(getApplicationContext(),
Trade_FbActivity.class));
}
} else {
Toast.makeText(getApplicationContext(),
"Response not found",
Toast.LENGTH_SHORT).show();
}
}
}
}
}
CreativeEventsActivity.java
public class CreativeEventsActivity extends Activity {
Button btn_kabad_se_jugaad, btn_post_ur_thoughts, btn_camera,
btn_satrangi_it;
String kabad_event = "kabadsejugaad";
String post_event = "postyourthoughts";
String camera_event = "lightscameraaction";
String satrangi_event = "satrangiit";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_creative_events);
/*
* ActionBar bar = getActionBar(); bar.setBackgroundDrawable(new
* ColorDrawable(Color.parseColor("#00B9F5")));
* bar.setTitle(Html.fromHtml
* ("<font color='#ffffff'>Technomantra</font>"));
*/
btn_kabad_se_jugaad = (Button) findViewById(R.id.btn_kabad);
btn_post_ur_thoughts = (Button) findViewById(R.id.btn_postyourthoughts);
btn_camera = (Button) findViewById(R.id.btn_lightscameraaction);
btn_satrangi_it = (Button) findViewById(R.id.btn_satrangiit);
final GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
57. 54
final Boolean text = globalVariable.getIsLogin();
btn_kabad_se_jugaad.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if (text) {
new CheckEventParticipant(kabad_event).execute();
}
}
});
btn_post_ur_thoughts.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if (text) {
new CheckEventParticipant(post_event).execute();
}
}
});
btn_camera.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if (text) {
new CheckEventParticipant(camera_event).execute();
}
}
});
btn_satrangi_it.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if (text) {
new CheckEventParticipant(satrangi_event).execute();
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
58. 55
getMenuInflater().inflate(R.menu.creative_events, menu);
return true;
}
public class CheckEventParticipant extends AsyncTask<Void, Void, Void> {
ProgressDialog pDialog;
HttpURLConnection urlConnection;
StringBuffer response;
String event = null;
public CheckEventParticipant(String event) {
// TODO Auto-generated constructor stub
this.event = event;
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
pDialog = new ProgressDialog(CreativeEventsActivity.this);
pDialog.setMessage("Wait ...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... arg0) {
// TODO Auto-generated method stub
URL url = null;
try {
Log.i("", "try block");
GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
if (event.equals(kabad_event)) {
Log.i("Events", kabad_event);
kabad_event.replaceAll(" ", "%20");
url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_event_participant?email="
+
globalVariable.getUsername()
+ "&event_name=" +
kabad_event);
} else if (event.equals(post_event)) {
Log.i("Events", post_event);
post_event.replaceAll(" ", "%20");
url = new URL(
59. 56
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_event_participant?email="
+
globalVariable.getUsername()
+ "&event_name=" +
post_event);
} else if (event.equals(camera_event)) {
camera_event.replaceAll(" ", "%20");
Log.i("Events", camera_event);
url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_event_participant?email="
+
globalVariable.getUsername()
+ "&event_name=" +
camera_event);
} else if (event.equals(satrangi_event)) {
Log.i("Events", satrangi_event);
satrangi_event.replaceAll(" ", "%20");
url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/check_event_participant?email="
+
globalVariable.getUsername()
+ "&event_name=" +
satrangi_event);
} else {
}
// URL url = new
// URL("http://lalitjadav-001-
site1.atempurl.com/QDMasterService.asmx/Login?email=jadav.lalit57@gmail.com&pass=la
lit");
Log.i("", url + "");
urlConnection = (HttpURLConnection) url.openConnection();
Log.i("", urlConnection + "");
InputStream is = urlConnection.getInputStream();
Log.i("", is + "");
BufferedReader br = new BufferedReader(
new InputStreamReader(is));
String inputLine;
response = new StringBuffer();
while ((inputLine = br.readLine()) != null) {
Log.i("intput line values", inputLine + "");
response.append(inputLine);
}
br.close();
60. 57
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
Log.i("", "Call on post");
if (pDialog.isShowing()) {
Log.i("web responce return", response + "");
pDialog.cancel();
Log.i("web responce return", response + "");
String str = response.toString();
str = str.replace("<?xml version="1.0" encoding="utf-8"?>",
"");
if (str.contains("1")) {
/*
* Toast.makeText(getApplicationContext(),
* "Successful Participed",
Toast.LENGTH_SHORT).show();
*/
// onBackPressed();
if (event.equals(kabad_event)) {
globalVariable.setChecktechno("1");
startActivity(new
Intent(getApplicationContext(),
Kabad_se_jugaadActivity.class));
} else if (event.equals(post_event)) {
globalVariable.setCheckCodewar("1");
startActivity(new
Intent(getApplicationContext(),
Post_Your_ThoughtsActivity.class));
} else if (event.equals(camera_event)) {
globalVariable.setCheckDatabase("1");
startActivity(new
Intent(getApplicationContext(),
Lights_camera_actionActivity.class));
} else if (event.equals(satrangi_event)) {
61. 58
globalVariable.setCheckApp("1");
startActivity(new
Intent(getApplicationContext(),
Satrangi_itActivity.class));
}
} else if (str.contains("0")) {
/*
* startActivity(new Intent(getApplicationContext(),
* TechnopreneurActivity.class));
*/
/*
* Toast.makeText(getApplicationContext(),
* "User Already Participate",
Toast.LENGTH_SHORT) .show();
*/
if (event.equals(kabad_event)) {
Log.i("Event", "kabad_event");
globalVariable.setChecktechno("0");
startActivity(new
Intent(getApplicationContext(),
Kabad_se_jugaadActivity.class));
} else if (event.equals(post_event)) {
globalVariable.setCheckCodewar("0");
startActivity(new
Intent(getApplicationContext(),
Post_Your_ThoughtsActivity.class));
} else if (event.equals(camera_event)) {
globalVariable.setCheckDatabase("0");
startActivity(new
Intent(getApplicationContext(),
Lights_camera_actionActivity.class));
} else if (event.equals(satrangi_event)) {
globalVariable.setCheckApp("0");
startActivity(new
Intent(getApplicationContext(),
Satrangi_itActivity.class));
}
} else {
Toast.makeText(getApplicationContext(),
"Response not found",
Toast.LENGTH_SHORT).show();
}
}
}
}
62. 59
}
CodewarActivity.java
public class CodewarActivity extends Activity {
WebView web_codewar;
Button btn_codewar_participate;
public static final String eventName = "codewar";
String htmlText = "<html><body style="text-align:justify"> %s </body></Html>";
String detail = "Beat the master mind.<br>"
+ "Rounds:<br>"
+ "1 First stage is proving exploration of your knowledge, In which
you can provide suitable output according to the code.<br>"
+ "2 Second stage is the develop round, In which you can design and
develop the code and become the big boss of the code cracker<br>."
+ "Special Opportunities:<br>"
+ "This event is open for all inter colleges and also including the
students of (c/c++) training institutes.<br>"
+ "Note:<br>"
+ "Participant must report at least 15 min before staring of the
event.<br>"
+ "Id card must compulsory for every participant.<br>"
+ "Participant should perform the task individually.<br>"
+ "The final decision is given by judges.<br>"
+ "College Level Entry Fee-80<br>";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_codewar);
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new
ColorDrawable(Color.parseColor("#00B9F5")));
bar.setTitle(Html.fromHtml("<font color='#ffffff'>Technomantra</font>"));
btn_codewar_participate = (Button)
findViewById(R.id.btn_codewar_participate);
web_codewar = (WebView) findViewById(R.id.webview_codewar);
web_codewar.loadData(String.format(htmlText, detail), "text/html",
"utf-8");
GlobalVariable globalVariable = (GlobalVariable) getApplicationContext();
if (globalVariable.getCheckCodewar().equals("1")) {
// globalVariable.setCheckCodewar("0");
btn_codewar_participate.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
63. 60
// TODO Auto-generated method stub
GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
if (globalVariable.getIsLogin()) {
new EventParticipant().execute();
} else {
btn_codewar_participate.setEnabled(false);
btn_codewar_participate.setText("participated");
btn_codewar_participate.setBackgroundColor(0xFFFF0000);
}
}
});
} else {
btn_codewar_participate.setEnabled(false);
btn_codewar_participate.setText("participated");
btn_codewar_participate.setBackgroundColor(0xFFFF0000);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.codewar, menu);
return true;
}
public class EventParticipant extends AsyncTask<Void, Void, Void> {
ProgressDialog pDialog;
HttpURLConnection urlConnection;
StringBuffer response;
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
pDialog = new ProgressDialog(CodewarActivity.this);
pDialog.setMessage("Wait ...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
// TODO Auto-generated method stub
Log.i("", "doInBackground");
try {
GlobalVariable globalVariable = (GlobalVariable)
getApplicationContext();
64. 61
Log.i("", "try block");
URL url = new URL(
"http://avatar-001-
site1.atempurl.com/TechnoMantra.asmx/event_registration?email="
+ globalVariable.getUsername()
+ "&event_name="
+ eventName);
// URL url = new
// URL("http://lalitjadav-001-
site1.atempurl.com/QDMasterService.asmx/Login?email=jadav.lalit57@gmail.com&pass=la
lit");
Log.i("", url + "");
urlConnection = (HttpURLConnection) url.openConnection();
Log.i("", urlConnection + "");
InputStream is = urlConnection.getInputStream();
Log.i("", is + "");
BufferedReader br = new BufferedReader(
new InputStreamReader(is));
String inputLine;
response = new StringBuffer();
while ((inputLine = br.readLine()) != null) {
Log.i("intput line values", inputLine + "");
response.append(inputLine);
}
br.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
Log.i("", "Call on post");
if (pDialog.isShowing()) {
Log.i("web responce return", response + "");
pDialog.cancel();
Log.i("web responce return", response + "");
String str = response.toString();
str = str.replace("<?xml version="1.0" encoding="utf-8"?>",
"");
if (str.contains("1")) {
66. 63
GlobalVariable.java
public class GlobalVariable extends Application {
private Boolean isLogin;
private String username;
private String eventName;
private String checktechno;
public String getChecktechno() {
return checktechno;
}
public void setChecktechno(String checktechno) {
this.checktechno = checktechno;
}
public String getCheckCodewar() {
return checkCodewar;
}
public void setCheckCodewar(String checkCodewar) {
this.checkCodewar = checkCodewar;
}
public String getCheckDatabase() {
return checkDatabase;
}
public void setCheckDatabase(String checkDatabase) {
this.checkDatabase = checkDatabase;
}
public String getCheckApp() {
return checkApp;
}
public void setCheckApp(String checkApp) {
this.checkApp = checkApp;
}
private String checkCodewar;
private String checkDatabase;
private String checkApp;
public String getEventName() {
return eventName;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
public String getUsername() {
return username;
public void setUsername(String username) {
this.username = username;
}
public Boolean getIsLogin() {
return isLogin;
}
public void setIsLogin(Boolean isLogin) {
67. 64
this.isLogin = isLogin;
}
}
GalleryActivity.java
public class GalleryActivity extends Activity {
GridView gridView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gallery);
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new
ColorDrawable(Color.parseColor("#00B9F5")));
bar.setTitle(Html.fromHtml("<font color='#ffffff'>Technomantra</font>"));
gridView = (GridView) findViewById(R.id.gridView1);
gridView.setAdapter(new ImageAdapter(this));
gridView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "You click"+arg2,
Toast.LENGTH_SHORT).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.gallery, menu);
return true;
}
}
68. 65
ScheduleActivity.java
public class ScheduleActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_schedule);
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new
ColorDrawable(Color.parseColor("#00B9F5")));
bar.setTitle(Html.fromHtml("<font color='#ffffff'>Technomantra</font>"));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.schedule, menu);
return true;
}
}
XMLParser1.java
public class XMLParser1 {
// constructor
ProgressDialog pDialog;
GetResult2 xmlprs;
public XMLParser1()
{
}
/**
* Getting XML from URL making HTTP request
* @param url string
* */
public String getXmlFromUrl(String url) {
String xml = null;
try {
xmlprs=new GetResult2();
xml=xmlprs.execute(url).get();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
69. 66
}
// return XML
xml =xml.replace("<?xml version="1.0" encoding="utf-8"?>", "");
return xml;
}
/**
* Getting XML DOM element
* @param XML string
* */
public Document getDomElement(String xml){
Document doc = null;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(xml));
doc = db.parse(is);
} catch (ParserConfigurationException e) {
Log.e("Error1: ", e.getMessage());
return null;
} catch (SAXException e) {
Log.e("Error2: ", e.getMessage());
return null;
} catch (IOException e) {
Log.e("Error3: ", e.getMessage());
return null;
}
return doc;
}
/** Getting node value
* @param elem element
*/
public final String getElementValue( Node elem ) {
Node child;
if( elem != null){
if (elem.hasChildNodes()){
for( child = elem.getFirstChild(); child != null; child = child.getNextSibling()
){
if( child.getNodeType() == Node.TEXT_NODE ){
return child.getNodeValue();
}
}
}
}
70. 67
return "";
}
/**
* Getting node value
* @param Element node
* @param key string
* */
public String getValue(Element item, String str) {
NodeList n = item.getElementsByTagName(str);
return this.getElementValue(n.item(0));
}
private class GetResult2 extends AsyncTask<String, Void, String>
{
String line = " ";
String line2 = " ";
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected String doInBackground(String... urls) {
Log.v( ".doInBackground", "doInBackground method call");
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(urls[0]);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
line = EntityUtils.toString(httpEntity);
Log.v("TAG 1", line);
String s[]=line.split("<!DOCTYPE");
line2=s[0];
Log.d("TAG XML", line2);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return line2;
72. 69
6. Biblography
Reference Book:-
1 Android Essentials
Author:-Chris Haseman
Publication:-Apress –The Expert Voice
2 Android - A programmer’s Guide
Author:-J.F. DiMarzio
Publication:-McGraw Hill
3 Pro Android
Author:-Sayed Y. Hashimi and SatyaKomatineni
Publication:-Apress –The Expert Voice
Reference Sites:-
1. www.androiddevlopers.com
2. www.stackOverflow.com
3. www.googlegroups.com
4. www.androidpeople.com
5. www.anddev.org
6. www.developer.android.com