Hi,
Would anyone know if I'm doing something wrong?
I'm trying to call my library's activity (similar to listactivity) from a
fragment in the main project, and return to the main project upon selecting
an item from the library's activity.
All the code runs normally up to selecting the item in the library's
activity. onItemSelected runs, but the onActivityResult(int requestCode,
int resultCode, Intent data) from the main project doens't get called, and
the main project seems to have disappeared once the library's activity
finished.
Here is the simplified code:
>From main project (android.support.v4.app.Fragment)
public void onClick(View v) {
switch(v.getId()) {
case R.id.btnFind:
startActivityForResult(newIntent,
com.kitten.library.intent.kittenlabs_db_request_code);
break;
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent
data) {
super.onActivityResult(requestCode, resultCode, data);
/* code to handle result
*/
}
>From library (android.app.Activity)
public void onItemClick(AdapterView<?> parent, View v, int position,
long id) {
//move cursor to selected item
c.moveToPosition(position);
//get row id
int rowID = c.getInt(c.getColumnIndex("_id"));
//construct result uri
Uri outURI = ContentUris.withAppendedId(this.db_uri, rowID);
Intent outData = new Intent();
outData.setData(outURI);
setResult(Activity.RESULT_OK, outData);
finish();
}
I've tried to put onActivityResult in the FragmentActivity class as well,
but it does not get called either. Once "finish();" is called from the
library activity, the main project is not visible (I see the Android home).
Thank you very much in advance,
Amy
--
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