Iam trying a simple intent where u click the button and it Open's the Contact Book....
I wrote down the java code and i did'nt hav any error with the project in eclipse...
But when i run it in the emulator , the app is force closing..
This is the java code :
Using java Syntax Highlighting
- package com.friend.finder;
- import android.app.Activity;
- import android.content.Intent;
- import android.os.Bundle;
- import android.view.View;
- import android.view.View.OnClickListener;
- import android.widget.Button;
- public class Friend extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- Button widget39 = (Button)findViewById(R.id.widget39);
- widget39.setOnClickListener(new Button.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent myIntent = new Intent();
- myIntent.setAction(Intent.ACTION_VIEW);
- myIntent.setData(android.provider.Contacts.People.CONTENT_URI);
- startActivity(myIntent);
- }
- });
- }
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
This is the XML code..
Using xml Syntax Highlighting
- <?xml version="1.0" encoding="utf-8"?>
- <AbsoluteLayout
- android:id="@+id/widget38"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- xmlns:android="http://schemas.android.com/apk/res/android"
- >
- <TextView
- android:id="@+id/widget37"
- android:layout_width="125px"
- android:layout_height="22px"
- android:text="Selected Contact :"
- android:layout_x="9px"
- android:layout_y="72px"
- >
- </TextView>
- <TextView
- android:id="@+id/widget39"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="No contact Selected yet ."
- android:layout_x="131px"
- android:layout_y="72px"
- >
- </TextView>
- <Button
- android:id="@+id/widget40"
- android:layout_width="146px"
- android:layout_height="48px"
- android:text="Pick Contact"
- android:layout_x="12px"
- android:layout_y="15px"
- >
- </Button>
- </AbsoluteLayout>
Parsed in 0.004 seconds, using GeSHi 1.0.8.4
And the Manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.friend.finder"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
<activity android:name=".Friend"
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-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.READ_CONTACTS"></uses-permission>
</manifest>
The Emulator is Android OS 2.3
If there is any way to fix this ???
Please Help...


