android - Activity to listen to Intent ACTION_VIEW -
i want open custom activity in setmovementmethod below.
textview tx = (textview)findviewbyid(r.id.txthelp); tx.settext(html.fromhtml(getstring(r.string.help))); tx.setmovementmethod(linkmovementmethod.getinstance());
i have html defined links when clicked/pressed, want activity open displaying image(depending on clicked link)
i have looked @ thread handle textview link click in android app , tried follow answer used. here activity in manifest defined listen intent action.view.
<activity android:name="com.example.metermanager.imagesactivity" android:screenorientation="portrait"> <intent-filter> <category android:name="android.intent.category.default" /> <action android:name="android.intent.action.view" /> <data android:scheme="com.example.metermanager" /> </intent-filter>
here activity code.
package com.example.metermanager; import android.app.activity; import android.os.bundle; import android.util.log; public class imagesactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.images); string text= getintent().getdatastring(); log.e("link", text); } }
but clicking link causes error below yet activity intent defined.
11-19 03:17:04.827: e/inputeventreceiver(1409): exception dispatching input event. 11-19 03:17:04.827: e/messagequeue-jni(1409): exception in messagequeue callback: handlereceivecallback 11-19 03:17:04.867: e/messagequeue-jni(1409): android.content.activitynotfoundexception: no activity found handle intent { act=android.intent.action.view dat=here (has extras) } 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.app.instrumentation.checkstartactivityresult(instrumentation.java:1632) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.app.instrumentation.execstartactivity(instrumentation.java:1424) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.app.activity.startactivityforresult(activity.java:3424) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.app.activity.startactivityforresult(activity.java:3385) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.app.activity.startactivity(activity.java:3627) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.app.activity.startactivity(activity.java:3595) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.text.style.urlspan.onclick(urlspan.java:62) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.text.method.linkmovementmethod.ontouchevent(linkmovementmethod.java:217) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.widget.textview.ontouchevent(textview.java:7713) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.view.dispatchtouchevent(view.java:7706) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewgroup.dispatchtransformedtouchevent(viewgroup.java:2216) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:1959) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewgroup.dispatchtransformedtouchevent(viewgroup.java:2216) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:1959) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewgroup.dispatchtransformedtouchevent(viewgroup.java:2216) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:1959) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewgroup.dispatchtransformedtouchevent(viewgroup.java:2216) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:1959) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewgroup.dispatchtransformedtouchevent(viewgroup.java:2216) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:1959) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewgroup.dispatchtransformedtouchevent(viewgroup.java:2216) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewgroup.dispatchtouchevent(viewgroup.java:1959) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ com.android.internal.policy.impl.phonewindow$decorview.superdispatchtouchevent(phonewindow.java:2068) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ com.android.internal.policy.impl.phonewindow.superdispatchtouchevent(phonewindow.java:1515) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.app.activity.dispatchtouchevent(activity.java:2458) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ com.android.internal.policy.impl.phonewindow$decorview.dispatchtouchevent(phonewindow.java:2016) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.view.dispatchpointerevent(view.java:7886) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$viewpostimeinputstage.processpointerevent(viewrootimpl.java:3954) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$viewpostimeinputstage.onprocess(viewrootimpl.java:3833) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$inputstage.deliver(viewrootimpl.java:3399) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$inputstage.ondelivertonext(viewrootimpl.java:3449) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$inputstage.forward(viewrootimpl.java:3418) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$asyncinputstage.forward(viewrootimpl.java:3525) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$inputstage.apply(viewrootimpl.java:3426) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$asyncinputstage.apply(viewrootimpl.java:3582) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$inputstage.deliver(viewrootimpl.java:3399) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$inputstage.ondelivertonext(viewrootimpl.java:3449) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$inputstage.forward(viewrootimpl.java:3418) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$inputstage.apply(viewrootimpl.java:3426) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$inputstage.deliver(viewrootimpl.java:3399) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl.deliverinputevent(viewrootimpl.java:5602) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl.doprocessinputevents(viewrootimpl.java:5582) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl.enqueueinputevent(viewrootimpl.java:5553) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.viewrootimpl$windowinputeventreceiver.oninputevent(viewrootimpl.java:5682) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.view.inputeventreceiver.dispatchinputevent(inputeventreceiver.java:185) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.os.messagequeue.nativepollonce(native method) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.os.messagequeue.next(messagequeue.java:138) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.os.looper.loop(looper.java:123) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ android.app.activitythread.main(activitythread.java:5017) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ java.lang.reflect.method.invokenative(native method) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ java.lang.reflect.method.invoke(method.java:515) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) 11-19 03:17:04.867: e/messagequeue-jni(1409): @ dalvik.system.nativestart.main(native method) 11-19 03:17:04.867:
any reasons why not working?
ronald
what url link activity.
your data schema declaration seems wrong.
try
<data android:scheme="content" android:host="com.example.metermanager" />
instead of
<data android:scheme="com.example.metermanager" />
in addition links should not be
<a href="here">
but
<a href="content://com.example.metermanager/some_specific_data">
Comments
Post a Comment