Monday 28 September 2015

Useful Online Links For Android Development :- )


What is Android Color Generator?

It is a free online tool which helps you to create colors.xml. A color name and value are defined in colors.xml which will be used in Android applications to apply colors to Views.
With the help of this tool, you can generate colors.xml with upto 50 colors at a time.

Online Link   :    Click here

==========================================================



What is Android Layout Finder ?

The Android Layout Finder helps you create the code that ties your Android UI and Java code together.
It's real easy! Just paste your Android XML layout code in the first text field, pick the views that you need, and your code is automatically generated for you.

Online Link   :     Click here

==========================================================

Sunday 13 September 2015

Custom Toast Alert :-)



In this example creating a custom toast alert.
android.widget.Toast class used to create toast alert message.
Toast alert is a notification message that display for certain amount of time, and automatically fades out after set time. 

Use
To show alert message to user.
To debugging your application.
To show alert from background service,broadcast,receiver,getting data from server...etc.






To access toast_border.xml - Click here Toast_Border
To access toast_border.xml - Click here Toast
 Function to call the customeToast from activity class- Calltoast();


public void Calltoast(){
Context context = getApplicationContext();
        // Create layout inflator object to inflate toast.xml file
        LayoutInflater inflater = getLayoutInflater();           
        // Call toast.xml file for toast layout 
        View toastRoot = inflater.inflate(R.layout.toast, null);       
        Toast toast = new Toast(context);      
        // Set layout to toast 
        toast.setView(toastRoot);
        toast.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL,
                0, 0);
        toast.setDuration(Toast.LENGTH_LONG);
        toast.show();
}







Sunday 6 September 2015

Speech to Test Conversion


What is Speech Recognition?


Speech Recognition is a technology that allows the Mobile device to identify and understand words spoken by a person using a microphone. The ultimate goal of the technology is to be able to produce a system that can recognize with 100% accuracy all words that are spoken by any person.

Even after years of research in this area, the best speech recognition software applications still cannot recognize speech with 100% accuracy. Some applications are able to recognize over 90% of words when spoken under specific constraints regarding content and previous training to recognize the speaker's speech characteristics.

Android API , that understands your speech enables you to have conversations with Mobile device. These conversations would include you and the device speaking as commands or in response to events, input, or other feedback.

Speaking is easier and more intuitive than selecting buttons in keyboards. Human speech has evolved over many thousands of years to become an efficient method of sharing information and giving instructions.





GUI Components - 

Image Button ( call promptSpeechInput())
Text view Button ( To show the result) 


// Showing google speech input dialog (This function should call from Image button click event)
     
    private void promptSpeechInput() {
        Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
        RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
        intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
        getString("Say something"+…));
        try {
           startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
        }  
            catch (ActivityNotFoundException a) {
            Toast.makeText(getApplicationContext(),
            getString("Sorry! Your device doesn\'t support speech input"),
            Toast.LENGTH_SHORT).show();
        }
    }


  // Receiving speech input     

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch (requestCode) {
        case REQ_CODE_SPEECH_INPUT: 
           {
          if (resultCode == RESULT_OK && null != data) {
         ArrayList<String> result = 
         data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
         txtSpeechInput.setText(result.get(0));
            }
            break;
        }
        }
    }


How to do text writing animation?  In Android Development we do not have the option to use any other custom font in our default Tex...