Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
MOBIL QQSHA.docx
Скачиваний:
0
Добавлен:
27.11.2023
Размер:
6.09 Mб
Скачать

Tema: Android sistemasında paydalaniwshı interfeysin jaratıw. Berilgen variant boyınsha programma interfeysi jaratıw.

Jumıstan maqset: Android sistemasında paydalaniwshı interfeysin jaratıw hám bar bolǵan komponentalar (button, textview, edittext, checkbox ...) hám olardıń qásiyetlerinen paydalanıw kónlikpelerine iye bolıw

Máseleniń qoyılıwı: Student variant boyınsha berilgen proektti Android sistemasında islep shıǵıw hám emulyator arqalı nátiyje alıwı kerek.

Jumıstı orınlaw ushın kórsetpe hám úlgi

Mısal: 2 sandı qosıw ushın paydalanıwshı interfeysin jaratıń.

Bul jaǵdayda Android qollanbasın jaratıw ushın programmalastırıw ortalıǵı iske túsiriledi hám “AddTwoElements” atlı proekt jaratıladı. Jaratılǵan proekttiń tiykarǵı faylları tómendegishe ózgertiledi.

MainActivity.java

package com.example.addtwoelements;

import android.os.Bundle;

import android.app.Activity;

import android.util.Log;

import android.view.View;

import android.widget.Button;

import android.widget.EditText;

import android.widget.TextView;

public class MainActivity extends Activity {

EditText edt_num1;

EditText edt_num2;

TextView txv_result;

Button btn_add;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

edt_num1 = (EditText) findViewById(R.id.editText1);

edt_num2 = (EditText) findViewById(R.id.editText2);

txv_result = (TextView) findViewById(R.id.textViewResult);

btn_add = (Button) findViewById(R.id.button1);

Log.d("Result","App is working!!!");

}

public void onClickAdd(View v){

Log.d("Result","Button is clicked!!!");

int num1 = 0;

int num2 = 0;

int result = 0;

num1 = Integer.parseInt(edt_num1.getText().toString());

num2 = Integer.parseInt(edt_num2.getText().toString());

result = num1 + num2;

txv_result.setText(num1 + " + " + num2 + " = " + result);

}

}

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="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=".MainActivity" >

<TextView

android:id="@+id/textView1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/title_txv" />

<EditText

android:id="@+id/editText1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@+id/textView1"

android:layout_centerHorizontal="true"

android:layout_marginTop="16dp"

android:ems="10" />

<EditText

android:id="@+id/editText2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignLeft="@+id/editText1"

android:layout_below="@+id/editText1"

android:layout_marginTop="22dp"

android:ems="10" />

<TextView

android:id="@+id/textView2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignLeft="@+id/textView1"

android:layout_below="@+id/editText2"

android:layout_marginTop="44dp"

android:text="@string/result_txv" />

<TextView

android:id="@+id/textViewResult"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignBottom="@+id/textView2"

android:layout_toRightOf="@+id/textView1"

android:text="@string/result" />

<Button

android:id="@+id/button1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@+id/textViewResult"

android:layout_marginTop="34dp"

android:layout_toRightOf="@+id/textView2"

android:text="@string/add_btn"

android:onClick="onClickAdd" />

</RelativeLayout>

string.xml

<?xml version="1.0" encoding="utf-8"?>

<resources>

<string name="app_name">2-tajriba-ishi</string>

<string name="action_settings">Settings</string>

<string name="title_txv">Add two elements</string>

<string name="result_txv">Result:</string>

<string name="result"></string>

<string name="add_btn">Add two elements</string>

</resources>

Programma nátiyjesi:

2 – laboratoriyalıq jumısı boyınsha variantlar

Proekt atı

Studentler sanı

1

Advertising apps

3

2

Simple calculator

3

3

Using mathematical formula

3

4

Binary calculator

3

5

Calculation trigonometric function

3

6

Creating authentification user interface

3

7

Calculate shapes area

3

8

Student day app (FoodsApp)

3

3 – Laboratoriyalıq jumıs

Соседние файлы в предмете Mobil qosimshalar