Click here to Skip to main content
15,885,767 members
Home / Discussions / Mobile
   

Mobile

 
GeneralRe: Handle ListView Scrollbar Event Pin
biop.codeproject30-Oct-12 4:29
biop.codeproject30-Oct-12 4:29 
QuestionContent-Play Pin
Shrikant Bhongade28-Oct-12 20:49
Shrikant Bhongade28-Oct-12 20:49 
QuestionSD card CID Pin
Shrikant Bhongade28-Oct-12 20:44
Shrikant Bhongade28-Oct-12 20:44 
AnswerRe: SD card CID Pin
Richard MacCutchan28-Oct-12 22:55
mveRichard MacCutchan28-Oct-12 22:55 
QuestionAuthentication Protocol in mobile web services Pin
Eng.Fatima M28-Oct-12 6:32
Eng.Fatima M28-Oct-12 6:32 
QuestionPayPal Integration with IPhone Native Application Pin
keyur satyadev25-Oct-12 0:25
keyur satyadev25-Oct-12 0:25 
AnswerRe: PayPal Integration with IPhone Native Application Pin
Richard MacCutchan25-Oct-12 1:27
mveRichard MacCutchan25-Oct-12 1:27 
Questionhow retrative data from Swlite3 and display as text Pin
ahrahr23-Oct-12 6:52
ahrahr23-Oct-12 6:52 
This is my code


package nct.edu.om.nizcotec;
import nct.edu.om.nizcotec.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
public class Event extends Activity {
SQLiteDatabase mydatabase;
ImageButton home;
TextView mytext;
//String name;
String name,age,address,mobile,deptname;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.event);
try{
mydatabase=openOrCreateDatabase("NCTDB",Context.MODE_PRIVATE,null);
mydatabase.execSQL("create table events(eventID integer primary key autoincrement,event_Name text not null,event_group text not null,event_startDate date not null,event_endDate date not null,event_time text not null,event_location text not null,event_type text not null);");
//Toast.makeText(nct.edu.om.nizcotec.Event.this,"The Database is Created..." , Toast.LENGTH_LONG).show();
}
catch(Exception e) {
//Toast.makeText(nct.edu.om.nizcotec.Event.this, "Database already exits, can't create", Toast.LENGTH_LONG).show();
}

home=(ImageButton)this.findViewById(R.id.imageButton1);
Button btn_upload = (Button)this.findViewById(R.id.upload );
Button btn_delete = (Button)this.findViewById(R.id.wipe );
ImageButton college = (ImageButton)this.findViewById(R.id.imageButton2);
//mytext = (TextView)this.findViewById(R.id.recname);
home.setOnClickListener(new OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub
Intent home=new Intent(Event.this,Home.class);
startActivity(home);
finish();

}
});
/* btn_upload.setOnClickListener(new OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub
try{
mydatabase=openOrCreateDatabase("NCTDB",Context.MODE_PRIVATE,null);
mydatabase.execSQL("create table events(eventID integer primary key autoincrement,event_Name text not null,event_group text not null,event_startDate date not null,event_endDate date not null,event_time text not null,event_location text not null,event_type text not null);");
//Toast.makeText(nct.edu.om.nizcotec.Event.this,"The Database is Created..." , Toast.LENGTH_LONG).show();
}
catch(Exception e) {
//Toast.makeText(nct.edu.om.nizcotec.Event.this, "Database already exits, can't create", Toast.LENGTH_LONG).show();
}

}

});
*/ //Button btn_insert - This code is to insert record into the students table. //
btn_upload.setOnClickListener(new OnClickListener() {

public void onClick(View v) {

try{
mydatabase.execSQL("insert into events values(1 ,'A','Mubadron','2012-07-05','2012-07-09','8AM-9AM ','jabrain hall','SA')");
mydatabase.execSQL("insert into events values(2,'B','Ebdaat','2012-04-04','2012-04-05',' 10AM-APM','multi postin hall','CA')");
mydatabase.execSQL("insert into events values(3,'C','health group','2012-03-13','2012-03-15','8AM-10AM ','student club','CA')");
mydatabase.execSQL("insert into events values(4,'D','IT club','2012-02-11','2012-02-13','8AM-12AM ','jbrain hall','TW')");
mydatabase.execSQL("insert into events values(5,'F','Ebdaat','2012-07-22','-2012-07-22',' 7PM-10PM','jbrain hall','SP')");
mydatabase.execSQL("insert into events values(6,'E','Hamsat','2012-03-03','2012-03-04','10AM-12AM ','jbrain hall','SP')");
mydatabase.execSQL("insert into events values(7,'G','IT club','2012-1-12','2012-1-13','8AM-3PM ','multi postin hall','TW')");
mydatabase.execSQL("insert into events values(8,'H','college group','2012-5-4','2012-5-5','10AM-12AM ','college area','CA')");
mydatabase.execSQL("insert into events values(9,'K','Mubadron','2012-8-6','2012-08-08','10AM-12AM ','multi postin hall','SA')");
mydatabase.execSQL("insert into events values(10,'K','college group','2012-10-09','2012-10-10','8AM-10AM ','student hall','CA')");

Toast.makeText(nct.edu.om.nizcotec.Event.this,"Data uploaded.." , Toast.LENGTH_LONG).show();
}
catch(Exception e) {
Toast.makeText(nct.edu.om.nizcotec.Event.this, "Exception" +e, Toast.LENGTH_LONG).show();
//Toast.makeText(nct.edu.om.nizcotec.Event.this,"Data uploaded.." , Toast.LENGTH_LONG).show();
}
}
});
//Button btn_delete - This code is to delete all the records in evente table. //
btn_delete.setOnClickListener(new OnClickListener() {

public void onClick(View v) {
try{
mydatabase.execSQL("delete from events");
Toast.makeText(nct.edu.om.nizcotec.Event.this,"Data Deleted...", Toast.LENGTH_LONG).show();
}
catch(Exception e)
{
Toast.makeText(nct.edu.om.nizcotec.Event.this,"Exception : " + e, Toast.LENGTH_LONG).show();
//Toast.makeText(nct.edu.om.nizcotec.Event.this,"Data Deleted...", Toast.LENGTH_LONG).show();
}
}
});

college.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent college=new Intent(Event.this,College.class);
startActivity(college);
finish();

final Cursor c = mydatabase.rawQuery("select * from events where event_type='SA'",null);


int count=c.getCount();
//String event_Name = null;

Toast.makeText(nct.edu.om.nizcotec.Event.this,"Total Nof of rows are..."+count, Toast.LENGTH_LONG).show();

if (count==0)

{
Toast.makeText(nct.edu.om.nizcotec.Event.this,"There is no Data ...", Toast.LENGTH_LONG).show();
}

while (!c.isAfterLast()){
// Toast.makeText(nct.edu.om.nizcotec.Event.this,c.getInt(0)+" "+c.getString(1), Toast.LENGTH_LONG).show();
// c.getString(1).show();
//mytext.setText(c.getInt(0)+" "+c.getString(1));
// mytext.setText(c.getString(1));
c.moveToNext();
}
c.close();
}
});
}

}
QuestionWant to get location from latitude and longitude in Blackberry? Pin
AmanArora198722-Oct-12 22:32
AmanArora198722-Oct-12 22:32 
QuestionAdd new listitem in Listview dynamically Pin
klaydze18-Oct-12 21:29
klaydze18-Oct-12 21:29 
QuestionHTML 5 the future? Pin
kakah100014-Oct-12 8:47
kakah100014-Oct-12 8:47 
AnswerRe: HTML 5 the future? Pin
Richard MacCutchan14-Oct-12 21:03
mveRichard MacCutchan14-Oct-12 21:03 
GeneralRe: HTML 5 the future? Pin
kakah100014-Oct-12 21:41
kakah100014-Oct-12 21:41 
GeneralRe: HTML 5 the future? Pin
Richard MacCutchan15-Oct-12 4:37
mveRichard MacCutchan15-Oct-12 4:37 
GeneralRe: HTML 5 the future? Pin
kakah100015-Oct-12 4:45
kakah100015-Oct-12 4:45 
QuestionMobile Application Development (Windows Platform) Pin
Abdul Rahman Hamidy9-Oct-12 0:10
Abdul Rahman Hamidy9-Oct-12 0:10 
AnswerRe: Mobile Application Development (Windows Platform) Pin
Pete O'Hanlon9-Oct-12 1:23
mvePete O'Hanlon9-Oct-12 1:23 
GeneralRe: Mobile Application Development (Windows Platform) Pin
Abdul Rahman Hamidy9-Oct-12 17:58
Abdul Rahman Hamidy9-Oct-12 17:58 
AnswerRe: Mobile Application Development (Windows Platform) Pin
biop.codeproject31-Oct-12 16:36
biop.codeproject31-Oct-12 16:36 
QuestionAndroid Dev for ICS 4.0.4 Pin
Dana Gibson8-Oct-12 6:55
Dana Gibson8-Oct-12 6:55 
AnswerRe: Android Dev for ICS 4.0.4 Pin
Mike DiGiovanni9-Oct-12 1:44
Mike DiGiovanni9-Oct-12 1:44 
Questionandroid action bar Pin
msh667-Oct-12 1:15
msh667-Oct-12 1:15 
AnswerRe: android action bar Pin
Richard MacCutchan7-Oct-12 1:30
mveRichard MacCutchan7-Oct-12 1:30 
GeneralRe: android action bar Pin
msh667-Oct-12 1:44
msh667-Oct-12 1:44 
GeneralRe: android action bar Pin
Richard MacCutchan7-Oct-12 2:00
mveRichard MacCutchan7-Oct-12 2:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.