Hi,
I got Source not Found error if I've complied the following code.
My Data.java
=============
*
package* com.aspire.android.dataprovider;
*
import* java.util.ArrayList;
*
import* java.util.HashMap;
*
import* java.util.Map;
*
import* android.app.ListActivity;
*
import* android.content.ContentUris;
*
import* android.content.Intent;
*
import* android.database.Cursor;
*
import* android.net.Uri;
*
import* android.os.Bundle;
*
import* android.util.Log;
*
import* android.view.View;
*
import* android.widget.ListView;
*
import* android.widget.SimpleAdapter;
*
import* android.provider.Contacts.People;
*
public* *class* Data *extends* ListActivity {
*public* *static* *final* String *AUTHORITY*=
"com.aspire.android.provider.dataprovider";
// public static final Uri
CONTENT_URI=Uri.parse("content://"+AUTHORITY+"/station");
// public static final Uri uri = People.CONTENT_URI;
Uri uri = ContentUris.*withAppendedId*(People.*CONTENT_URI*, 1);
//private static final String [] PROJECTION=new String []{"s_id","s_name"};
*private* *static* *final* String [] *PROJECTION*=*new* String []{ People.*
_ID*,
People.*NAME*,People.*NUMBER
*
};
@Override
*protected* *void* onCreate(Bundle savedInstanceState) {
*super*.onCreate(savedInstanceState);
//Return the intent that started this activity.
Intent intent=getIntent();
*if*(intent.getData()==*null*)
intent.setData(uri);
Log.*i*("Uri for Data Provider Appl : ",uri.toString()+intent.setData(uri));
//Cursor
cur=getContentResolver().query(getIntent().getData(),PROJECTION,null,null,null);
Cursor cur = managedQuery(uri,*PROJECTION*, *null*,*null*, *null*); (Error
occured in this line)
/* ArrayList<Map<String,Object>> coll =new ArrayList<Map<String,Object>>();
Map<String,Object>item;
cur.moveToFirst();
while(!cur.isAfterLast()){
item=new HashMap<String, Object>();
item.put("c1",cur.getLong(0)+","+cur.getString(1));
coll.add(item);
cur.moveToNext();
}
this.setListAdapter(new
SimpleAdapter(this,coll,android.R.layout.simple_list_item_1,new
String[]{"c1"},new int[]{
android.R.id.text1}));*/
*if* (cur.moveToFirst()) {
String name;
String phoneNumber;
*int* nameColumn = cur.getColumnIndex(People.*NAME*);
*int* phoneColumn = cur.getColumnIndex(People.*NUMBER*);
String imagePath;
*do* {
// Get the field values
name = cur.getString(nameColumn);
phoneNumber = cur.getString(phoneColumn);
Log.*i*("Name : ", name);
Log.*i*("Number : ", phoneNumber);
} *while* (cur.moveToNext());
}
}
@Override
*protected* *void* onListItemClick(ListView l, View v, *int* position, *long
* id) {
// *TODO* Auto-generated method stub
// super.onListItemClick(l, v, position, id);
finish();
}
}
Can you please any one help me ....
Thanks for your time....
Thanks Again!!
Yasmin
--
Everything is Possible For U only
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---