I am using tabs in my code and in one tab I am using startActivityForResult(). Now startActivityForResult()
is working but onActivityResult()
is not called no matter what I do. Can somebody help me with the problem. I don't know what is the problem actually there is no warning or error. Below is the code
TabActivity:
TabHost.TabSpec spec = tabHost.newTabSpec(LIST2_TAB_TAG);
spec.setIndicator("RingTones");
Intent content = new Intent(this, TestClass.class);
spec.setContent(content);
tabHost.addTab(spec);
TestClass:
public class TestClass extends Activity
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALARM);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select Tone");
/* intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI,
("chosenRingtone" ==null) ? (Uri)null :Uri.parse("chosenRingtone"));*/
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (Uri) null);
this.startActivityForResult(intent, 5);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
switch (requestCode) {
case 1:
{
Uri uri = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
if (uri != null)
{
intent.putExtra("ToneUriI", uri.toString());
}
else
{
// this.chosenRingtone = null;
}
break;
}
default: {
break;
}
}
}
}
I have tried the following solutions but they are of no help.
any help will be appreciated.... :)