Android - Linkify Problem

后端 未结 1 1922
清酒与你
清酒与你 2021-01-12 23:52

I seem to be having trouble with the linkify I am using in my Custom Adapter. For some reason I recieve the following stack track when I click on one of the links:

相关标签:
1条回答
  • 2021-01-13 00:08

    Turns out the answer to this is a lot simpler than I had originally thought. The problem was that when I was passing the context to my custom adapter I was passing the getApplicationContext() which is not the same as using the this identifier.

    INCORRECT WAY:

    Context mContext = getApplicationContext();
    CustomAdapter mAdapter = new CustomAdapter( 
                    mContext,
                    itemList); 
    

    CORRECT WAY:

    CustomAdapter mAdapter = new CustomAdapter( 
                    this,
                    itemList); 
    
    0 讨论(0)
提交回复
热议问题