SlideShare una empresa de Scribd logo
1 de 73
Descargar para leer sin conexión
i
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)
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
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
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.
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
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)
5
4. Layouts
Splash Screen
6
Home Activity
7
Registration
8
Login
9
Main Activity(Menu)
10
Event Deatil
11
Event Description
12
Schedule
13
Gallary
14
Contact us
15
Profile
16
5. Coding
activity_splash.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=".SplashActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@drawable/d" />
</RelativeLayout>
activity_registration.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:gravity="top"
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=".RegistrationActivity" >
<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:ems="10"
android:hint="@string/enter_e_mail"
android:inputType="textEmailAddress" >
</EditText>
<EditText
android:id="@+id/edt_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
17
android:layout_alignLeft="@+id/edit_confirm_password"
android:layout_below="@+id/lgn_edt_password"
android:ems="10"
android:hint="@string/enter_password"
android:inputType="textPassword" />
<EditText
android:id="@+id/edit_confirm_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/edt_mobile"
android:layout_below="@+id/edt_password"
android:ems="10"
android:hint="@string/enter_confirm_password"
android:inputType="textPassword" />
<EditText
android:id="@+id/edt_mobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/autoComplete_college"
android:layout_below="@+id/edit_confirm_password"
android:ems="10"
android:hint="@string/enter_mobile_no"
android:inputType="phone" />
<AutoCompleteTextView
android:id="@+id/autoComplete_college"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/edt_mobile"
android:layout_centerHorizontal="true"
android:autoText="true"
android:ems="10"
android:hint="@string/enter_college_name"
android:text="" />
<EditText
android:id="@+id/lgn_edt_mail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/edt_password"
android:layout_alignParentTop="true"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="@string/enter_name" >
<requestFocus />
</EditText>
<AutoCompleteTextView
android:id="@+id/autoComplete_city"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/btn_registration"
android:layout_alignLeft="@+id/spinner1"
18
android:ems="10"
android:hint="@string/enter_your_city" />
<Spinner
android:id="@+id/spinner1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignLeft="@+id/autoComplete_college"
android:layout_below="@+id/autoComplete_college" />
<Spinner
android:id="@+id/spinner2"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_above="@+id/autoComplete_city"
android:layout_alignLeft="@+id/autoComplete_city"
android:layout_marginBottom="14dp" />
<Button
android:id="@+id/btn_registration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/autoComplete_city"
android:layout_alignParentBottom="true"
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" />
</RelativeLayout>
activity_login.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=".LoginActivity" >
<EditText
android:id="@+id/lgn_edt_mail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp"
android:ems="10"
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>
20
activity_home.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=".HomeActivity" >
<Button
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/btn_registration"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:background="@drawable/buttonshape"
android:shadowColor="#A1A2A8"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="5"
android:text="Login"
android:textColor="#FFF7FD"
android:textSize="30sp" />
<Button
android:id="@+id/btn_registration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_login"
android:layout_alignParentBottom="true"
android:layout_marginBottom="146dp"
android:background="@drawable/buttonshape"
android:shadowColor="#A1A2A8"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="5"
android:text="Registration"
android:textColor="#FFF7FD"
android:textSize="30sp" />
</RelativeLayout>
21
activity_aboutus.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
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=".AboutusActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/ks" />
<WebView
android:id="@+id/webview_codewar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignLeft="@+id/imageView1"
android:layout_below="@+id/imageView1"
android:layout_marginTop="32dp" />
</RelativeLayout>
activity_add_sense.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=".Add_Sense_Activity" >
<Button
android:id="@+id/btn_add_sense_participant"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:background="@drawable/buttonshape"
android:text="participate"
android:textColor="#fff"
android:textSize="30sp" />
22
</RelativeLayout>
activity_app_etizer.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=".AppEtizerActivity" >
<Button
android:id="@+id/btn_app_participate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="48dp"
android:background="@drawable/buttonshape"
android:text="participate"
android:textColor="#fff"
android:textSize="30sp" />
</RelativeLayout>
activity_creative_events.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=".CreativeEventsActivity" >
<Button
android:id="@+id/btn_kabad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="82dp"
android:background="@drawable/buttonshape"
android:text="Kabaad Se Jugaad"
android:textColor="#fff"
android:textSize="25sp" />
23
<Button
android:id="@+id/btn_postyourthoughts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_kabad"
android:layout_below="@+id/btn_kabad"
android:layout_marginTop="22dp"
android:background="@drawable/buttonshape"
android:text="Post Your Thoughts"
android:textColor="#fff"
android:textSize="25sp" />
<Button
android:id="@+id/btn_lightscameraaction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/btn_postyourthoughts"
android:layout_centerHorizontal="true"
android:layout_marginTop="24dp"
android:background="@drawable/buttonshape"
android:text="Lights Camera Action"
android:textColor="#fff"
android:textSize="25sp" />
<Button
android:id="@+id/btn_satrangiit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/btn_lightscameraaction"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="@drawable/buttonshape"
android:text="Satrangi It"
android:textColor="#fff"
android:textSize="25sp" />
</RelativeLayout>
activity_ events.xml
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@android:id/tabhost">
<LinearLayout
android:id="@+id/LinearLayout01"
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
24
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
</FrameLayout>
</LinearLayout>
</TabHost>
activity_ gallary.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=".GalleryActivity" >
<GridView
android:id="@+id/gridView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:numColumns="3" >
</GridView>
</RelativeLayout>
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="wrap_content"
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" >
<Button
android:id="@+id/btn_contact"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignLeft="@+id/btn_schedule"
android:layout_below="@+id/btn_schedule"
25
android:layout_marginTop="13dp"
android:background="@drawable/buttonshape"
android:shadowColor="#A1A2A8"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="5"
android:text="Contact Us"
android:textColor="#FFF7FD"
android:textSize="30sp" />
<Button
android:id="@+id/btn_schedule"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignLeft="@+id/btn_gallery"
android:layout_below="@+id/btn_gallery"
android:layout_marginTop="13dp"
android:background="@drawable/buttonshape"
android:shadowColor="#A1A2A8"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="5"
android:text="Schedule"
android:textColor="#FFF7FD"
android:textSize="30sp" />
<Button
android:id="@+id/btn_gallery"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignLeft="@+id/btn_events"
android:layout_below="@+id/btn_events"
android:layout_marginTop="13dp"
android:background="@drawable/buttonshape"
android:shadowColor="#A1A2A8"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="5"
android:text="Gallery"
android:textColor="#FFF7FD"
android:textSize="30sp" />
<Button
android:id="@+id/btn_add_sense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_user_account"
android:layout_alignParentBottom="true"
android:layout_marginTop="13dp"
android:background="@drawable/buttonshape"
android:text="Logout"
android:textColor="#fff"
android:textSize="30sp" />
26
<Button
android:id="@+id/btn_user_account"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/btn_add_sense"
android:layout_centerHorizontal="true"
android:layout_marginTop="13dp"
android:background="@drawable/buttonshape"
android:shadowColor="#A1A2A8"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="5"
android:text="Account"
android:textColor="#FFF7FD"
android:textSize="30sp" />
<Button
android:id="@+id/btn_events"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignLeft="@+id/btn_about"
android:layout_alignParentTop="true"
android:background="@drawable/buttonshape"
android:text="Events"
android:textColor="#FFF7FD"
android:textSize="30sp" />
<Button
android:id="@+id/btn_about"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignLeft="@+id/btn_user_account"
android:layout_below="@+id/btn_contact"
android:layout_marginTop="13dp"
android:background="@drawable/buttonshape"
android:shadowColor="#A1A2A8"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="5"
android:text="About Us"
android:textColor="#FFF7FD"
android:textSize="30sp" />
</RelativeLayout>
activity_schedule.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"
27
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".ScheduleActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/schedule" />
</RelativeLayout>
activity_user_profile.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=".UserProfileActivity" >
<TextView
android:id="@+id/txt_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/txt_userid"
android:layout_marginLeft="79dp"
android:layout_toRightOf="@+id/txt_userid"
android:text="" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/txt_userid"
android:layout_below="@+id/txt_userid"
android:layout_marginTop="44dp"
android:text="List Participanted Events" />
<ListView
android:id="@+id/list_events"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/txt_userid"
android:layout_alignParentBottom="true"
android:layout_marginTop="130dp" >
</ListView>
<TextView
android:id="@+id/txt_userid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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;
}
}
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);
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("")) {
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() {
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
33
+ "&password="
+ password
+ "&phone="
+ mobile
+ "&college="
+ college
+ "&degree="
+ 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"?>",
"");
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);
}
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);
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;
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 + "");
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();
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() {
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();
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();
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>"));
*/
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();
}
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);
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);
}
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)) {
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();
}
}
}
}
}
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
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
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 {
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(),
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)) {
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();
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.
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(
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();
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)) {
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();
}
}
}
}
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) {
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();
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")) {
62
Toast.makeText(getApplicationContext(),
"Successful Participed",
Toast.LENGTH_SHORT).show();
btn_codewar_participate.setEnabled(false);
btn_codewar_participate.setText("participated");
btn_codewar_participate.setBackgroundColor(0xFFFF0000);
onBackPressed();
} else if (str.contains("0")) {
Toast.makeText(getApplicationContext(),
"User Already Participate",
Toast.LENGTH_SHORT)
.show();
} else {
Toast.makeText(getApplicationContext(),
"Response not found",
Toast.LENGTH_SHORT).show();
}
}
}
}
}
ContactusActivity.java
public class ContactusActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_contactus);
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.contactus, menu);
return true;
}
}
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) {
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;
}
}
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();
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();
}
}
}
}
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;
68
}
protected void onPostExecute(String result)
{
super.onPostExecute(result) ;
xmlprs.cancel(false);
}
}
}
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
70

Más contenido relacionado

Destacado

CSPi TS Infographic
CSPi TS InfographicCSPi TS Infographic
CSPi TS InfographicChris Bell
 
PODCAST EDUCATIVOS - LEIDER MACIAS
 PODCAST EDUCATIVOS - LEIDER MACIAS PODCAST EDUCATIVOS - LEIDER MACIAS
PODCAST EDUCATIVOS - LEIDER MACIASleidermacias
 
Пигарева Наталья Геннадьевна
Пигарева Наталья ГеннадьевнаПигарева Наталья Геннадьевна
Пигарева Наталья Геннадьевнаschool135
 
The Rwanda Cure - Forbes Oct 2007
The Rwanda Cure - Forbes Oct 2007The Rwanda Cure - Forbes Oct 2007
The Rwanda Cure - Forbes Oct 2007Jeremy Hammond
 
Ashish_Agrawal_Techincal Architect
Ashish_Agrawal_Techincal ArchitectAshish_Agrawal_Techincal Architect
Ashish_Agrawal_Techincal ArchitectAshish Agrawal, PMP
 
История Великой Отечественной войны
История Великой Отечественной войныИстория Великой Отечественной войны
История Великой Отечественной войныschool135
 

Destacado (12)

Location scouting
Location scoutingLocation scouting
Location scouting
 
10 klas
10 klas10 klas
10 klas
 
CSPi TS Infographic
CSPi TS InfographicCSPi TS Infographic
CSPi TS Infographic
 
Sports quiz
Sports quizSports quiz
Sports quiz
 
JMeter
JMeterJMeter
JMeter
 
PODCAST EDUCATIVOS - LEIDER MACIAS
 PODCAST EDUCATIVOS - LEIDER MACIAS PODCAST EDUCATIVOS - LEIDER MACIAS
PODCAST EDUCATIVOS - LEIDER MACIAS
 
Пигарева Наталья Геннадьевна
Пигарева Наталья ГеннадьевнаПигарева Наталья Геннадьевна
Пигарева Наталья Геннадьевна
 
The Rwanda Cure - Forbes Oct 2007
The Rwanda Cure - Forbes Oct 2007The Rwanda Cure - Forbes Oct 2007
The Rwanda Cure - Forbes Oct 2007
 
018 4915 mission ready military
018 4915 mission ready military018 4915 mission ready military
018 4915 mission ready military
 
Ashish_Agrawal_Techincal Architect
Ashish_Agrawal_Techincal ArchitectAshish_Agrawal_Techincal Architect
Ashish_Agrawal_Techincal Architect
 
FOCKFRESETAL_LIST_OF-LINE-INCOMPLETE
FOCKFRESETAL_LIST_OF-LINE-INCOMPLETEFOCKFRESETAL_LIST_OF-LINE-INCOMPLETE
FOCKFRESETAL_LIST_OF-LINE-INCOMPLETE
 
История Великой Отечественной войны
История Великой Отечественной войныИстория Великой Отечественной войны
История Великой Отечественной войны
 

Similar a technomantra

MOBILE APPLICATION FOR COLLEGE EVENT MANAGEMENT
MOBILE APPLICATION FOR COLLEGE EVENT MANAGEMENTMOBILE APPLICATION FOR COLLEGE EVENT MANAGEMENT
MOBILE APPLICATION FOR COLLEGE EVENT MANAGEMENTIRJET Journal
 
Smart class presentation
Smart class   presentationSmart class   presentation
Smart class presentationMrunal Selokar
 
IRJET- Contest Information Desk Android Application
IRJET-  	  Contest Information Desk Android ApplicationIRJET-  	  Contest Information Desk Android Application
IRJET- Contest Information Desk Android ApplicationIRJET Journal
 
Report (icons event ) (2)
Report (icons event ) (2)Report (icons event ) (2)
Report (icons event ) (2)SIDDHARTHHATKAR
 
project documentation.docx
project documentation.docxproject documentation.docx
project documentation.docxpoojamogaveer
 
Augmented Reality for Smart Profile Display Part-2
Augmented Reality for Smart Profile Display Part-2Augmented Reality for Smart Profile Display Part-2
Augmented Reality for Smart Profile Display Part-2IRJET Journal
 
Final Year Project Report on Self Tacit Zone (Location Based Android App)
Final Year Project Report on Self Tacit Zone (Location Based Android App)Final Year Project Report on Self Tacit Zone (Location Based Android App)
Final Year Project Report on Self Tacit Zone (Location Based Android App)Parthik Poshiya
 
Review on College Event Organizer
Review on College Event OrganizerReview on College Event Organizer
Review on College Event OrganizerIRJET Journal
 
Presenting GDSC Intro Session 23 (4).pptx
Presenting GDSC Intro Session 23 (4).pptxPresenting GDSC Intro Session 23 (4).pptx
Presenting GDSC Intro Session 23 (4).pptxKumarRajeev18
 
Naveen_R_Resume
Naveen_R_ResumeNaveen_R_Resume
Naveen_R_Resumenaveen r
 
College app for android device
College app for android deviceCollege app for android device
College app for android device8759000398
 
VinayG_CV_3.5Y
VinayG_CV_3.5YVinayG_CV_3.5Y
VinayG_CV_3.5YVinay G
 
Parent communication register android application
Parent communication register android applicationParent communication register android application
Parent communication register android applicationBhadra Gowdra
 
Andro Attendance – Marking Attendance with Android Application
Andro Attendance – Marking Attendance with Android ApplicationAndro Attendance – Marking Attendance with Android Application
Andro Attendance – Marking Attendance with Android ApplicationIJARIIT
 
IRJET- Student Statistics System using Confined Android App
IRJET- Student Statistics System using Confined Android AppIRJET- Student Statistics System using Confined Android App
IRJET- Student Statistics System using Confined Android AppIRJET Journal
 

Similar a technomantra (20)

MOBILE APPLICATION FOR COLLEGE EVENT MANAGEMENT
MOBILE APPLICATION FOR COLLEGE EVENT MANAGEMENTMOBILE APPLICATION FOR COLLEGE EVENT MANAGEMENT
MOBILE APPLICATION FOR COLLEGE EVENT MANAGEMENT
 
Nagendran resume
Nagendran resumeNagendran resume
Nagendran resume
 
Smart class presentation
Smart class   presentationSmart class   presentation
Smart class presentation
 
Resume
ResumeResume
Resume
 
IRJET- Contest Information Desk Android Application
IRJET-  	  Contest Information Desk Android ApplicationIRJET-  	  Contest Information Desk Android Application
IRJET- Contest Information Desk Android Application
 
Report (icons event ) (2)
Report (icons event ) (2)Report (icons event ) (2)
Report (icons event ) (2)
 
Prathap resume
Prathap resumePrathap resume
Prathap resume
 
project documentation.docx
project documentation.docxproject documentation.docx
project documentation.docx
 
Augmented Reality for Smart Profile Display Part-2
Augmented Reality for Smart Profile Display Part-2Augmented Reality for Smart Profile Display Part-2
Augmented Reality for Smart Profile Display Part-2
 
Final Year Project Report on Self Tacit Zone (Location Based Android App)
Final Year Project Report on Self Tacit Zone (Location Based Android App)Final Year Project Report on Self Tacit Zone (Location Based Android App)
Final Year Project Report on Self Tacit Zone (Location Based Android App)
 
Review on College Event Organizer
Review on College Event OrganizerReview on College Event Organizer
Review on College Event Organizer
 
Presenting GDSC Intro Session 23 (4).pptx
Presenting GDSC Intro Session 23 (4).pptxPresenting GDSC Intro Session 23 (4).pptx
Presenting GDSC Intro Session 23 (4).pptx
 
Naveen_R_Resume
Naveen_R_ResumeNaveen_R_Resume
Naveen_R_Resume
 
College app for android device
College app for android deviceCollege app for android device
College app for android device
 
KarunAggarwal
KarunAggarwalKarunAggarwal
KarunAggarwal
 
VinayG_CV_3.5Y
VinayG_CV_3.5YVinayG_CV_3.5Y
VinayG_CV_3.5Y
 
Parent communication register android application
Parent communication register android applicationParent communication register android application
Parent communication register android application
 
Dhwani_Resume_03_2016
Dhwani_Resume_03_2016Dhwani_Resume_03_2016
Dhwani_Resume_03_2016
 
Andro Attendance – Marking Attendance with Android Application
Andro Attendance – Marking Attendance with Android ApplicationAndro Attendance – Marking Attendance with Android Application
Andro Attendance – Marking Attendance with Android Application
 
IRJET- Student Statistics System using Confined Android App
IRJET- Student Statistics System using Confined Android AppIRJET- Student Statistics System using Confined Android App
IRJET- Student Statistics System using Confined Android App
 

technomantra

  • 1. i
  • 2. 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)
  • 19. 16 5. Coding activity_splash.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=".SplashActivity" > <ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:src="@drawable/d" /> </RelativeLayout> activity_registration.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:gravity="top" 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=".RegistrationActivity" > <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:ems="10" android:hint="@string/enter_e_mail" android:inputType="textEmailAddress" > </EditText> <EditText android:id="@+id/edt_password" android:layout_width="match_parent" android:layout_height="wrap_content"
  • 20. 17 android:layout_alignLeft="@+id/edit_confirm_password" android:layout_below="@+id/lgn_edt_password" android:ems="10" android:hint="@string/enter_password" android:inputType="textPassword" /> <EditText android:id="@+id/edit_confirm_password" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/edt_mobile" android:layout_below="@+id/edt_password" android:ems="10" android:hint="@string/enter_confirm_password" android:inputType="textPassword" /> <EditText android:id="@+id/edt_mobile" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/autoComplete_college" android:layout_below="@+id/edit_confirm_password" android:ems="10" android:hint="@string/enter_mobile_no" android:inputType="phone" /> <AutoCompleteTextView android:id="@+id/autoComplete_college" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/edt_mobile" android:layout_centerHorizontal="true" android:autoText="true" android:ems="10" android:hint="@string/enter_college_name" android:text="" /> <EditText android:id="@+id/lgn_edt_mail" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/edt_password" android:layout_alignParentTop="true" android:layout_marginTop="16dp" android:ems="10" android:hint="@string/enter_name" > <requestFocus /> </EditText> <AutoCompleteTextView android:id="@+id/autoComplete_city" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/btn_registration" android:layout_alignLeft="@+id/spinner1"
  • 21. 18 android:ems="10" android:hint="@string/enter_your_city" /> <Spinner android:id="@+id/spinner1" android:layout_width="match_parent" android:layout_height="40dp" android:layout_alignLeft="@+id/autoComplete_college" android:layout_below="@+id/autoComplete_college" /> <Spinner android:id="@+id/spinner2" android:layout_width="match_parent" android:layout_height="40dp" android:layout_above="@+id/autoComplete_city" android:layout_alignLeft="@+id/autoComplete_city" android:layout_marginBottom="14dp" /> <Button android:id="@+id/btn_registration" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/autoComplete_city" android:layout_alignParentBottom="true" 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" /> </RelativeLayout> activity_login.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=".LoginActivity" > <EditText android:id="@+id/lgn_edt_mail" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="90dp" android:ems="10"
  • 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>
  • 23. 20 activity_home.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=".HomeActivity" > <Button android:id="@+id/btn_login" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/btn_registration" android:layout_centerHorizontal="true" android:layout_marginBottom="30dp" android:background="@drawable/buttonshape" android:shadowColor="#A1A2A8" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="5" android:text="Login" android:textColor="#FFF7FD" android:textSize="30sp" /> <Button android:id="@+id/btn_registration" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/btn_login" android:layout_alignParentBottom="true" android:layout_marginBottom="146dp" android:background="@drawable/buttonshape" android:shadowColor="#A1A2A8" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="5" android:text="Registration" android:textColor="#FFF7FD" android:textSize="30sp" /> </RelativeLayout>
  • 24. 21 activity_aboutus.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" 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=".AboutusActivity" > <ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:src="@drawable/ks" /> <WebView android:id="@+id/webview_codewar" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignLeft="@+id/imageView1" android:layout_below="@+id/imageView1" android:layout_marginTop="32dp" /> </RelativeLayout> activity_add_sense.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=".Add_Sense_Activity" > <Button android:id="@+id/btn_add_sense_participant" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="30dp" android:background="@drawable/buttonshape" android:text="participate" android:textColor="#fff" android:textSize="30sp" />
  • 25. 22 </RelativeLayout> activity_app_etizer.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=".AppEtizerActivity" > <Button android:id="@+id/btn_app_participate" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="48dp" android:background="@drawable/buttonshape" android:text="participate" android:textColor="#fff" android:textSize="30sp" /> </RelativeLayout> activity_creative_events.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=".CreativeEventsActivity" > <Button android:id="@+id/btn_kabad" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="82dp" android:background="@drawable/buttonshape" android:text="Kabaad Se Jugaad" android:textColor="#fff" android:textSize="25sp" />
  • 26. 23 <Button android:id="@+id/btn_postyourthoughts" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/btn_kabad" android:layout_below="@+id/btn_kabad" android:layout_marginTop="22dp" android:background="@drawable/buttonshape" android:text="Post Your Thoughts" android:textColor="#fff" android:textSize="25sp" /> <Button android:id="@+id/btn_lightscameraaction" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/btn_postyourthoughts" android:layout_centerHorizontal="true" android:layout_marginTop="24dp" android:background="@drawable/buttonshape" android:text="Lights Camera Action" android:textColor="#fff" android:textSize="25sp" /> <Button android:id="@+id/btn_satrangiit" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/btn_lightscameraaction" android:layout_centerHorizontal="true" android:layout_marginTop="30dp" android:background="@drawable/buttonshape" android:text="Satrangi It" android:textColor="#fff" android:textSize="25sp" /> </RelativeLayout> activity_ events.xml <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@android:id/tabhost"> <LinearLayout android:id="@+id/LinearLayout01" android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent"> <TabWidget android:id="@android:id/tabs" android:layout_height="wrap_content" android:layout_width="fill_parent">
  • 27. 24 </TabWidget> <FrameLayout android:id="@android:id/tabcontent" android:layout_height="fill_parent" android:layout_width="fill_parent"> </FrameLayout> </LinearLayout> </TabHost> activity_ gallary.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=".GalleryActivity" > <GridView android:id="@+id/gridView1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:numColumns="3" > </GridView> </RelativeLayout> 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="wrap_content" 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" > <Button android:id="@+id/btn_contact" android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignLeft="@+id/btn_schedule" android:layout_below="@+id/btn_schedule"
  • 28. 25 android:layout_marginTop="13dp" android:background="@drawable/buttonshape" android:shadowColor="#A1A2A8" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="5" android:text="Contact Us" android:textColor="#FFF7FD" android:textSize="30sp" /> <Button android:id="@+id/btn_schedule" android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignLeft="@+id/btn_gallery" android:layout_below="@+id/btn_gallery" android:layout_marginTop="13dp" android:background="@drawable/buttonshape" android:shadowColor="#A1A2A8" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="5" android:text="Schedule" android:textColor="#FFF7FD" android:textSize="30sp" /> <Button android:id="@+id/btn_gallery" android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignLeft="@+id/btn_events" android:layout_below="@+id/btn_events" android:layout_marginTop="13dp" android:background="@drawable/buttonshape" android:shadowColor="#A1A2A8" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="5" android:text="Gallery" android:textColor="#FFF7FD" android:textSize="30sp" /> <Button android:id="@+id/btn_add_sense" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/btn_user_account" android:layout_alignParentBottom="true" android:layout_marginTop="13dp" android:background="@drawable/buttonshape" android:text="Logout" android:textColor="#fff" android:textSize="30sp" />
  • 29. 26 <Button android:id="@+id/btn_user_account" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/btn_add_sense" android:layout_centerHorizontal="true" android:layout_marginTop="13dp" android:background="@drawable/buttonshape" android:shadowColor="#A1A2A8" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="5" android:text="Account" android:textColor="#FFF7FD" android:textSize="30sp" /> <Button android:id="@+id/btn_events" android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignLeft="@+id/btn_about" android:layout_alignParentTop="true" android:background="@drawable/buttonshape" android:text="Events" android:textColor="#FFF7FD" android:textSize="30sp" /> <Button android:id="@+id/btn_about" android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignLeft="@+id/btn_user_account" android:layout_below="@+id/btn_contact" android:layout_marginTop="13dp" android:background="@drawable/buttonshape" android:shadowColor="#A1A2A8" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="5" android:text="About Us" android:textColor="#FFF7FD" android:textSize="30sp" /> </RelativeLayout> activity_schedule.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"
  • 30. 27 android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".ScheduleActivity" > <ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:src="@drawable/schedule" /> </RelativeLayout> activity_user_profile.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=".UserProfileActivity" > <TextView android:id="@+id/txt_email" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/txt_userid" android:layout_marginLeft="79dp" android:layout_toRightOf="@+id/txt_userid" android:text="" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/txt_userid" android:layout_below="@+id/txt_userid" android:layout_marginTop="44dp" android:text="List Participanted Events" /> <ListView android:id="@+id/list_events" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/txt_userid" android:layout_alignParentBottom="true" android:layout_marginTop="130dp" > </ListView> <TextView android:id="@+id/txt_userid" android:layout_width="wrap_content" android:layout_height="wrap_content"
  • 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 + "&degree=" + 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")) {
  • 65. 62 Toast.makeText(getApplicationContext(), "Successful Participed", Toast.LENGTH_SHORT).show(); btn_codewar_participate.setEnabled(false); btn_codewar_participate.setText("participated"); btn_codewar_participate.setBackgroundColor(0xFFFF0000); onBackPressed(); } else if (str.contains("0")) { Toast.makeText(getApplicationContext(), "User Already Participate", Toast.LENGTH_SHORT) .show(); } else { Toast.makeText(getApplicationContext(), "Response not found", Toast.LENGTH_SHORT).show(); } } } } } ContactusActivity.java public class ContactusActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contactus); 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.contactus, menu); return true; } }
  • 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;
  • 71. 68 } protected void onPostExecute(String result) { super.onPostExecute(result) ; xmlprs.cancel(false); } } }
  • 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
  • 73. 70