Search code examples
android-studioaudiovideoandroid-mediaplayerconverters

can we convert Audio (.mp3) to video (mp4) in android studio? how?


i am new in this and i am working on App of media player and recording app. in which i have shown song list of device in the listview and recording start / stop / play. Now i want to convert that .mp3 recorded file into .mp4 and one image will show on behalf of a video in that file. Help me to achive this i have no idea and i refer many links and i didnt find anything.


Solution

  • Please check this link for your first question:
    Why can't we initialize class members at their declaration?

    Usually constructor is use to initialize value to data variables of class.

    For 2nd Question: If data member is not initialize after creation of object, It will contain garbage value. So initialize or assign suitable value to as per your need.

    Check below code:

    #include<iostream>
    using namespace std;
    
    class swap_values
     {   
        int a, b, temp;
        public:
            swap_values(){
                a=0;b=0;temp=0;
            }
            swap_values(int x, int y){
                  a = x;
                  b = y;
                  temp = 0;
               }
    
            void swapped()       
            {
                temp = b;
                b=a;
                a=temp;
            }
            void print(){
             cout<<"a: "<<a<<" b: "<<b<<endl;
             }
     };
    
    int main()
    {  
       int x =10; int y = 20;
       swap_values obj(x, y);
       obj.print();
       obj.swapped();
       obj.print();
    
       return 0;
    }