如何使用片段播放来自字符串数组的声音(android)

时间:2014-02-11 04:42:23

标签: android eclipse android-fragmentactivity android-button android-listfragment

如果有人能帮我解决这个小小的打嗝,我会感激不尽。提前谢谢。

我有一个由片段和活动组成的app结构......

主要片段称为“标题” - 这会向用户显示可点击列表中的单词列表。

其详细视图页面称为“文章”,包含单词列表的数据的活动称为“问候语”。

相当多 - 在文章活动中; 我有:一个单词列表,单词的翻译形式,同义词等,它们都是使用字符串数组存储的。

选择一个单词后,它会启动“详情活动页面”,显示有关所选单词的更多信息。

我希望能够输入一个声音按钮,让用户在按下时听到翻译后的单词。

注意: 我已经将图像按钮放在xml文件中以进行最终输出,因此只要用户选择单词,就可以查看它。我只需要将按钮编程为现在正常运行。

以下代码是我存储的单词列表:                 package com.example.sample;

            public class GreetingsWords {
            static String[] Headlines = {
            "Hello",
            "Goodbye",
            "Good Morning",
            "Good Night",
            };
             static String[] Articles = {
            //word 1
            "'Hello'    \n\n\n " +
            "Translation:   Yow! \n\n" +

            "Pronouncation:  [Yoh'ow] \n\n" +
            "Synonyms:  Greetings!, Hello!, Hi, Hey \n\n",

             //word 2       
            "'GoodBye'  \n\n\n " +
            "Translation:   Lata \n\n" +
            "Pronouncation: [lay'ta] \n\n\n" +  

            "Synonym:   Likkle More. \n\n" +
            "Pronouncation: [lickle- mor']",

            //word 3
            "'Good Morning' \n\n\n " +
            "Translation:   Mawnin \n\n" +
            "Pronouncation: [Maw-ning] ",       

            //word 4
            "'Good Night' \n\n\n " +
            "Translation:   Nighty Nights \n\n",      
            };
            }

0 个答案:

没有答案