Search This Blog

Sunday 19 February 2012

Answer most voted on stack over flow By me

Question 1)     Best phone for android app development  ?

Answer: I write software for Android and iOS for a living; I wouldn't recommend a G1 for developing new Android apps; the last officially released firmware for that phone is Android 1.6, which accounts for less and less of the existing install base. They made a lot of substantial changes to the SDK between 1.6 and 2.x. For new applications, I don't think it's worth targeting anything less than 2.1.
If you're only going to use one phone for development, I would avoid non-official roms at all costs. Rooting is ok (and can help with debugging), but custom roms will totally throw off your ability to develop and debug for the general Android public. You'll want the environment on your sole development phone to be as boring and vanilla as possible.
The majority of new Android phones these days use the HDPI resolution target (~240dpi), as opposed to MDPI (~160dpi), used by the G1 and a few newer lower-end devices (the HTC Aria is the only one I can think of). If I were to pick a singular device to do my development on, I would pick an HDPI device with an officially released 2.1 or greater firmware. The original Droid fits the bill, though the processor is considered on the slow side these days. Given your budget, I would probably try to find a used HTC Droid Incredible on eBay or Craigslist; Verizon has been practically giving them away (or selling them 2-for-1) and people get rid of them quite often due to the lackluster battery life. They're a pretty good baseline for development. HTC also makes it easy turn off the cellular radio (it's actually an option in their standard Welcome funnel).
HTC's Android phones are probably the best from a developer's perspective (they did produce the first 3 ADP models); in my experience, their hardware is the least fussy to deal with and their vendor-specific on-deck apps are the least broken of the major manufacturers.

Question 2)  How to play a sound file from internet when a button is clicked ?

Answer : This simply shows you how to play a sound file from online URL. These  piece of code help people


String url = "http://........"; // your URL here
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(url);
mediaPlayer.prepareAsync();
//You can show progress dialog here untill it prepared to play
mediaPlayer.setOnPreparedListener(new OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            //Now dismis progress dialog, Media palyer will start playing
            mp.start();
        }
    });
    mediaPlayer.setOnErrorListener(new OnErrorListener() {
        @Override
        public boolean onError(MediaPlayer mp, int what, int extra) {
            // dissmiss progress bar here. It will come here when MediaPlayer
            //  is not able to play file. You can show error message to user
            return false;
        }
    });
Question 3) how to set different title for alert dialog when WebView page is loaded?

Answer : Answer was quite simple. Using webViewclient class's onpageStarted() and onpageFinished(), make this easy to work. See answer for more details

No comments:

Post a Comment

Feedback always help in improvement. If you have any query suggestion feel free to comment and Keep visiting my blog to encourage me to blogging

Android News and source code