Разделы презентаций


Client / Server Programming in Android

Содержание

TCP Echo Client (1)cs423- cotter

Слайды и текст этой презентации

Слайд 1Client / Server Programming in Android
Eclipse IDE
Android Development Tools (ADT)
Android SDK
http://www.vogella.com/articles/Android/article.html

Client / Server Programming in AndroidEclipse IDEAndroid Development Tools (ADT)Android SDKhttp://www.vogella.com/articles/Android/article.html

Слайд 2TCP Echo Client (1)
cs423- cotter

TCP Echo Client (1)cs423- cotter

Слайд 3Android Mobile Development
Install Eclipse IDE
Install Android Development Tools (ADT)
Install Android

SDK
Install specific Android Versions through SDK Manager
Create / install an

Android Virtual Device (AVD)



cs423- cotter

Android Mobile DevelopmentInstall Eclipse IDEInstall Android Development Tools (ADT)Install Android SDKInstall specific Android Versions through SDK ManagerCreate

Слайд 4Android SDK / AVD Managers
cs423- cotter

Android SDK / AVD Managerscs423- cotter

Слайд 5Android SDK Manager
cs423- cotter

Android SDK Managercs423- cotter

Слайд 6AVD Manager
cs423- cotter

AVD Managercs423- cotter

Слайд 7From file menu, select “New” then “Project”
cs423- cotter

From file menu, select “New” then “Project”cs423- cotter

Слайд 8Identify project name
cs423- cotter

Identify project namecs423- cotter

Слайд 9Identify the desired SDK (based on the target device)
cs423- cotter

Identify the desired SDK (based on the target device)cs423- cotter

Слайд 10Provide a unique package name (reverse Domain Name + project)
cs423-

cotter

Provide a unique package name (reverse Domain Name + project)cs423- cotter

Слайд 11Empty Project Configuration
cs423- cotter

Empty Project Configurationcs423- cotter

Слайд 12Main.xml – Graphical Layout Empty Project
cs423- cotter

Main.xml – Graphical Layout Empty Projectcs423- cotter

Слайд 13Main.xml – Graphical Layout Completed Project
cs423- cotter

Main.xml – Graphical Layout Completed Projectcs423- cotter

Слайд 14Main.xml
cs423- cotter

Main.xmlcs423- cotter

Слайд 15EchoClientActivity.xml
cs423- cotter

EchoClientActivity.xmlcs423- cotter

Слайд 16Strings.xml
cs423- cotter

Strings.xmlcs423- cotter

Слайд 17AndroidManifest.xml
cs423- cotter

AndroidManifest.xmlcs423- cotter

Слайд 18Base Android 2.2 Phone VD
cs423- cotter

Base Android 2.2 Phone VDcs423- cotter

Слайд 19Base Android 2.2 Phone VD
cs423- cotter

Base Android 2.2 Phone VDcs423- cotter

Слайд 20UDP Echo Client (1)
cs423- cotter

UDP Echo Client (1)cs423- cotter

Слайд 21UDP Echo Client (2)
cs423- cotter

UDP Echo Client (2)cs423- cotter

Слайд 22UDP Echo Client (3)
cs423- cotter

UDP Echo Client (3)cs423- cotter

Слайд 23echoClient.apk
cs423- cotter

echoClient.apkcs423- cotter

Слайд 24EchoClientActivity.java
package edu.umkc.cotterr.echo;
import android.app.Activity; android.os.Bundle; android.view.View; android.widget.EditText; android.widget.Toast; java.net.*; java.io.*;

import edu.umkc.cotterr.echo.R;
public

class EchoClientActivity extends Activity {
/** Called when the

activity is first created. */
private EditText portNumber;
private EditText hostName;
private EditText inputMsg;
private EditText resultMsg;
private InetAddress ia;
private Socket mySocket;
private InputStream isIn;
private PrintStream psOut;
private byte abIn[];

cs423- cotter

EchoClientActivity.javapackage edu.umkc.cotterr.echo;import android.app.Activity; android.os.Bundle; android.view.View; android.widget.EditText; android.widget.Toast; java.net.*; java.io.*;import edu.umkc.cotterr.echo.R;public class EchoClientActivity extends Activity {  /**

Слайд 25EchoClientActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);


setContentView(R.layout.main);
hostName = (EditText) findViewById(R.id.editText1);


portNumber = (EditText) findViewById(R.id.editText2);
resultMsg = (EditText) findViewById(R.id.editText3);
inputMsg = (EditText) findViewById(R.id.editText4);
}

cs423- cotter

EchoClientActivity.javapublic void onCreate(Bundle savedInstanceState) {    	super.onCreate(savedInstanceState);    	setContentView(R.layout.main);    	hostName

Слайд 26EchoClientActivity.java
public void myEchoHandler(View view) {
switch (view.getId()) {


case R.id.button1: /* This is the connect button
String

sHostName = hostName.getText().toString();
int iPortNumber = Integer.parseInt(portNumber.getText().toString());
try {
ia = InetAddress.getByName(sHostName);
mySocket = new Socket (ia, iPortNumber); Toast.makeText(this,"We are now connected to: " + hostName + "\n", Toast.LENGTH_LONG).show();
} catch (Exception ex) {
Toast.makeText(this,"Connect to " + hostName + "failed. Exception" + ex + "\n", Toast.LENGTH_LONG).show();
}
break;

cs423- cotter

EchoClientActivity.javapublic void myEchoHandler(View view) {  		switch (view.getId()) {  		case R.id.button1:  		/* This is the

Слайд 27EchoClientActivity.java
case R.id.button2: /* This is the send data button

*/
String sResponse, sTemp
String sInputMsg = inputMsg.getText().toString();
int iNumRead;
abIn

= new byte[1024];
try {
isIn = mySocket.getInputStream();
psOut = new PrintStream(mySocket.getOutputStream());
psOut.print(sInputMsg);
iNumRead = isIn.read(abIn,0,1024);
sTemp = new String(abIn, 0, iNumRead);
sResponse = "We got back: " + sTemp;
resultMsg.setText(sResponse);
} catch (Exception ex) {
Toast.makeText(this,"Send data failed. Exception" + ex + "\n",
Toast.LENGTH_LONG).show(); }
break;

cs423- cotter

EchoClientActivity.javacase R.id.button2:  /* This is the send data button */ 	String sResponse, sTemp	String sInputMsg = inputMsg.getText().toString();	int

Слайд 28EchoClientActivity.java
case R.id.button3: // This is the quit button.
String

sTemp2;
try {
mySocket.close();
inputMsg.setText("");
sTemp2

= new String ("Goodbye ...");
resultMsg.setText(sTemp2);
} catch (Exception ex) {
Toast.makeText(this,"Close socket failed. Exception“
+ ex + "\n", Toast.LENGTH_LONG).show();
}
} //end of switch
} //end of myEchoHandler
} //end of EchoClientActivity

cs423- cotter

EchoClientActivity.java	case R.id.button3:  // This is the quit button. 		String sTemp2;  		try {  			mySocket.close();

Слайд 29R.java
package edu.umkc.cotterr.echo;

public final class R {
public static final

class attr {
}
public static final class

color {
public static final int backgroundColor=0x7f050000;
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class layout {
public static final int main=0x7f030000;
}

cs423- cotter

R.javapackage edu.umkc.cotterr.echo;public final class R {  public static final class attr {  }  public

Слайд 30R.java
public static final class id {

public static final int button1=0x7f060004;
public static

final int button2=0x7f060008;
public static final int button3=0x7f060009;
public static final int editText1=0x7f060001;
public static final int editText2=0x7f060003;
public static final int editText3=0x7f06000b;
public static final int editText4=0x7f060006;
public static final int linearLayout1=0x7f060007;
public static final int textView1=0x7f060000;
public static final int textView2=0x7f060002;
public static final int textView3=0x7f060005;
public static final int textView4=0x7f06000a;
}

cs423- cotter

R.java public static final class id {    public static final int button1=0x7f060004;

Слайд 31R.java
public static final class string {

public static final int ConvertButton=0x7f040002;
public static

final int DefaultHost=0x7f040003;
public static final int DefaultPort=0x7f040004;
public static final int app_name=0x7f040001;
public static final int connectButton=0x7f040007;
public static final int hello=0x7f040000;
public static final int hostname=0x7f040005;
public static final int input=0x7f040008;
public static final int port=0x7f040006;
public static final int quit=0x7f04000b;
public static final int result=0x7f040009;
public static final int send=0x7f04000a;
}
}

cs423- cotter

R.java public static final class string {    public static final int ConvertButton=0x7f040002;

Слайд 32main.xml

android:background="@color/backgroundColor"
android:orientation="vertical" >

android:id="@+id/textView1“ android:layout_width="wrap_content“
android:layout_height="wrap_content" android:text="@string/hostname"
android:textAppearance="?android:attr/textAppearanceMedium" />

android:id="@+id/editText1“ android:layout_width="201dp"
android:layout_height="wrap_content“
android:hint="@string/DefaultHost“ android:inputType="text" >



cs423- cotter

main.xml      cs423- cotter

Слайд 33main.xml

android:layout_height="wrap_content"
android:text="@string/port"
android:textAppearance="?android:attr/textAppearanceMedium" />

android:id="@+id/editText2“ android:layout_width="73dp"
android:layout_height="wrap_content"
android:hint="@string/DefaultPort“ android:inputType="text"
android:width="100dp" />

android:id="@+id/button1"
android:layout_width="wrap_content“ android:layout_height="wrap_content"
android:onClick="myEchoHandler"
android:text="@string/connectButton" />

cs423- cotter

main.xml cs423- cotter

Слайд 34main.xml

android:layout_height="wrap_content"
android:text="@string/input"

android:textAppearance="?android:attr/textAppearanceMedium" />

android:id="@+id/editText4"
android:layout_width="match_parent"
android:inputType="text"
android:layout_height="wrap_content" />

cs423- cotter

main.xml   cs423- cotter

Слайд 35main.xml

android:layout_height="wrap_content" >

android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="myEchoHandler"
android:text="@string/send" />
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/quit" android:onClick="myEchoHandler"/>


cs423- cotter

main.xml           cs423- cotter

Слайд 36main.xml

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/result"

android:textAppearance="?android:attr/textAppearanceLarge" />

android:id="@+id/editText3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:height="100dp"
android:inputType="textMultiLine" />


cs423- cotter

main.xml      cs423- cotter

Слайд 37strings.xml



Hello World, EchoClientActivity!

name="app_name">Bob\'s EchoClient
#002864
Convert

name="DefaultHost">localhost
3456
Hostname
Port
Connect
User Input
Echo Results
Send Echo
Exit Echo

cs423- cotter

strings.xml  Hello World, EchoClientActivity!  Bob\'s EchoClient  #002864  Convert  localhost  3456

Слайд 38AndroidManifest.xml

>


android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
android:name=".EchoClientActivity"
android:label="@string/app_name" >







cs423- cotter

AndroidManifest.xml

Слайд 39Summary
Android Development has strong support in Eclipse IDE
Core Android language

is Java, with a full library of Android classes
cs423- cotter

SummaryAndroid Development has strong support in Eclipse IDECore Android language is Java, with a full library of

Обратная связь

Если не удалось найти и скачать доклад-презентацию, Вы можете заказать его на нашем сайте. Мы постараемся найти нужный Вам материал и отправим по электронной почте. Не стесняйтесь обращаться к нам, если у вас возникли вопросы или пожелания:

Email: Нажмите что бы посмотреть 

Что такое TheSlide.ru?

Это сайт презентации, докладов, проектов в PowerPoint. Здесь удобно  хранить и делиться своими презентациями с другими пользователями.


Для правообладателей

Яндекс.Метрика