I too have the same problem.Did you get the solution?If you have plz
let me know.
Thanks in advance.

On Sep 26, 3:15 pm, Adolfo Bulfoni <[email protected]> wrote:
> Hi guys,
> I'm new toAndroiddev. and probably this question might be silly but
> I haven't find a good answer by googling the web. I want to display 
> achronometerand two buttons (Start and Stop) in a LinearLayout view.
> Is it possible to specify a format different from "0:00"? I want to
> have a format similar to "0:00:00.0" (like format available on
> iPhone). Using setFormat does change the format, but I'm suspecting
> it's not the right way to proceed: infact you can insert what string
> you want (even a name...) and the system will display it, but of
> course clicking start or stop won't produce any effect on it.
> I've posted the source code.. can you help me? Thanks!!
>
> main.xml:
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
>    android:orientation="vertical"
>    android:layout_width="fill_parent"
>    android:layout_height="fill_parent"
>     >
>
> <Chronometerandroid:layout_height="wrap_content"android:id="@+id/chronometer"android:text="Chronometer"android:layout_width="fill_parent"android:textSize="32sp"android:gravity="center_horizontal"android:format="0:00:00.000"></Chronometer>
> <Buttonandroid:text="Start"android:id="@+id/startButton"android:layout_width="fill_parent"android:layout_height="wrap_content"></Button>
> <Buttonandroid:text="Stop"android:id="@+id/stopButton"android:layout_width="fill_parent"android:layout_height="wrap_content"></Button>
> </LinearLayout>
>
> class com.example.helloandroid.HelloAndroid.java
>
> package com.example.helloandroid;
>
> importandroid.app.Activity;
> importandroid.os.Bundle;
> importandroid.util.Log;
> importandroid.view.View;
> importandroid.widget.Button;
> importandroid.widget.Chronometer;
>
> public class HelloAndroid extends Activity {
>         private boolean started = false;
>
>    /** Called when the activity is first created. */
>   �...@override
>   public void onCreate(Bundle savedInstanceState) {
>        super.onCreate(savedInstanceState);
>        this.setContentView(R.layout.main);
>        finalChronometerchronometer= (Chronometer) this.findViewById
> (R.id.chronometer);
>
>        Log.d("HelloAndroid", "Value of getFormat() is: "+
> (chronometer.getFormat()));
>
>        final Button startButton = (Button) findViewById
> (R.id.startButton);
>        startButton.setOnClickListener(new View.OnClickListener() {
>            public void onClick(View v) {
>                    if(!started){
>                            Log.d("HelloAndroid", "start button clicked");
>                            started = true;
>
>                            chronometer.start();
>                    }
>            }
>        });
>
>        final Button stopButton = (Button) findViewById
> (R.id.stopButton);
>        stopButton.setOnClickListener(new View.OnClickListener() {
>            public void onClick(View v) {
>                    if(started){
>                            Log.d("HelloAndroid", "stop button clicked");
>                            started = false;
>                            chronometer.stop();
>                    }
>            }
>        });
>    }
>
>
>
> }

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to