'Android' 카테고리의 글 목록 — 뚝딱이

Android

Android

[Android] 안드로이드 스튜디오 RecyclerView item 버튼

https://pasongsong.tistory.com/201?category=1090989 [Android Studio] 안드로이드 스튜디오 JAVA RecyclerView Button 클릭 이벤트 Click Linstener 만들기 public interface OnItemClickListener { void onItemClick(View view, int pos); } // 리스너 객체 참조를 저장하는 변수 private OnItemClickListener mListener = null ; // OnItemClic.. pasongsong.tistory.com item position을 가져와야하기 때문에 다른 방식으로 바꾸기로 결정! interface OnItemClickListener { void..

Android

[Android Studio] 안드로이드 스튜디오 JAVA RecyclerView에서 버튼 intent 사용하기

Adapter가 activity가 아니기 때문에 Null error가 계속 발생해서 context를 추가해줬다. public DayMealAdapter(ArrayList food_list, Context context) { this.food_list = food_list; this.context = context; } Main에서는 이렇게 생성하면 된다. DayMealAdapter one_food_Adapter = new DayMealAdapter(meal_items, this); 버튼 클릭 부분 holder.food_camera.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ Log.w("TEST:..

Android

[Android Studio] 안드로이드 스튜디오 JAVA RecyclerView에서 Intent 사용하기

private Context context; this.context = context; 위의 두개를 설정해준다 Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(cameraIntent); context를 이용하여 intent를 사용한다 전체코드 package com.example.k_food_application; import android.content.Context; import android.content.Intent; import android.provider.MediaStore; import ..

Android

[Android Studio] 안드로이드 스튜디오 JAVA RecyclerView Button 클릭 이벤트

https://pasongsong.tistory.com/219 [Android] 안드로이드 스튜디오 RecyclerView item 버튼 https://pasongsong.tistory.com/201?category=1090989 [Android Studio] 안드로이드 스튜디오 JAVA RecyclerView Button 클릭 이벤트 Click Linstener 만들기 public interface OnItemClickListener { void onIte.. pasongsong.tistory.com [수정] position 위치를 가져오는 Click Click Linstener 만들기 public interface OnItemClickListener { void onItemClick(View view..

Android

[Android Studio] 안드로이드 스튜디오 JAVA Recycler View class 만들어서 추가하기

https://pasongsong.tistory.com/164?category=1090989 [Android Studio] 안드로이드 스튜디오 class 생성 class 붕어빵 틀과 같은 기능 recycler view item에 들어갈 값들을 모아둠 class 명으로 java 파일을 하나 만들고 자신이 넣고 싶은 값을 넣는다. 나는 아래와 같이 만듦 public class One_food { //음식사진 int.. pasongsong.tistory.com Recycler view item에 만들 class를 만들고 다음과 같이 작업 진행 저번에 만들었던 Recycler view Adapter에 추가한 변수를 넣을 것임 recycler view item Adaper int형 자료를 textview에 넣고싶..

Android

[Android Studio] 안드로이드 스튜디오 Java class 생성

class 붕어빵 틀과 같은 기능 recycler view item에 들어갈 값들을 모아둠 class 명으로 java 파일을 하나 만들고 자신이 넣고 싶은 값을 넣는다. 나는 아래와 같이 만듦 public class One_food { //음식사진 int food_resourceId; // day int day; //나트륨 int na; //단백질 int dan; //당류 int dang; //마그네슘 int ma; //아연 int zin; //에너지 int ene; //인 int p; //중량 int wei; //지방 int fat; //철 int fe; //칼륨 int k; //칼슘 int ca; //콜레스테롤 int chol; //탄수화물 int tan; // 트랜스지방 int trans; publ..

Android

[Android Studio] 안드로이드 스튜디오 Java firebase DB 연동

https://console.firebase.google.com/ 로그인 - Google 계정 이메일 또는 휴대전화 accounts.google.com 로그인하고 프로젝트 생성 후 google-service.json 파일을 얻는다 SHA-1 받는 법 gradle signingReport 입력 후 받는다. 그림과 같은 파일위치(모듈 루트)에 넣는다. build.gradle(Project) buildscript { repositories { // Make sure that you have the following two repositories google() // Google's Maven repository mavenCentral() // Maven Central repository } dependenci..

Android

[Android Studio] 안드로이드 스튜디오 Java Intent, 창 변환

Intent 컴포넌트간의 통신을 담당함 컴포넌트 종류 액티비티 Activity 서비스 Service 브로드캐스트 리시버 Broadcast Receiver 컨텐트 프로바이더 Content Provider 명시적 인텐트 현재 activity에서 다른 activity를 호출할 때 사용함 위의 사진의 방법으로 activity을 만들면 AndroidManifest.xml에 자동으로 생기지만 안생겼다면 정의해줘야함 Intent inte_cal = new Intent(MainActivity.this, Calender.class); startActivity(inte_cal); Log.w("TEST: ", "test calender" ); * log) 버튼이 작동이 안된다면 log를 사용하여 버튼이 잘 작동하는지 확인하..

파송송
'Android' 카테고리의 글 목록