Started Android Studio Programming in order to create my own music player to my liking (I have 20 Gbyte of music stored in SD card) and was able to create one.
I have been using it while walking. Not made public yet. Updated: 5/31/2021
Index
How to support Android Auto with my app?I created my music player application but Android auto does not show it as a choice. In order to support Android Auto, you have to do three things as follows:https://developer.android.com/training/cars/media/auto 1. Set minSdkVersion to Android 5 or higher in Android Manifest.xml <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="21 /> 2. Declear media support for Android Auto <application> ... <meta-data android:name="com.google.android.gms.car.application" android:resource="@xml/automotive_app_desc"/> ... </application> 3. Add a resource xml file to res/xml/ directory <automotiveApp> <uses name="media" /> <automoticApp> Icon size?Notification icon sizes in pixels are as follows:http://petrnohejl.github.io/Android-Cheatsheet-For-Graphic-Designers/
Notice: the first icon dimension in table cell is full asset size, the second icon dimension is optical square. Dimension values are in pixels. How can I verify the sign of my apk?use jarsigner in Program Files\Android\jdk\microsoft_dist_openjdk_1.8.025\bin\jarsigner. jarsigner -verify -verbose -certs (your).apk Understand the Activity LifecycleSomehow many books on Android programming don't mention the activity lifecycle. It is very important to knowhow to create a robust app. Read here https://developer.android.com/guide/components/activities/activity-lifecycle or here https://www.linuxtopia.org/online_books/android/devguide/guide/topics/fundamentals.html. How to set selected row in RecyclerView?I created a RecyclerView with TextView ViewHolder. Somehow nobody talks about showing the selected row using a background color. @Override public void onBindViewHolder(ViewHolder holder, int position) { String value = mData.get(position); holder.myTextView.setText(value); if (position == selectedItem) { holder.itemView.setBackgroundColor(Color.parseColor("#99E4EBEF")); } else { holder.itemView.setBackgroundColor(Color.parseColor("#99FFFFFF")); } } ... public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { TextView myTextView; ViewHolder(View itemView) { super(itemView); myTextView = itemView.findViewById(R.id.rowValue); itemView.setOnClickListener(this); } @Override public void onClick(View view) { if (mClickListener != null) { lastSelected = selectedItem; selectedItem = getAdapterPosition(); mClickListener.onItemClick(view, selectedItem); notifyItemChanged(lastSelected); notifyItemChanged(selectedItem); } } ... } Got ERROR: Failed to resolve: com.android.support:appcompat-v7:28.+The message was : Add Google Maven repository and sync project allprojects { repositories { jcenter() maven { url 'https://maven.google.com/' } google() } } |
Programming‎ > ‎