You are on page 1of 7

package com.infy.

android;

import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView;

public class Send_SMS extends Activity { /** Called when the activity is first created. */ int counter; Button add, sub; TextView display; MediaPlayer ourSong;

@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);

counter = 0; add= (Button)findViewById(R.id.bAdd);

sub =(Button)findViewById(R.id.bSub); display=(TextView)findViewById(R.id.tvDisplay); // ourSong= MediaPlayer.create(OnClickButtonActivity.this, R.raw.pnm); // ourSong= MediaPlayer.create(OnClickButtonActivity.this, R.raw.a); // ourSong.start(); add.setOnClickListener(new OnClickListener() {

public void onClick(View arg0) { // TODO Auto-generated method stub // ourSong= MediaPlayer.create(OnClickButtonActivity.this, R.raw.a); counter++;

ourSong.start(); ourSong.setLooping(true);

display.setText("Your total is "+counter);

} }); sub.setOnClickListener(new OnClickListener() {

public void onClick(View arg0) {

// TODO Auto-generated method stub counter--; ourSong.pause(); display.setText("Your total is "+counter);

} }); } }

package com.infy.android; import android.R; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView;

public class Z2Activity extends ListActivity{

String classes[]= {"Send_SMS","Send MMS","History","GPS Coordinate","Feedback","Rating"};

@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter<String>(Z2Activity.this, android.R.layout.simple_list_item_1, classes)); }

@Override protected void onListItemClick(ListView l, View v, int position, long id) { // TODO Auto-generated method stub super.onListItemClick(l, v, position, id); String palla = classes[position]; try { Class ourClass = Class.forName("com.infy.android." + palla); Intent ourIntent = new Intent(Z2Activity.this, ourClass); startActivity(ourIntent); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); }

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:text="Your total is 0" android:textSize="45dp" android:gravity="center" android:id="@+id/tvDisplay"/> <Button android:layout_width="250dp" android:layout_height="wrap_content" android:layout_gravity="center" android:text="Add One" android:textSize="20dp" android:gravity="center" android:id="@+id/bAdd"/> <Button android:layout_width="250dp" android:layout_height="wrap_content" android:layout_gravity="center" android:text="Sub One" android:textSize="20dp" android:gravity="center" android:id="@+id/bSub" /> </LinearLayout> <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.infy.android" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="15" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" >

<activity android:name=".Send_SMS" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.Send_SMS" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".Z2Activity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> Login Scr

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Login Screen" android:textSize="40dp" android:id="@+id/textview1" />

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tablelayout1" android:layout_width="299dp" android:layout_height="fill_parent" > <TableRow > <TextView

android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Username" android:textSize="25dp" android:id="@+id/textview2"/> <EditText android:layout_width="fill_parent"

android:layout_height="wrap_content" android:text="" android:textSize="25dp" android:id="@+id/edittext1"/> </TableRow> <TableRow > <TextView

android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Password" android:textSize="25dp" android:id="@+id/textview3"/> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:textSize="25dp" android:password="true" android:id="@+id/edittext2"/>

</TableRow> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="Submit" android:textSize="20dp" android:gravity="left" android:id="@+id/button1"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20dp" android:id="@+id/textview4" /> </TableLayout> </LinearLayout>

You might also like