Media file in wrong encoding

痴心易碎 提交于 2019-12-08 08:10:33

问题


I am inserting a media file for a tutorial. I added a raw folder and copy pasted the media file in the raw folder. i see an error that saws "File was located in the wrong encoding: 'UTF-8" I can run the app smoothly but it never plays my media file. I tried to reload the encoding but it causes my app to mysteriously return to my phone's home screen. Please help. I also tested this on a different project and i managed to get 1 song to work. However the other songs still are in wrong encoding and when I try to reload it, android studio freezes for a while. If it helps this is where I got my music https://www.bensound.com/ This is my code: Media file(Very weird)

       ID3    CTYER      2016 TDAT      1401 TIME      1419 PRIV  W  XMP <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
    <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c111 79.158325, 2015/09/10-01:10:20        ">
     <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description rdf:about=""
        xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
        xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
        xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
        xmlns:xmp="http://ns.adobe.com/xap/1.0/"
        xmlns:creatorAtom="http://ns.adobe.com/creatorAtom/1.0/"
        xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/DynamicMedia/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
       xmpMM:InstanceID="xmp.iid:4f8bdd82-b23d-47f0-a030-79c78178f88e"
       xmpMM:DocumentID="c165b52d-e9ca-0ec6-e406-ebf300000047"
       xmpMM:OriginalDocumentID="xmp.did:54c715de-270a-4ec2-bfde-7e5d39a048b3"
       xmp:MetadataDate="2016-01-14T14:19:34-08:00"
       xmp:ModifyDate="2016-01-14T14:19:34-08:00"
       xmp:CreatorTool="Adobe Adobe Media Encoder CC (Macintosh)"
       xmp:CreateDate="2016-01-14T14:19:04-08:00"
       xmpDM:audioSampleRate="-1"
       xmpDM:audioSampleType="16Int"
       xmpDM:audioChannelType="Stereo"
       xmpDM:startTimeScale="30000"
       xmpDM:startTimeSampleSize="1001"
       dc:format="MP3">
       <xmpMM:History>
        <rdf:Seq>
         <rdf:li
          stEvt:action="saved"
          stEvt:instanceID="abdb65d6-add1-4884-ae3a-53b600000074"
          stEvt:when="2016-01-14T14:19:34-08:00"
          stEvt:softwareAgent="Adobe Adobe Media Encoder CC (Macintosh)"
          stEvt:changed="/"/>
         <rdf:li
          stEvt:action="created"
          stEvt:instanceID="xmp.iid:80538dc7-efe5-4e6d-8702-e2a00e50f759"
          stEvt:when="2016-01-14T14:18-08:00"
          stEvt:softwareAgent="Adobe Adobe Media Encoder CC (Macintosh)"/>
         <rdf:li
          stEvt:action="saved"
          stEvt:instanceID="xmp.iid:9a7174b0-cbaa-4e93-aa3a-3cefb9771883"
          stEvt:when="2016-01-14T14:19:34-08:00"
          stEvt:softwareAgent="Adobe Adobe Media Encoder CC (Macintosh)"
          stEvt:changed="/"/>
         <rdf:li
          stEvt:action="saved"
          stEvt:instanceID="xmp.iid:4f8bdd82-b23d-47f0-a030-79c78178f88e"
          stEvt:when="2016-01-14T14:19:34-08:00"
          stEvt:softwareAgent="Adobe Adobe Media Encoder CC (Macintosh)"
          stEvt:changed="/metadata"/>
        </rdf:Seq>
       </xmpMM:History>
       <xmpMM:Ingredients>
        <rdf:Bag>
         <rdf:li
          stRef:instanceID="a5bea526-6192-792c-f200-1d630000006a"
          stRef:documentID="0a5d55a5-cbaa-e20b-9f5a-1d3f0000003d"
          stRef:fromPart="time:14222169561600f254016000000d339026688000f254016000000"
          stRef:toPart="time:0d339026688000f254016000000"
          stRef:filePath="00002.MTS"
          stRef:maskMarkers="None"/>
        </rdf:Bag>
       </xmpMM:Ingredients>
       <xmpMM:Pantry>
        <rdf:Bag>
         <rdf:li>
          <rdf:Description
           xmpMM:InstanceID="a5bea526-6192-792c-f200-1d630000006a"
           xmpMM:DocumentID="0a5d55a5-cbaa-e20b-9f5a-1d3f0000003d"
           xmpMM:OriginalDocumentID="xmp.did:e0079809-312a-4e7d-a92d-84f92a113400"
           xmp:MetadataDate="2016-01-14T14:18-08:00"
           xmp:ModifyDate="2016-01-14T14:18-08:00">
          <xmpMM:History>
           <rdf:Seq>
            <rdf:li
             stEvt:action="saved"
             stEvt:instanceID="a5bea526-6192-792c-f200-1d630000006a"
             stEvt:when="2016-01-14T14:18-08:00"
             stEvt:softwareAgent="Adobe Adobe Media Encoder CC (Macintosh)"
             stEvt:changed="/"/>
           </rdf:Seq>
          </xmpMM:History>
          </rdf:Description>
         </rdf:li>
        </rdf:Bag>
       </xmpMM:Pantry>
       <xmpMM:DerivedFrom
        stRef:instanceID="xmp.iid:80538dc7-efe5-4e6d-8702-e2a00e50f759"
        stRef:documentID="xmp.did:80538dc7-efe5-4e6d-8702-e2a00e50f759"
        stRef:originalDocumentID="xmp.did:80538dc7-efe5-4e6d-8702-e2a00e50f759"/>
       <creatorAtom:windowsAtom
        creatorAtom:extension=".prproj"
        creatorAtom:invocationFlags="/L"/>
       <creatorAtom:macAtom
        creatorAtom:applicationCode="1347449455"
        creatorAtom:invocationAppleEvent="1129468018"
        creatorAtom:posixProjectPath="/Volumes/Justine/BAND/Vocabulary Audio Assets/Miwok Vocab Audio.prproj"/>
       <xmpDM:projectRef
        xmpDM:type="movie"/>
       <xmpDM:duration
        xmpDM:value="40"
        xmpDM:scale="1001/30000"/>
       <xmpDM:startTimecode
        xmpDM:timeFormat="2997DropTimecode"
        xmpDM:timeValue="00;00;00;00"/>
       <xmpDM:altTimecode
        xmpDM:timeValue="00;00;00;00"
        xmpDM:timeFormat="2997DropTimecode"/>
      </rdf:Description>
     </rdf:RDF>
    </x:xmpmeta>





















    <?xpacket end="w"?>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ���@  ��A�BCJ���=�HE$c��� ��cp�� �����B��H���肧�5�c$���c��Ps�D&�ƬX�=>���;O N���� �\P�mB����������������������������������������������������������������������������������������������m��w" <*z�ɠ,��
    ��?L�
    �KR�=�v4X�X4-�"�a4��ɲ_wb!*@��C�d�����U�1}I�+��z�������޲Z�imB��B��� Oٴ���
    ��Q܈ �U�&���h4��3d+a-JLd�h1��   `#I`ж8�%���_&�}݈���O�u��b�+O�V|��'�x�r�������;�wz�k���opm�[T"؁?f�J�D���@  �=F�j��Ǩ�c-\����  J���a)-�܎7%D]D�u���ۮP�?3dƚT���@�rOr �Qx�u��{�C��U ÏK`i
    Z W�X�b�I��E�<��`
    �J���[��ֺ+Z(u���dt�t.(4�(R��Kz�96�]��7���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������n7#��ID��Qr]A�C2��8O�� ���� �aP���Ŝ�5�^%s�����w�@0���CV����'��bbQtO$�tR�dV벵��֊}o�_�4��
    -�T�tR���M�W{������������������e�;I"��x����>�   �Dr���Ŕ�QT&�(BU���
    �J�f�j�f�4g�+���j���:�+,) �p�2�l=*��V��^�򚵺�%�+�5zQ5���Z�h�����6���yɷJ�
    ��������,�[#���(XNj�� ��I��G(p�J��YIBh�%P��� �t��h���m�Fz��x��*����b�    g�*��Ҫj{�o)�[�R_��PW�[k������8�ch�n眛t��1q0�n����������@  �AE�Z���(�c\��!�a�j�d5�=-&�Mܢ�l_��Y�����d�E�p�UU�G�0�i�L������Ğ�<9]����?����۩T��p"Y4�>�a)�es�Ly�!�dS��~���~ȓ�{�&%�U�9̲����&4*\p& �
    ���X���`��L�d)���m��1�*2O��J�[�.(��q    J�� �_��    �m�l0�"��zi�M!Q� Z""���0�MD�H1zz�e�3H:ԩHJBD�8����q@��Y$H    8������RaB�����W�:��@�f�+{���dm"J5`��=�6m��Gī�e��!N��l�Ɏ�Q�2~��V�܁qD��JP�?�OR��ϘH�coa���$��M�i
�� �Щ7�đ�h�j'�A��׀�(<��A֥HBR �q�0��3����"@H��-,حn �b�
���v�R�A�]�7�X��X����@  
_��/Kh���e�mA�/�=-��0%����h���}��IE�J�@��h����D �?������    �F16�oQxWF���ȅ�'�U+�Hۢ���g��'[A2�O�I    ��*JYt��pR%�U4���K�p���
P�&:��Hж�v  p�X���]�]�߭�*��!��IJ��RL͢�z���R��}$�(O�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������*���l���L�%L*�); �B6m�%i�  �%r�bm�ޢ�o�G��bO0�V)��EUK:ϯ�N��e��$�$
�T���-&�K�&�hM4�z$�#m�VLu�J��m:���y?P��I�[T1     CR*��E&���Ej�[m�d�I�P�h�fbb?��--��VFsě:�b���褥�ĕ���h��s}2�q�.�BT�ˤZ���"gnT�i����|/�@+&TR��0r���A��z[%�A�J�y��F�bQJKYT�,WV�4mH�#F�3��[��kU��+�(���ǁ���\8Y�A�%�&��rӱ��;A�f��jO���fbb?��--��VFsě:�b���褥�ĕ���h��s}2�q�.�BT�ˤZ���"gnT�i����|/�@+&TR��0r���A��z[%�A�J�y��F�bQJKYT�,WV�4mH�#F�3��[��kU��+�(���ǁ���\8Y�A�%�&��rӱ��;A�f��jO�����@  
    `IkKh�� -a�m�)�1-��0%=�%�2����#i& ;���/�9n���H��V%�N�B�(�\�����L���k~�m^�4'��D�|a�D��3J�@����6؟K�A-�h���AH�R�@b��,�Ӊ
�J��Qc��!4��L�+�0L�
[���Q���
��bN�h���2��fް�a�Z�b�vp�V���A���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������v�md���
�A�a�l���DPZ$LU+�b!v�Q�z�Q�X�Z��5�t��q����"~>0͢BuT���QS�WlO�͠��4SX���N�I�1|�I�ā��%L��(����ai�`�͘&{�-�Zn(�r�Gܱ'B�WsqF�Rs�oX@�0�-L1[�8Z+ROu� �i�TU���٭�F�&CA>5����2��X%��E�(��rO����Ob���.��x��~Tձ-������� A1����"%jDs'��H�:��7$ɐ�tIu��v�
9��F�k�����_[i�R������z�8�-9[�FL��lU6'�1~�f(}f�NF��r*8��DU���٭�F�&CA>5����2��X%��E�(��rO����Ob���.��x��~Tձ-������� A1����"%jDs'��H�:��7$ɐ�tIu��v�
9��F�k�����_[i�R������z�8�-9[�FL��lU6'�1~�f(}f�NF��r*8��D���@  Z^���Kh�K��=)m�}'�%-�V������ [,r��i �f \Al�P&Gc@������4)(!L"-H�$4Ȉ4�\gG3Cs#GٚD���e��7=ETB�K1�aZSwXX�0��ؖ�e�j�V��nq ht���\Q�L�M6�aD��-2�M�uԲ��*Q͏��Jv�Q���P�;a2��t
?�H�l��gj�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������V���"@'��[x��   ���#e��l�>�
JSH�R7�
2"
6W�Q�L����Ŷf�120�~���QU���|XV���3�78�6%�eZ�U���H8��=k$�M��Q ��L��p]u,��ʔsc��R���i�kT6�L������;�+��ڱ'�m��F�e��ҞQ��1W7�,%b��ĜБ 3+@ �(F�E:���CHwA ����`���VIby�!Ȫ�HLN,l�^Wr^�S,�������N6M"e��-"x�P�`��3�j����(_�銆^ܕ�%gQ/=���4�%%�  >�m��4�.N���,�������`)+o�$愉�Z �a@
6�)���zC�ZaW�+J�K͉EU�Bbqce:��l"�e�����$��pɲi(�P�i��b���ͩ�TT�yB�7LT2�䭩+8��y�ƷeY��)-���@  �_��    Ch�K��a(mU�#��͢*�$u���
�drU(
81I+}��}3���z ��� #4L@XT۶(�-�Z�T��U�.�I�E�ה N2�&Q.&֨��V(���"��ֳ䁖i�ci����ڸ�<-��
I#���ƥ汕#�Z����(��2�ɻDj���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������vY�J���RD���D@~iF�:���:4��6�(�b֦U&�e�aDR`�s�u��� �C����8��U�(�A$H���5�� e�qD��n�c;6�2rqH�,G�q�y�eH����i��e��2���n�Q�{>������lm�II8l��X�l�*}����S,�FސY��� �Q�"M��V3�A�\�n���V��b�g;�x0��Fjg_�a�v!�"������x>܎㴯-��d�X^�O-7rI��̂���H�t�Jt�Dq���j����Kcm"JH!�e��ēg    P�����b�f�6��-DL���l����Z
���tv�j���9�3���8�3S8� �
��Q�t'�P\�k���w�yhf��'|"��yi��L�d��f�F����S��#��kW_����@  �^��j���_`�mNE;�m�ȧc��
�xwvf{m��
�IaKJ�<J9�#U.؏*t�M�Z%��p��kk���ڡ0��
�� v��bt8#tH ]:d�   �����c>2��u��egzK|w�    &�cY���D���Y����OTx����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������;�3=��ۅ�ˤ���x�%����lG�:E&�����A8s����G��P�WgH�;W�1:�:$.��YЁ���f1�Q
`���2��%�;��k����G��"PB��,�B��d'�<`������������������������������������������������������������m�]U@�*e�����n]j�Ğ��j�FN�ܦrY��A{ݲ�9Uw�^t3�j��*��l��*f�   
��F���ZRg���|121�l�K&��9�FN�4e�@�0�C�5=��dm�ۮ��h2�h�J[r
�.�KbOY@�j#�dnS9,�� ���I���/:��]�c�H��6KE3G���i#~���)3��r��ܶZ��HМ�
��'V2� \�t�᚞�����@  �ZHc&h��Id�m9�k�� 㱃
q7K$q�( �[Ch��-j-B(:    ܬ�҄�N�eQ���宬�M��_^�.�Z����޴�a���}�V
'H<f��]��OW=H�h�%��j
��Rj����/"zKu��: 

�=����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������d�;�=hm�E�E�E�A;��zP�i�,��2W���՛)�������߫T�Y[֛,3�ݯ���aD���|뻂<���-Ļ;�AV7
C
P�5��OIn��8�D��g���������������������������������������������������������������������������������������������������������ı��uUT('٠�DE]�fz�ny�m7asc�\����Ƌ��jFQ��R�T]�L���Y�M��+�k�U�K!:q�r� P>~"?ߥY��t��lJ�朘>"��Zm�UP��f�%w5�땹�մ݅�1��s�>�;/��a�FcYJ�Qtk)2���g6���iT#�,������%@P����~�dOw���ű*;�r`��h���@  �<�����`b]I|E�F�/�����;I$�(�8�%^�).q���qk*���.Y3ٌ��
��Z��]����β��[z�/M�suޜ!cu�d*R��
ʟ�M
.�c"A�!zK��S�v�ɣ�3�Ҋq0��k����K��� ����r���F~��6��<0�\c�**,\&F�0D��B��C��1�`큓GBgå�`=e\�1Y+Q^�(���@  �F��0g�h�=& L�� @i����~�jTU �!Pp����1@"M,4����mA���c��{fgOO�^�P�Ub?������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ߢZ�@F�T9043LP�C �
%�}�[Pf����ٙ���W��=X�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������I   h2A&O��joo���]ؚ�) @  
H$���a�M��=���^bd���@  �E�  �`h�a�4��  &����(�@ 4�f
S�������

list

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/tan_background"
    android:minHeight="@dimen/list_item_height"
    android:orientation="horizontal">

    <ImageView
        android:id="@+id/image"
        android:layout_width="@dimen/list_item_height"
        android:layout_height="@dimen/list_item_height" />

    <LinearLayout
        android:id="@+id/text_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:paddingLeft="16dp">

        <TextView
            android:id="@+id/miwok_text_view"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:gravity="bottom"
            android:textAppearance="?android:textAppearanceMedium"
            android:textColor="@android:color/white"
            android:textStyle="bold"
            tools:text="lutti" />

        <TextView
            android:id="@+id/default_text_view"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:gravity="top"
            android:textAppearance="?android:textAppearanceMedium"
            android:textColor="@android:color/white"
            tools:text="one" />
    </LinearLayout>
</LinearLayout>

JAva

package com.example.android.miwok;

import android.media.MediaPlayer;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import java.util.ArrayList;

public class NumbersActivity extends AppCompatActivity {

    private MediaPlayer mMediaPlayer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.word_list);

        // Create a list of words
        ArrayList<Word> words = new ArrayList<Word>();
        words.add(new Word("one", "lutti", R.drawable.number_one));
        words.add(new Word("two", "otiiko", R.drawable.number_two));
        words.add(new Word("three", "tolookosu", R.drawable.number_three));
        words.add(new Word("four", "oyyisa", R.drawable.number_four));
        words.add(new Word("five", "massokka", R.drawable.number_five));
        words.add(new Word("six", "temmokka", R.drawable.number_six));
        words.add(new Word("seven", "kenekaku", R.drawable.number_seven));
        words.add(new Word("eight", "kawinta", R.drawable.number_eight));
        words.add(new Word("nine", "wo’e", R.drawable.number_nine));
        words.add(new Word("ten", "na’aacha", R.drawable.number_ten));

        // Create an {@link WordAdapter}, whose data source is a list of {@link Word}s. The
        // adapter knows how to create list items for each item in the list.
        WordAdapter adapter = new WordAdapter(this, words, R.color.category_numbers);

        // Find the {@link ListView} object in the view hierarchy of the {@link Activity}.
        // There should be a {@link ListView} with the view ID called list, which is declared in the
        // word_list.xml layout file.
        ListView listView = (ListView) findViewById(R.id.list);

        // Make the {@link ListView} use the {@link WordAdapter} we created above, so that the
        // {@link ListView} will display list items for each {@link Word} in the list.
        listView.setAdapter(adapter);

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                mMediaPlayer = MediaPlayer.create(NumbersActivity.this, R.raw.number_one);
                mMediaPlayer.start();
            }
        });
    }
}

WordAdapter

package com.example.android.miwok;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;

/**
 * {@link WordAdapter} is an {@link ArrayAdapter} that can provide the layout for each list item
 * based on a data source, which is a list of {@link Word} objects.
 */
public class WordAdapter extends ArrayAdapter<Word> {

    /**
     * Resource ID for the background color for this list of words
     */
    private int mColorResourceId;

    /**
     * Create a new {@link WordAdapter} object.
     *
     * @param context         is the current context (i.e. Activity) that the adapter is being created in.
     * @param words           is the list of {@link Word}s to be displayed.
     * @param colorResourceId is the resource ID for the background color for this list of words
     */
    public WordAdapter(Context context, ArrayList<Word> words, int colorResourceId) {
        super(context, 0, words);
        mColorResourceId = colorResourceId;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // Check if an existing view is being reused, otherwise inflate the view
        View listItemView = convertView;
        if (listItemView == null) {
            listItemView = LayoutInflater.from(getContext()).inflate(
                    R.layout.list_item, parent, false);
        }

        // Get the {@link Word} object located at this position in the list
        Word currentWord = getItem(position);

        // Find the TextView in the list_item.xml layout with the ID miwok_text_view.
        TextView miwokTextView = (TextView) listItemView.findViewById(R.id.miwok_text_view);
        // Get the Miwok translation from the currentWord object and set this text on
        // the Miwok TextView.
        miwokTextView.setText(currentWord.getMiwokTranslation());

        // Find the TextView in the list_item.xml layout with the ID default_text_view.
        TextView defaultTextView = (TextView) listItemView.findViewById(R.id.default_text_view);
        // Get the default translation from the currentWord object and set this text on
        // the default TextView.
        defaultTextView.setText(currentWord.getDefaultTranslation());

        // Find the ImageView in the list_item.xml layout with the ID image.
        ImageView imageView = (ImageView) listItemView.findViewById(R.id.image);
        // Check if an image is provided for this word or not
        if (currentWord.hasImage()) {
            // If an image is available, display the provided image based on the resource ID
            imageView.setImageResource(currentWord.getImageResourceId());
            // Make sure the view is visible
            imageView.setVisibility(View.VISIBLE);
        } else {
            // Otherwise hide the ImageView (set visibility to GONE)
            imageView.setVisibility(View.GONE);
        }

        // Set the theme color for the list item
        View textContainer = listItemView.findViewById(R.id.text_container);
        // Find the color that the resource ID maps to
        int color = ContextCompat.getColor(getContext(), mColorResourceId);
        // Set the background color of the text container View
        textContainer.setBackgroundColor(color);

        // Return the whole list item layout (containing 2 TextViews) so that it can be shown in
        // the ListView.
        return listItemView;
    }
}

Word

package com.example.android.miwok;

/**
 * {@link Word} represents a vocabulary word that the user wants to learn.
 * It contains a default translation, a Miwok translation, and an image for that word.
 */
public class Word {

    /** Default translation for the word */
    private String mDefaultTranslation;

    /** Miwok translation for the word */
    private String mMiwokTranslation;

    /** Image resource ID for the word */
    private int mImageResourceId = NO_IMAGE_PROVIDED;

    /** Constant value that represents no image was provided for this word */
    private static final int NO_IMAGE_PROVIDED = -1;

    /**
     * Create a new Word object.
     *
     * @param defaultTranslation is the word in a language that the user is already familiar with
     *                           (such as English)
     * @param miwokTranslation is the word in the Miwok language
     */
    public Word(String defaultTranslation, String miwokTranslation) {
        mDefaultTranslation = defaultTranslation;
        mMiwokTranslation = miwokTranslation;
    }

    /**
     * Create a new Word object.
     *
     * @param defaultTranslation is the word in a language that the user is already familiar with
     *                           (such as English)
     * @param miwokTranslation is the word in the Miwok language
     * @param imageResourceId is the drawable resource ID for the image associated with the word
     *
     */
    public Word(String defaultTranslation, String miwokTranslation, int imageResourceId) {
        mDefaultTranslation = defaultTranslation;
        mMiwokTranslation = miwokTranslation;
        mImageResourceId = imageResourceId;
    }

    /**
     * Get the default translation of the word.
     */
    public String getDefaultTranslation() {
        return mDefaultTranslation;
    }

    /**
     * Get the Miwok translation of the word.
     */
    public String getMiwokTranslation() {
        return mMiwokTranslation;
    }

    /**
     * Return the image resource ID of the word.
     */
    public int getImageResourceId() {
        return mImageResourceId;
    }

    /**
     * Returns whether or not there is an image for this word.
     */
    public boolean hasImage() {
        return mImageResourceId != NO_IMAGE_PROVIDED;
    }
}

Help appreciated!


回答1:


Make sure the media file is a valid media file and can be played by other media players such as vlc media player. It is recommended that you convert your audio file to mp3 format and use it in the project.



来源:https://stackoverflow.com/questions/46657608/media-file-in-wrong-encoding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!