Hi friends,
I am trying to activate an activity from another activity using implicit intent.
Code fragment of mail activity:
Androidmainfest.xml
Activity NotificationActivity is in proper place. But on clicking addButton I am getting following exception:
Can anyone please help me in finding the issue??
I am trying to activate an activity from another activity using implicit intent.
Code fragment of mail activity:
Code:
public void onClick(View view) {
intent = new Intent(Intent.ACTION_SEND);
int id = view.getId();
switch (id) {
case R.id.addButton: {
date = reminderDate.getDayOfMonth();
month = reminderDate.getMonth();
year = reminderDate.getYear();
hour = reminderTime.getCurrentHour();
minute = reminderTime.getCurrentMinute();
Log.d(TAG, String.format("%s, Date: %s/%s/%s, Time: %s:%s",
reminderText.getText().toString(), date, month, year, hour,
minute));
intent.setType("plain/text");
intent.putExtra("reminderText", reminderText.getText().toString());
startActivity(intent);
break;
}
case R.id.cancelButton: {
Log.d(TAG, "Reminder Cancelled");
Toast.makeText(this, "Reminder Cancelled", Toast.LENGTH_LONG)
.show();
break;
}
}
}
Androidmainfest.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.reminder"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".QReminderActivity"
android:label="@string/app_name" >
</activity>
<activity android:name=".TimerActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".NotificationActivity" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="plain/text"/>
</intent-filter>
</activity>
</application>
</manifest>
Activity NotificationActivity is in proper place. But on clicking addButton I am getting following exception:
E/AndroidRuntime( 464): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SEND typ=plain/text (has extras) }
E/AndroidRuntime( 464): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
E/AndroidRuntime( 464): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
E/AndroidRuntime( 464): at android.app.Activity.startActivityForResult(Activity.java:2827)
E/AndroidRuntime( 464): at android.app.Activity.startActivity(Activity.java:2933)
E/AndroidRuntime( 464): at com.reminder.TimerActivity.onClick(TimerActivity.java:60)
E/AndroidRuntime( 464): at android.view.View.performClick(View.java:2485)
E/AndroidRuntime( 464): at android.view.View$PerformClick.run(View.java:9080)
E/AndroidRuntime( 464): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 464): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 464): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 464): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 464): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 464): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 464): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 464): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 464): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 60): Force finishing activity com.reminder/.TimerActivity
Can anyone please help me in finding the issue??