ãã®äžé£ã®èšäºã§ã¯ãAndroidåãã«éçºããéã«å¯ŸåŠããªããã°ãªããªãã£ãåé¡ã«ã€ããŠã話ããããšæããŸãã ç§ã®ç®æšã¯ããããã®åé¡ã«å¯Ÿããåªãããœãªã¥ãŒã·ã§ã³ãæäŸããããšã§ã¯ãªã
1. DatePickerDialogã®Dismissã¯OnDateSetListenerãã³ãã©ãŒãåŒã³åºããŸã
ç¶æ³
åå¿è ã«ãšã£ãŠã¯éåžžã«äžå¿«ãªåé¡ã§ãã ç¹ã«ãSDKãæèšã®ããã«æ©èœããããšãæåŸ ããŠããå Žåã
ãã€ãŠãç§ã¯ãããäœã§ããããç解ããããã«ãããããããªããã°ãªããŸããã§ããã ãã®åé¡ã¯ãæéãèšå®ããåŸãã¢ããªã±ãŒã·ã§ã³ã«ãã£ãŒãããã¯ããªãã£ããšããäºå®ã«ãã£ãŠæªåããŸããïŒæ°ããæéã¯ç»é¢ã«è¡šç€ºãããŸããã§ããïŒã ãã¹ãŠã®ããŒã¿ã¯ããã«ãªããžã§ã¯ãã«å ¥åãããããŒã¿ããŒã¹ã«ä¿åãããããã€ãã®ç»é¢ãèªã¿æ»ãããŸããã
ãããã°ãéå§ãããå Žæ-ãã£ã¹ãã¬ã€ç»é¢ããïŒæ¥ä»ã¯ãã¹ãDate.nowïŒïŒã«äœ¿çšããããã-è¿œå ã®æ¥ããããããããããããïŒããã§ãŒã³ã«æ²¿ã£ãŠæ³åããã®ã¯ç°¡åã§ãã
解決ç
å®éããã®ãã°ã¯ Lollipopã§ä¿®æ£ãããŸãããã 誰ãæ°ã«ããŸããïŒ AppCompatã§ã¯ãGoogleã¯Google fixãè¿œå ããäºå®ããªããããåé¿çãå¿ èŠã§ãã ãããŠã圌ã¯ããã§ã -圌ãã¯ãã¡ã€ã«å šäœãã³ããŒããŠããããéã³ãŸãã å®è£ æ å ±ã¯stackoverflowã§èŠã€ããããšãã§ããŸãã
DatePickerDialogFragment
/* * Copyright 2012 David Cesarino de Sousa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.davidcesarino.android.common.ui; import android.annotation.TargetApi; import android.app.Activity; import android.app.DatePickerDialog; import android.app.DatePickerDialog.OnDateSetListener; import android.app.Dialog; import android.content.DialogInterface; import android.os.Build; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.widget.DatePicker; /** * <p>Provides a usable {@link DatePickerDialog} wrapped as a {@link DialogFragment}, * using the compatibility package v4. Its main advantage is handling Issue 34833 * automatically for you.</p> * * <p>Current implementation (because I wanted that way =) ):</p> * * <ul> * <li>Only two buttons, a {@code BUTTON_POSITIVE} and a {@code BUTTON_NEGATIVE}. * <li>Buttons labeled from {@code android.R.string.ok} and {@code android.R.string.cancel}. * </ul> * * <p><strong>Usage sample:</strong></p> * * <pre>class YourActivity extends Activity implements OnDateSetListener * * // ... * * Bundle b = new Bundle(); * b.putInt(DatePickerDialogFragment.YEAR, 2012); * b.putInt(DatePickerDialogFragment.MONTH, 6); * b.putInt(DatePickerDialogFragment.DATE, 17); * DialogFragment picker = new DatePickerDialogFragment(); * picker.setArguments(b); * picker.show(getActivity().getSupportFragmentManager(), "fragment_date_picker");</pre> * * @author davidcesarino@gmail.com * @version 2015.0904 * @see <a href="http://code.google.com/p/android/issues/detail?id=34833">Android Issue 34833</a> * @see <a href="http://stackoverflow.com/q/11444238/489607" * >Jelly Bean DatePickerDialog â is there a way to cancel?</a> * */ public class DatePickerDialogFragment extends DialogFragment { public static final String YEAR = "Year"; public static final String MONTH = "Month"; public static final String DATE = "Day"; private OnDateSetListener mListener; @Override public void onAttach(Activity activity) { super.onAttach(activity); this.mListener = (OnDateSetListener) activity; } @Override public void onDetach() { this.mListener = null; super.onDetach(); } @TargetApi(11) @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Bundle b = getArguments(); int y = b.getInt(YEAR); int m = b.getInt(MONTH); int d = b.getInt(DATE); // Jelly Bean introduced a bug in DatePickerDialog (and possibly // TimePickerDialog as well), and one of the possible solutions is // to postpone the creation of both the listener and the BUTTON_* . // // Passing a null here won't harm because DatePickerDialog checks for a null // whenever it reads the listener that was passed here. >>> This seems to be // true down to 1.5 / API 3, up to 4.1.1 / API 16. <<< No worries. For now. // // See my own question and answer, and details I included for the issue: // // http://stackoverflow.com/a/11493752/489607 // http://code.google.com/p/android/issues/detail?id=34833 // // Of course, suggestions welcome. final DatePickerDialog picker = new DatePickerDialog(getActivity(), getConstructorListener(), y, m, d); if (isAffectedVersion()) { picker.setButton(DialogInterface.BUTTON_POSITIVE, getActivity().getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { DatePicker dp = picker.getDatePicker(); mListener.onDateSet(dp, dp.getYear(), dp.getMonth(), dp.getDayOfMonth()); } }); picker.setButton(DialogInterface.BUTTON_NEGATIVE, getActivity().getString(android.R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) {} }); } return picker; } private static boolean isAffectedVersion() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP; } private OnDateSetListener getConstructorListener() { return isAffectedVersion() ? null : mListener; } }
2.ãã¿ã³ã䜿çšããã«ã¯ãããã«ã¯ãªãã¯ããå¿ èŠããããŸã
ç¶æ³
ãã¯ããã©ã®ããã«ïŒãã®ã«ããŽãªããã®å¥ã®ã±ãŒã¹ã éããŠãããã€ã¢ãã°ããã¯ã¹ã§ãè€æ°ã®EditTextsã«ããŒã¿ãå ¥åãã[OK]ãã¯ãªãã¯ããç¶æ³ãæ³åããŠãã ããã äœãããããã®ã§ããããïŒ ããšãã°ã[OK]ãã¿ã³ã¯ã¯ãªãã¯ãç¡èŠã§ããŸãã ããããæåã®...ã ãã§ã¯ãªããåžžã«...
解決ç
ãããŠã決å®ã¯éåžžã«ç°¡åã§ãã setFocusableInTouchModeïŒïŒã®éæ³ãšãããäœã§ããããç¥ãå¿ èŠããããŸãã ç§ãã¡ã®å€ãã¯ã ãã©ãŒã«ã¹å¯èœãªããããã£ã«ååãªæ³šæãæã£ãŠããŸããã 確ãã«ãããã¯ããèªäœã§æãããã倧éšåã¯æ¬æ¥ããã¹ãæ¯ãèããããŸãã ãããŠãããã§ç§ãã¡ã¯ã€ããŸããããŸãïŒ
- ãŠãŒã¶ãŒããã¿ã³ãã¯ãªãã¯ãããšããŠãŒã¶ãŒã¯ãã¿ã³ã«ãã©ãŒã«ã¹ã移åããŸãã
- ãŠãŒã¶ãŒãç»é¢ãã¯ãªãã¯ããããã©ã®èŠçŽ ãã¯ãªãã¯ããªãå Žå-ãã©ãŒã«ã¹ã¯ç»é¢ã«è»¢éãããŸããã€ãŸãããã©ãŒã«ã¹ã¯åæ£ããŸããã€ãŸãããã©ãŒã«ã¹ã¯ã¿ããã¢ãŒãã«ãªãããã©ãŒã«ã¹ã¢ãŒãããªãå Žåã«ãªããŸãã
ãã ïŒ ããã«ã¯ãåžžã«äŸå€ããããŸãã å Žåã«ãã£ãŠã¯ããã®ã¢ãŒãã§ãã©ãŒã«ã¹ãååšããå¯èœæ§ããããŸãïŒãããç¹°ãè¿ããŸãããããã©ãŒã«ã¹ãªãã¢ãŒãããšåŒã°ããŸãïŒã æãé¡èãªäŸã¯EditTextã§ãã ãã®åäœã¯ãããŒããŒããšEditTextã®åæ察話ã«å¿ èŠã§ãã ããã§ãªããã°ãäœããæžãããšã¯æ©èœããŸããã
æçµçã«ããœãªã¥ãŒã·ã§ã³ã¯ãã¿ã³ã®focusableInTouchMode = trueã§ãã ãœãªã¥ãŒã·ã§ã³ã¯ã·ã³ãã«ã«èŠããŸãããã©ãããå§ããã°ãããããããªããšãã¯ããã¹ãŠãç°ãªãè²ã«ãªããŸãã 詳现ã«ã€ããŠã¯android-developers.blogspot.ruãã芧ãã ãã ã
3. Bundle.putParcelableïŒïŒ -åžžã«ã·ãªã¢ã©ã€ãŒãŒã·ã§ã³ãšã¯éããŸãã
ç¶æ³
ãã€ã¢ãã°ããã¯ã¹ããããã¢ã¯ãã£ããã£ããããŸãã åæ¢ãªåå¿ãšããŠã VeryComplexModelã¯ã©ã¹ã®ãªããžã§ã¯ãããã€ã¢ãã°ããã¯ã¹ã«è»¢éããŠã¢ã¯ã·ã§ã³ïŒããšãã°ãç·šéïŒãå®è¡ãããããæ»ããŠæ°ããããŒãžã§ã³ãã¢ã¯ãã£ããã£ã®ããŒã¿ããŒã¹ã«ä¿åããããšã«ããŸãã
ãããŠåã³ãéæ³ã¯å¯Ÿè©±ãéãããšãã«èµ·ãããŸãã ãªããžã§ã¯ãã®ããŒã«ã«ã³ããŒã¯å€ããŸãŸã§ããããã«èŠããŸãããããã§ã¯ãããŸããã 圌女ã¯å€ãã£ãã
解決ç
Bundleã®ã¡ã«ããºã ã®èª€è§£ããã¹ãŠã§ãã ç§ã®ç解ã§ã¯ã Serialize ïŒïŒãšdeserializeïŒïŒãé£ç¶ããŠè¡ãããå Žåã Serializableããã³JSONObjectã®ããã«ã Bundleã¯åžžã«æåãããªããžã§ã¯ããäœæããŸãã ãããã«ãããç§ã¯ããæã£ãã ãã ããæé©åã®çç±ããŸãã¯ä»ã®äœããã®çç±ã§ã ãã³ãã«ã¯ã·ãªã¢ã«åããã«ãªããžã§ã¯ããžã®ãã€ã³ã¿ãä¿æã§ããŸãã ãããã£ãŠã åŽäžã«ãããããããã€ã¢ãã°å ã®ããŒã¿ã®å€æŽã ã³ããŒã®ã¿ã被害ãåãããšäºæ³ãããŠããŸãããã ãã以å€ã®å Žåã¯Android SDKã泚æããŸããã
4.ãã©ã°ã¡ã³ãå ã®getFragmentManagerïŒïŒ
ç¶æ³
ãããããããã¯åå¿è ïŒãããŠããã ãã§ã¯ãããŸããïŒïŒããã°ã©ããŒã®éã§æãäžè¬çãªåé¡ã§ãã å°ããªã©ãã¯ã¹ãã䟡å€ãããã1ã2æéã®ãããã°ãæäŸãããŸãã
FragmentManager㯠ãã¢ã¯ãã£ããã£å ã®ãã©ã°ã¡ã³ãã管çãããããããã³ä»ã®ãã©ã°ã¡ã³ãå ã®ãã¹ãããããã©ã°ã¡ã³ãã管çããããã«äœ¿çšãããŸãã
ã¢ã¯ãã£ããã£ã«ã¯getFragmentManagerïŒïŒã¡ãœãããããããã©ã°ã¡ã³ãã«ã¯getFragmentMangerïŒïŒã¡ãœããããããŸã-åŒã³åºãããã䜿çšããããæ©èœããŠããããŸãã¯ããã§ã¯ãªãïŒ..äœããåã³å£ããŸããã
解決ç
æ®å¿µãªãããããã§ã¯2ã€ã®ããšãè£æã§ãã
- ã¢ã¯ãã£ããã£ãšãã©ã°ã¡ã³ããã»ãŒåãããã«åäœããããšãæåŸ ãã
- RTFMååãç¡èŠãã
ããã¥ã¡ã³ããèŠããšããã©ã°ã¡ã³ãã®getFragmentManagerïŒïŒ ã芪ã®FragmentManagerãè¿ãããšãããã«ããããŸãã æåŸ ã©ããã«åäœããéåžžã®ãã®ãååŸããã«ã¯ã FragmentManagerãgetChildFragmentManagerïŒïŒã䜿çšããå¿ èŠããããŸãã
5.ã©ã³ã¿ã€ã ã§ã®Drawableã®å€æŽ
ç¶æ³
ããŸããŸãªãªããžã§ã¯ãã®ãã«ãã«ã©ãŒã®èæ¯ãäœæããŠãããšãã«ããã®åé¡ã«çŽé¢ããŸããã ããã¯ãã£ããã®äŸã§æ³åã§ããŸãããã£ããã®äŸã§ã¯ãã¡ãã»ãŒãžã®ããã«ïŒã¡ãã»ãŒãžããã«ïŒãç°è²ã§ã察話è ã®ããã«ãèµ€ã§æãããŠããŸãã
ãã¡ãããæãç°¡åãªè§£æ±ºçã¯ã2ã€ã®ç¬ç«ãããªãœãŒã¹ãäœæããããšã§ãã ããããããããäžåºŠã«ãããªãã®ããŒã ãããžã§ã¯ãã§ãããããªãã®ã¢ãŒãã£ã¹ãããã¬ãªãŒãã®ãããªãã®ã§ããå Žåã¯ã©ãã§ããããã ããã§ã¯ã setColorFilterïŒïŒãšãã圢åŒã®ããŸããŸãªã¡ãœããã圹ç«ã¡ãŸãã ããã§ããã
解決ç
yesã䜿çšããäžéšã®R.drawable.bg_bubbleã« setColorFilterïŒïŒãé©çšããã ãã§ããããžã§ã¯ã
å®éããŠãŒã¶ãŒãbg_bubbleã§100åã®ã¡ãã»ãŒãžã衚瀺ããå Žå ãããã¯ãã®ãªãœãŒã¹ã®ã³ããŒã100åãããšããæå³ã§ã¯ãããŸããã æå³ããããŸããã æé©åã®ããã«ã1ã€ã®ã³ããŒã®ã¿ãä¿åããããããbg_ bubbleã®å€æŽã¯ãã¹ãŠã®ã¡ãã»ãŒãžã«äžåºŠã«åœ±é¿ããŸãã
æãç°¡åãªè§£æ±ºçã¯ãããŒã«ã«ã³ããŒãäœæããããšã§ãã
Drawable clone = drawable.getConstantState().newDrawable();
åé¡ã®æ¬è³ªã¯å¥ã®äŸã§ããã§ãã詳现ã«èª¬æãããŸãã
6.ããŸããŸãªãµã€ãº/ãã©ã³ãã«é¢ä¿ãªãã TextViewããTextViewãžã®é 眮
ãªã«ïŒ äœãããããªãã£ã
ããã«èŠåŽããã«ããªã³ã¯ã¯ããã«ããŒã¹ã©ã€ã³ã®é 眮ãèŠãã§ãã ãããŠ2ã€ã§ãã
baselineã«ã€ããŠèšãããšã¯äœããããŸãããããããååšããããšãããã£ãŠããå Žåã®ã¿ã§ãã ããããããªããç¥ããªããªãã°...ãããŠæ¥œãã¿ã¯ããã£ã³ã°ãšããŒãžã³ããå§ãŸããŸã ã å人çã«ãç§ã¯ãããèŠãŸããã ãç£ãã§ããããã®ãããªã³ãŒããèšèªãšåŒã¶ããšãæ¢ããŠããªãã
7.ããã©ã«ãå€ã®ãªãã¹ãããŒ
ç¶æ³
ãæãè ã«å¯Ÿããä¿è·ãããã³ãã®åœ¢ã§è¿œå ããå¿ èŠãããã¹ãããŒããããŸãããããã¯ã¹ãããŒèªäœã®äŸ¡å€ã§ã¯ãããŸããã
ããŒã«ãããä»ãã®ã¹ãããŒ
Spinner.setPromptïŒïŒã¡ãœãããä»äºãããŠãããšæããããããŸããããããã¯ãããŸããã§ãã ã ããã¯ãã€ã¢ãã°ã«å¯ŸããŠã®ã¿æ©èœããAndroidã®ãã¹ãŠã®ããŒãžã§ã³ã§ã¯è¡šç€ºãããŸããã ã©ãããïŒ
解決ç
ãäœããªãã äžç·ã«æ®ãããïŒcïŒAndroid SDKã
ãã€ãã®ããã«ãããã¯ãå¿ èŠã§ãã æåã«é ã«æµ®ãã¶ã®ã¯ã説æã®ããèŠçŽ ãé åã®å é ã«1ã€è¿œå ããããšã§ãã ããããããã¯æªã決æã§ãã ããã³ãããã¹ãããŒã®å€ãšããŠéžæã§ããããã«ãªã£ãã ãã§ãªãã R.array / CursorAdapterã䜿çšãããšãã«åé¡ãçºçããŸãã
ãããŠããã€ãã®ããã«ã stackoverflowã®ãããã³ã°ã®æè¯ã®ãœãŒã¹ã§ãã
NothingSelectedSpinnerAdapter
import android.content.Context; import android.database.DataSetObserver; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListAdapter; import android.widget.SpinnerAdapter; /** * Decorator Adapter to allow a Spinner to show a 'Nothing Selected...' initially * displayed instead of the first choice in the Adapter. */ public class NothingSelectedSpinnerAdapter implements SpinnerAdapter, ListAdapter { protected static final int EXTRA = 1; protected SpinnerAdapter adapter; protected Context context; protected int nothingSelectedLayout; protected int nothingSelectedDropdownLayout; protected LayoutInflater layoutInflater; /** * Use this constructor to have NO 'Select One...' item, instead use * the standard prompt or nothing at all. * @param spinnerAdapter wrapped Adapter. * @param nothingSelectedLayout layout for nothing selected, perhaps * you want text grayed out like a prompt... * @param context */ public NothingSelectedSpinnerAdapter( SpinnerAdapter spinnerAdapter, int nothingSelectedLayout, Context context) { this(spinnerAdapter, nothingSelectedLayout, -1, context); } /** * Use this constructor to Define your 'Select One...' layout as the first * row in the returned choices. * If you do this, you probably don't want a prompt on your spinner or it'll * have two 'Select' rows. * @param spinnerAdapter wrapped Adapter. Should probably return false for isEnabled(0) * @param nothingSelectedLayout layout for nothing selected, perhaps you want * text grayed out like a prompt... * @param nothingSelectedDropdownLayout layout for your 'Select an Item...' in * the dropdown. * @param context */ public NothingSelectedSpinnerAdapter(SpinnerAdapter spinnerAdapter, int nothingSelectedLayout, int nothingSelectedDropdownLayout, Context context) { this.adapter = spinnerAdapter; this.context = context; this.nothingSelectedLayout = nothingSelectedLayout; this.nothingSelectedDropdownLayout = nothingSelectedDropdownLayout; layoutInflater = LayoutInflater.from(context); } @Override public final View getView(int position, View convertView, ViewGroup parent) { // This provides the View for the Selected Item in the Spinner, not // the dropdown (unless dropdownView is not set). if (position == 0) { return getNothingSelectedView(parent); } return adapter.getView(position - EXTRA, null, parent); // Could re-use // the convertView if possible. } /** * View to show in Spinner with Nothing Selected * Override this to do something dynamic... eg "37 Options Found" * @param parent * @return */ protected View getNothingSelectedView(ViewGroup parent) { return layoutInflater.inflate(nothingSelectedLayout, parent, false); } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { // Android BUG! http://code.google.com/p/android/issues/detail?id=17128 - // Spinner does not support multiple view types if (position == 0) { return nothingSelectedDropdownLayout == -1 ? new View(context) : getNothingSelectedDropdownView(parent); } // Could re-use the convertView if possible, use setTag... return adapter.getDropDownView(position - EXTRA, null, parent); } /** * Override this to do something dynamic... For example, "Pick your favorite * of these 37". * @param parent * @return */ protected View getNothingSelectedDropdownView(ViewGroup parent) { return layoutInflater.inflate(nothingSelectedDropdownLayout, parent, false); } @Override public int getCount() { int count = adapter.getCount(); return count == 0 ? 0 : count + EXTRA; } @Override public Object getItem(int position) { return position == 0 ? null : adapter.getItem(position - EXTRA); } @Override public int getItemViewType(int position) { return 0; } @Override public int getViewTypeCount() { return 1; } @Override public long getItemId(int position) { return position >= EXTRA ? adapter.getItemId(position - EXTRA) : position - EXTRA; } @Override public boolean hasStableIds() { return adapter.hasStableIds(); } @Override public boolean isEmpty() { return adapter.isEmpty(); } @Override public void registerDataSetObserver(DataSetObserver observer) { adapter.registerDataSetObserver(observer); } @Override public void unregisterDataSetObserver(DataSetObserver observer) { adapter.unregisterDataSetObserver(observer); } @Override public boolean areAllItemsEnabled() { return false; } @Override public boolean isEnabled(int position) { return position != 0; // Don't allow the 'nothing selected' // item to be picked. } }
䜿çšäŸ
Spinner spinner = (Spinner) findViewById(R.id.spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.planets_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setPrompt("Select your favorite Planet!"); spinner.setAdapter( new NothingSelectedSpinnerAdapter( adapter, R.layout.contact_spinner_row_nothing_selected, // R.layout.contact_spinner_nothing_selected_dropdown, // Optional this));
8. SupportMapFragmentãšåŒã°ãããµãã
ç¶æ³
å¶ç¶ãã«ãŒããæ±ãå¿ èŠããããŸãã...幞ããªããšã«ãããã¯äžåºŠã ãã§ããããããã§ããã¹ãã¬ã¹ã®ããã«å°ãè£ãã髪ã
ãã€ãã®ããã«ãSDKã¯çµ¶å¯Ÿã«äžæ³šæã§ãããæèšã®ããã«æ©èœããããšãèæ ®ããŠãmem-faceãååŸããŸããã ãã®ç¬éãç§ã¯æè¿é ä¿¡ãããLeakCanaryãåãã§ã圌ã粟ç¥çã«è³è³ãããã°ãå匷ãå§ããŸããã 圌ãã¯å¥åŠã§ããïŒããšãã°ã com.google.android.gms.location.internal.zzkãšããè¡ããããŸããïŒãã MapFragmentããªãŒã¯ããŠãããšèšã£ãŠããŸãã ã ãœãŒã¹ã³ãŒãã1æé以äžèª¿ã¹ãŠãæåŸã«äœãèŠã€ããŸãããïŒ ããŠãçãã¯ãã§ã«æããã ãšæããŸãã
å®éã«..
ãããå®éã«ã¯ã SDKãšåœŒå¥³ãšã®ããªããºãã¯æ眪ã§ãã ç§ã¯ééããåçœããŸããããã¯ããã«å¥åŠãªãã°ã«æ³šæãæã䟡å€ããããŸããããã©ããããããäžç·ã«æé·ããŸããã§ããã LeakCanaryã®ãã°ã¯ããããªããã®ãªã³ã¯ãæ£ç¢ºã«è¡šç€ºãããæåŸã®è¡ãé€ããããŸãæ確ã§ã¯ãªãããšããããããŸãããããã£ãŠãä»ã®ãã¹ãŠã¯å®å šã«ç¡èŠãããŸããã å人çã«ãç§ã¯æ¬¡ã®åé¡ã«ééããŸããã
æåŸã®ãã°ã¯ç¹ã«äžå¿«ã§ããã Parcelerã©ã€ãã©ãªãåããŠäœ¿çšãããšãã«ããã°ãå«ãŸããŠããããééã£ãŠäœ¿çšããŠãããšå€æããŸããã SupportMapFragmentãåå ã§ãã°ãçºçãããšããèãã¯ãŸã£ããçããŸããã§ãããå人çã«ãã³ãã«ã«ããŒã¿ãè¿œå ããã³ãã«ãããšãã«çºçããã«ãŒããšBadParcelableExceptionã«ã€ããŠã¯ã©ãã§ããããã ããã§ãç§ã¯åã³æ°æéãè²»ãããŠã ParcelerãšBundle.putParcelableïŒïŒã®ãœãŒã¹ã³ãŒããéåžžèã«å匷ããŸããã
ãããã«
ããã«ãªã¹ããããŠãããã¹ãŠã®åé¡ãšå¥åŠãªç¹ãããã³èšäºã®äžè¬çãªããŒã³ã«ãããããããç§ã¯ãŸã ã¢ã³ããã€ãçšã«ããã°ã©ã ãããã§ãã ã¯ããSDKãé¡ãªã©ã«å¹³ææã¡ãäžããããšããããŸãããäžè¬ã«ãä»ã®å€ãã®ãååã«å®çŸãããïŒïŒïŒå¯èœæ§ãæäŸããŸãã æ°ããToolbar ã NavigationDrawerããã³Behaviorã®äŸ¡å€ã¯äœã§ããïŒ å ±æèŠçŽ ã¢ã¯ãã£ããã£ã®ç§»è¡ã«ã€ããŠã¯èšããŸã§ããããŸããïŒ
ãã®èšäºã§éæãããããšã¯1ã€ã ãã§ããåæ§ã®åé¡ã«ãŸã ééããŠããªãå Žåããããã«ééããããã«Googleã«ã¢ã¯ã»ã¹ãããããã°ã§1æéãé£äºãããŸããã§ããã ãæºãã®ãã2ã€ã®éšåãSDK +ã©ã€ãã©ãªãšRxJavaãäœæããäºå®ã§ããããã¡ããããã¹ãŠã¯ãã®éšåã®çµæã«äŸåããŸãã
åå¿è ãäžè¬çãªããã°ã©ããŒã®æ¹ã¯ãæãªãšãã«CodePath Android Cliffnotesãèªãããšã匷ããå§ãããŸãã ããã¥ããããã«ã¯ãŸã£ãã圱é¿ããŸãããïŒãã¥ãããããªãå Žåã§ã¯ãããŸããïŒãSDKå šäœã®éåžžã«è©³çŽ°ãªèª¬æãæäŸããŸãã