0

I've read the post that everyone links to about link handling clicks with TextViews.

I have a textview with a Movement method set and it seems to be working correctly. When I click on the link it opens a browser and displays the correct information.

My FormatUtils.generateHtml class takes markdown from submission.getContent() and creates usable links as well as formates the text to bold and italics and such.

For some reason I am stumped on how to get that info to load into my own webview.

My manifest for the activity

<activity android:name="com.matteo.example.view.activities.SubmissionDetailActivity">
        <intent-filter>
            <category android:name="android.intent.category.DEFAULT" />
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="com.matteo.example" />
        </intent-filter>
    </activity>

Linked Textview

        CharSequence string = FormatUtils.generateHtml(submission.getContent());
        formattedContent.setText(string);
        formattedContent.setMovementMethod(LinkMovementMethod.getInstance());

in my Activity with the webview. These are my attepts to get the data in the intent. Am I even close here?

 mywebview.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {

            return true;

        }
    });


@Override
public void startActivity(Intent intent) {
    if (TextUtils.equals(intent.getAction(), Intent.ACTION_VIEW)) {

        Bundle extras = getIntent().getExtras();

        intent = getIntent();

        String extra = intent.getStringExtra();
        Uri data = getIntent().getData();
        mywebview.loadUrl(intent.toString());


        Toast.makeText(this, "THIS IS INTENT DATA~~ " + intent.getDataString() , Toast.LENGTH_LONG).show();

So far it seems eveything is null.

How do I get the data from the Intent so I can handle it with my webview?

Community
  • 1
  • 1
Matt French
  • 25
  • 1
  • 7
  • and what is your question actually? – pskink Nov 16 '15 at 17:50
  • @pskink Updated the post. I am trying to get the data from the Intent so I can handle inside with my webview. I am drawing a blank here. – Matt French Nov 16 '15 at 18:19
  • if you dont know what is inside your intent call `Log.d` with `Intent#toUri(int flags)` or `Intent#toString()` – pskink Nov 16 '15 at 18:24
  • @pskink cmp=com.example.matteo.example./com.matteo.example.view.activities.SubmissionDetailActivity (has extras) } – Matt French Nov 16 '15 at 18:31
  • `(has extras)` so display the intent extras – pskink Nov 16 '15 at 18:32
  • @pskink Bundle[mParcelledData.dataSize=3368] This is the result of Log getIntent().getExtras().toString – Matt French Nov 16 '15 at 18:38
  • what about `Bundle#keySet()` ? – pskink Nov 16 '15 at 18:44
  • Log.d(Logger.TAG, extras.keySet().toString()); android.util.MapCollections$KeySet@d58e50e1 – Matt French Nov 16 '15 at 18:54
  • ok so try: `Intent#toUri` – pskink Nov 16 '15 at 19:10
  • @pskink #Intent;component=com.example.matteo.example.website/com.matteo.example.view.activities.SubmissionDetailActivity;S.ACTIVITY_NAME=Home;end This makes me think that it isn't intercepting the correct Intent. I commented out the StartActivity method and it went back to opening and external Web Browser. So I guess I must be in the right place. – Matt French Nov 16 '15 at 19:45

0 Answers0