EasyPermissions implementation 'pub.devrel:easypermissions:1.3.+' public class MainActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks { public static final int REQUEST_CODE = 123; Button btnOpenCamera; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnOpenCamera = findViewBy..
implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:design:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' package com.example.devat.myapplication; public class ExampleItem { private int mImageResource; private String mText1; private String mText2; public ExampleItem(int mImageResource, String mText1, String mText2) { this...
imeOptions 사용 public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); EditText editText1 = findViewById(R.id.edit_text1); EditText editText2 = findViewById(R.id.edit_text2); editText1.setOnEditorActionListener(editorListener); editText2.setOnEditorActionListene..
HashMap 사용방법 public class MapIterationSample { public static void main(String[] agrs) { Map map = new HashMap(); map.put("키1", "값1"); map.put("키2", "값2"); map.put("키3", "값3"); map.put("키4", "값4"); map.put("키5", "값5"); map.put("키6", "값6"); // 방법1 Iterator keys = map.keySet().iterator(); while( keys.hasNext() ){ String key = keys.next(); System.out.println( String.format("키 : %s, 값 : %s", key, map..
Custom AutoCompleteTextView public class MainActivity extends AppCompatActivity { private List countryList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); fillCountryList(); AutoCompleteTextView editText = findViewById(R.id.actv); AutoCompleteAdapter adapter = new AutoCompleteAdapter(this, countryList); e..
SpannableString Text Color public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView textView = findViewById(R.id.color_tv); String text = "I want THIS and THIS to be colored"; SpannableString ss = new SpannableString(text); SpannableStringBuilder ssb = ..
Remove the ActionBar style.xml AndroidManifest.xml MainActivity.java public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btn1 = findViewById(R.id.activity_one); btn1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v..
TextSwitcher 사용 public class MainActivity extends AppCompatActivity { private TextSwitcher textSwitcher; private Button nextButton; private int stringIndex = 0; private String[] row = {"ONE", "TWO", "THREE", "FORE", "FIVE"}; private TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textSwi..
SearchView + RecyclerView RecyclerView & CardView Dependencies:developer.android.com/topic/libraries/support-library/packages.html#v7-recyclerviewdeveloper.android.com/topic/libraries/support-library/packages.html#v7-cardview dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.0' implementation 'com.android.support:design:..
BottomNavigationView dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.0.0' implementation 'com.android.support:design:27.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementa..