Friday 19 October 2012

Wheel View demo in android

make wheel view like iphone in android

i want to use wheel view like iphone  in android hear is the demo code for that and screenshot for getting idea how its look like.

Download Source Code


Tuesday 16 October 2012

Custom Toast in Android Example

Make Custom Toast in android using another layout xml

android has "Toast" for display message to user like popup window its display some of time and automatically disappear, that popup display only text on that but user want to display image text and any other thing follow this step:-

  1. make layout of that which you want to display
  2. inflate that layout using "LayoutInflater"
  3. set that layout as a ToastView using setView method 


Button btn = (Button) findViewById(R.id.button1);
              btn.setOnClickListener(new OnClickListener() {
                     @Override
                     public void onClick(View v) {
                           LayoutInflater inflater = getLayoutInflater();
                           View layout = inflater.inflate(R.layout.toast,
                                         (ViewGroup) findViewById(R.id.toast_layout_root));
                           ImageView image = (ImageView) layout.findViewById(R.id.image);
                           image.setImageResource(R.drawable.ic_launcher);
                           TextView text = (TextView) layout.findViewById(R.id.text);
                           text.setText("custom toast Demo!");
                           Toast toast = new Toast(getApplicationContext());

                           // set postion of toast where you want to display
                           toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);

                           // Visible time
                           toast.setDuration(Toast.LENGTH_LONG);
                           toast.setView(layout);
                           toast.show();
                     }
              });





Download Source Code


Call web services easily

get source code from here, Download