목록Programming/Android Function (19)
2swan
main.xml sub.xml main.activity public class MainActivity extends AppCompatActivity { TextView tv_result; Button btn_move; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv_result = (TextView) findViewById(R.id.tv_result); btn_move = (Button) findViewById(R.id.btn_move); btn_move.setOnClickListener(new Vie..
main.xml activity_drawer.xml main.activity public class MainActivity extends AppCompatActivity { private DrawerLayout drawerLayout; private View drawerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); drawerLayout = findViewById(R.id.drawer_layout); drawerView = findViewById(R.id.drawer); Button btn_op..
main.xml main.acitivity public class MainActivity extends AppCompatActivity { private ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = findViewById(R.id.list); Listdata = new ArrayList(); ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,data); l..
main.xml main.activity public class MainActivity extends AppCompatActivity { ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageView = findViewById(R.id.imageView); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(get..
main.xml sub.xml main.activity public class MainActivity extends AppCompatActivity { private Button btn_move; private EditText et_test; private String str; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); et_test = findViewById(R.id.et_test); btn_move = findViewById(R.id.btn_move); btn_move.setOnClickListen..
main.xml main.activity public class MainActivity2 extends AppCompatActivity { SQLiteDatabase sqLiteDatabase; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); Button btnInit = findViewById(R.id.btnInit); Button btnInsert = findViewById(R.id.btnInsert); Button btnSelect = findViewById(R.id.btnSelect); Button..
main.xml main.java public class MainActivity3 extends AppCompatActivity { ListView list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main3); list = findViewById(R.id.list); Listdata = new ArrayList(); ArrayAdapteradapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,data); list.setAdapter(adapt..
main.xml sub.xml main.java import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; public class MainActivity extends AppCompatActivity { private TextView tv_comeback; private Button btn_go; private static final int REQUEST_CODE = 7..
main.xml main.java public class MainActivity3 extends AppCompatActivity { Button btn_start, btn_stop; Thread thread; boolean isThread = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main3); btn_start = findViewById(R.id.btn_start); btn_stop = findViewById(R.id.btn_stop); //스레드 시작 btn_start.setOnClickList..
main.xml sub1 ~ sub4.xml (layout폴더에 별도로 생성) main.activity public class MainActivity4 extends AppCompatActivity { Button btn1, btn2, btn3, btn4; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main4); btn1 = findViewById(R.id.btn_1); btn2 = findViewById(R.id.btn_2); btn3 = findViewById(R.id.btn_3); btn4= findViewB..
main.xml main.activity public class MainActivity4 extends AppCompatActivity { EditText et_save; String shared = "file"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main4); et_save = (EditText) findViewById(R.id.et_save); SharedPreferences sharedPreferences = getSharedPreferences(shared, 0); String value = sha..
main.xml main.activity public class MainActivity4 extends AppCompatActivity { private RadioGroup rg_gender; private RadioButton rb_man, rb_woman; private Button btn_result; private String str_result; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main4); rg_gender = findViewById(R.id.rg_gender); // 라디오 버튼들을 담고있는..