Sunday 3 March 2013

Audio Streaming In Android





public class ListenAudio extends Activity {
   

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        Intent in = getIntent();
        String path = in.getStringExtra("Path");
      
        MediaPlayer mediaPlayer = new MediaPlayer();
        mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
        try {
            mediaPlayer.setDataSource(path);
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalStateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        try {
            mediaPlayer.prepare();
        } catch (IllegalStateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } // might take long! (for buffering, etc)
        mediaPlayer.start();
      
            }
}

How to change textcolor of tab text in Android


How to change textcolor of tab text in Android

TabHost tabs = (TabHost)findViewById(R.id.TabHost01);
        tabs.setup(getLocalActivityManager());
      
      
        TabHost.TabSpec search = tabs.newTabSpec("tag1");
        search.setContent(new Intent(this,Searchgurbani.class));
        search.setIndicator("Find Me");
        tabs.addTab(search);
      
        TabHost.TabSpec pref = tabs.newTabSpec("tag5");
        pref.setContent(new Intent(this,Preferencegurbani.class));
        pref.setIndicator("Settings");
        tabs.addTab(pref);
      
        TabHost.TabSpec favorite = tabs.newTabSpec("tag6");
        favorite.setContent(new Intent(this,Favroite.class));
        favorite.setIndicator("BookMark");
        tabs.addTab(favorite);
      
        for(int i=0;i<tabs.getTabWidget().getChildCount();i++)
        {
            TextView tv = (TextView) tabs.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
            tv.setTextColor(Color.parseColor("#ffffff"));
        }

Saturday 2 March 2013

how to get shai finger print for google map api v2


Step 1
open command promp
step 2
navigate to folder where java is installed
step  3
then navigate  go to jdk folder bin form there type the below command
The path in inverted comma below is the path of android debug key stroke which can be found in C drive under particular user folder just replace the path
step 4 type the command

keytool.exe -v -list  -keystore "C:\Users\NewPC\.android\debug.keystore" -storepass android -keypass android



output will be like this




Keystore type: JKS
Keystore provider: SUN

Your keystore contains 1 entry

Alias name: androiddebugkey
Creation date: 7 Feb, 2013
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 511358c0
Valid from: Thu Feb 07 13:03:20 IST 2013 until: Sat Jan 31 13:03:20 IST 2043
Certificate fingerprints:
         MD5:  0E:CE:35:CE:CB:66:CC:80:95:68:85:EB:B4:8A:9F:4F
         SHA1: B9:BC:1A:87:5A:9E:29:8A:DE:BD:41:19:63:A1:FD:60:04:EA:83:4A
         Signature algorithm name: SHA1withRSA
         Version: 3


*******************************************
*******************************************


you will ge thet dtail output of all keys including shai finger print then follow the steps in google api website