목록Android (44)
군침이 싹 도는 코딩

// 액션바에 타이틀 변경법 getSupportActionBar().setTitle("직원 리스트"); # 액션바의 제목을 바꿀때는 getSupportActionBar를 사용해 가져온 뒤 setTitle로 바꿔주면 된다 코드의 위치는 바꾸고 싶은 액티비티의 onCreate 안에 넣으면 된다 # 액션바에 버튼을 달아주고싶다면 res > new > Android Resource File 파일 이름을 적고 Resource type 을 Menu로 선택해준다음 OK를 눌러준다 # xml 파일을 열고 메뉴 아이템을 끌어온 뒤 원하는대로 바꿔주면된다 icon을 넣으면 해당모양으로 액션바에 추가가 된다 눌렀을때 이벤트를 추가하기위해 id값도 넣어준다 showAsAction 항목을 always 하면 항상 버튼이 보이게 ..

package com.mugoori.networkapp2; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.os.Bundle; import android.widget.Toast; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.v..

dependencies { implementation 'com.android.volley:volley:1.2.1' } # Volley 라이브러리를 사용하기 위해 먼저 빌드 그리들에 해당 코드를 복사해준다 최선버전을 확인하려면 https://google.github.io/volley/ 여기로 가면 된다 package com.mugoori.networkapp1; import androidx.appcompat.app.AppCompatActivity; import android.app.DownloadManager; import android.os.Bundle; import android.util.Log; import android.widget.TextView; import com.android.volley.Re..

# 권한 설정은 manifests > AndroidManifest.xml application 위에 써주면 된다 # 에뮬레이터로 테스트를 해보려면 먼저 xml 파일을 만들어준다 *.접속할 도메인주소 # 컨픽 파일에 이런식으로 적어준다 *. 도메인 주소를 입력하면 이 주소로 오는 모든것을 허용한다는 뜻이다 android:targetSandboxVersion="1" android:usesCleartextTraffic="true" android:networkSecurityConfig="@xml/network_security_config" # manifests > AndroidManifest.xml 로 다시가서 3줄을 사진과같은 자리에 써준다

# VCS > Share Project on GitHub # Add account > Log in with Token # Generate 눌러서 토큰 유효 기간 설정 후 만들어준다 # 만든 토큰을 복사해서 안드로이드 스튜디오 토큰창에 붙여넣기해주고 쉐어를 눌러주면 깃허브에 레파지토리가 생성되면서 올라간것을 볼수 있다 # 이후 소스코드를 올릴때에는 GIt > commit 을 누르면 왼쪽에 커밋탭이 열린다 위쪽 커밋할 곳을 체크해주고 메세지를 적고 Commit and Push를 눌러주면 된다

public ArrayList SearchMemo(String keyword) { //1. 데이터베이스를 가져온다. SQLiteDatabase db = this.getReadableDatabase(); //2. 쿼리문 만든다. String query = " select * from memo where content like '%" + keyword + "%' or title like '%" + keyword + "%' " ; //3. 쿼리문을 실행하여, 커서로 받는다. Cursor cursor = db.rawQuery(query,null); //3-1.여러 데이터를 저장할 어레이리스트를 만든다. ArrayList memoArrayList = new ArrayList(); //4. 커서에서 데이터를 뽑아낸..

package com.mugoori.contactapp.model; import java.io.Serializable; // 클래스를 직렬화 함 public class Contact implements Serializable { public int id; public String name; public String phone; public Contact(){ } public Contact(String name, String phone) { this.name = name; this.phone = phone; } public Contact(int id, String name, String phone) { this.id = id; this.name = name; this.phone = phone; } } # ..

public class viewHolder extends RecyclerView.ViewHolder{ TextView txtName; TextView txtPhone; ImageView imgDelete; CardView cardView; public viewHolder(@NonNull View itemView) { super(itemView); txtName = itemView.findViewById(R.id.txtName); txtPhone = itemView.findViewById(R.id.txtPhone); imgDelete = itemView.findViewById(R.id.imgDelete); cardView = itemView.findViewById(R.id.cardView); cardVie..