-
이전수업에 했던것program_language 및 궁금한것/Android Studio 2018. 4. 5. 10:1812345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758package com.example.administrator.myapplication;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.util.Log;import android.view.View;import android.widget.Button;import android.widget.TextView;public class MainActivity extends AppCompatActivity implements View.OnClickListener {TextView txt1;TextView edit;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);txt1 = (TextView) findViewById(R.id.txt1);txt1.setText(" Hi jinsil");Button button = (Button) findViewById(R.id.button);button.setText("로그인");button.setOnClickListener(this);edit = (TextView) findViewById(R.id.edit);edit.setHint("수정");}@Overridepublic void onClick(View v) {String str;str = edit.getText().toString();// txt1.setText(str);// edit.setText("");// Log.d("fff", str);int input = Integer.parseInt(str);String str2 = "";if (1 < input && input < 10) {for (int i = 2; i < 10; i++) {for (int j = 1; j < 10; j++) {if (input == i) {str2 = str2 + i + "x" + j + "=" + i * j + "\n";}}}} else {txt1.setText("2~9까지의 숫자를 적어주세요.");}txt1.setText(str2);}}
cs 밑은 xml
123456789101112131415161718192021<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.example.administrator.myapplication"><applicationandroid:allowBackup="true"android:icon="@mipmap/ic_launcher"android:label="@string/app_name"android:roundIcon="@mipmap/ic_launcher_round"android:supportsRtl="true"android:theme="@style/AppTheme"><activity android:name=".MainActivity"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity></application></manifest>cs 반응형'program_language 및 궁금한것 > Android Studio' 카테고리의 다른 글
안드로이드 숙제 (0) 2018.04.10 안드로이드 방탈출!! 거의완성.. (0) 2018.04.05 버튼에 설정넣기. (0) 2018.04.05 안드로이드 기본틀 (0) 2018.04.05 안드로이드 레이아웃 (0) 2018.04.03