BroadcastExample.java
----------------------------------
package com.example.broadcast;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.telephony.*;
import android.util.Log;
import android.widget.TextView;

public class BroadcastExaple extends Activity {
    TextView textOut;
    TelephonyManager telephonyManager;
    PhoneStateListener listener;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {

        try {

            super.onCreate(savedInstanceState);

            // Get the UI
            textOut = new TextView(this);
            textOut.setText("DEmoBroadCast");
            setContentView(textOut);

            // Get the telephony manager
            telephonyManager = (TelephonyManager)
getSystemService(Context.TELEPHONY_SERVICE);

            // Register the listener wit the telephony manager

telephonyManager.listen(listener,PhoneStateListener.LISTEN_CALL_STATE);

            // Create a new PhoneStateListener
            listener = new PhoneStateListener() {

                @Override
                public void onCallStateChanged(int state, String
incomingNumber) {
                    Log.d("DEBUG", "Phone listener....");
                    String stateString = "N/A";
                    switch (state) {
                    case TelephonyManager.CALL_STATE_IDLE:
                        stateString = "Idle";
                        break;
                    case TelephonyManager.CALL_STATE_OFFHOOK:
                        stateString = "Off Hook";
                        break;
                    case TelephonyManager.CALL_STATE_RINGING:
                        stateString = "Ringing";
                        break;
                    }
                    textOut.append(String.format("\nonCallStateChanged: %s",
                            stateString));
                }
            };

        } catch (Exception e) {

        }

    }
}

AndroidManifest.xml
-------------------------------
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
    package="com.example.broadcast" android:versionCode="1"
    android:versionName="1.0">
    <application android:icon="@drawable/icon"
android:label="@string/app_name">
        <activity android:name=".BroadcastExaple"
android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-prmission android:name="android.permission.READ_PHONE_STATE" />
    <uses-sdk android:minSdkVersion="7" />
</manifest>




Anybody can indicate me why this code doesn't work......

Thanks............

On Tue, Dec 7, 2010 at 7:35 PM, Kostya Vasilyev <kmans...@gmail.com> wrote:

> Danny,
>
> The values in R can change as you add and remove resources.
>
> I'd say store color names, or actual RGB values (and match them to names
> when need to present to the user).
>
> -- Kostya
>
> 07.12.2010 16:56, Danny Schimke пишет:
>
>  Hi,
>>
>> I have 2 textual inputs that I saved to database, furthermore I have a
>> spinner with color selection. Color names and color values both stored in
>> the application resources. I want to save a color in the database, but what
>> is the best way to do this in your mind? Should I save the resource id? I
>> figured out, that the int value of the color resource is allways the same,
>> e.g. when I delete the "R" file and let it recreate. I do not have the
>> certainty that this is correct?!
>>
>> Or would you put colors in a seperate database table instead using
>> resources for this? This seems to be a good way and the user is able to add
>> own colors to the application.
>>
>> I don't know what is the best way to store this. What are your
>> experiences?
>>
>> Thank you very much!
>> -Danny Schimke
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget --
> http://kmansoft.wordpress.com
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to