2017-10-10 16 views
0

J'insère un fichier multimédia pour un didacticiel. J'ai ajouté un dossier brut et copié collé le fichier multimédia dans le dossier brut. Je vois une erreur qui scie "Fichier a été situé dans le mauvais encodage: 'UTF-8" Je peux exécuter l'application en douceur, mais il ne joue jamais mon fichier multimédia. J'ai essayé de recharger l'encodage, mais mon application revient mystérieusement sur l'écran d'accueil de mon téléphone. S'il vous plaît aider. J'ai aussi testé cela sur un projet différent et j'ai réussi à faire fonctionner une chanson. Cependant les autres chansons sont encore dans un mauvais encodage et quand j'essaye de le recharger, le studio android se fige pendant un moment. Si elle aide c'est là où je suis ma musique https://www.bensound.com/ Voici mon code: fichier multimédia (très bizarre)Le fichier multimédia est mal encodé

 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����[email protected]��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�[email protected]�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&[email protected]������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��ĜБ [email protected] �(F�E:���CHwA ����`���VIby�!Ȫ�HLN,l�^Wr^�S,�������N6M"e��-"x�P�`��3�j����(_�銆^ܕ�%gQ/=���4�%%� >�m��4�.N���,�������`)+o�$愉�Z �[email protected] 
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 ��� #[email protected]۶(�-�Z�T��U�.�I�E�ה N2�&Q.&֨��V(���"��ֳ䁖i�ci����ڸ�<-�� 
I#���ƥ汕#�Z����(��2�ɻDj���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������vY�J���RD���[email protected]~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�][email protected]�*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 
�.�[email protected]�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����[email protected]"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������� 

liste

<?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; 
    } 
} 

Mot

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; 
    } 
} 

Aide appréciée!

+0

Dans la partie du code de fichier multimédia, les lettres aléatoires étranges ont été coupées car elles étendent la limite de mot. – BunniesRCool

Répondre

0

Assurez-vous que le fichier multimédia est un fichier multimédia valide et qu'il peut être lu par d'autres lecteurs multimédias tels que le lecteur multimédia vlc. Il est recommandé de convertir votre fichier audio au format mp3 et de l'utiliser dans le projet.

+0

Oui, il s'agit d'un fichier multimédia du tutoriel, donc c'est valide. C'est mp3 (Quand je l'ai téléchargé a été appelé number_one.mp3) – BunniesRCool