java - How to find whether the app is called by "Share-Via"? -


i have added android app "share-via" window. following code added oncreate() method of code.

        if(getintent().getaction().equals(intent.action_send))         {             string text = getintent().getstringextra(intent.extra_text);             textfield.settext(text);         } 

now issues is, if app activity called share-via, works. if called directly (user opens app -> go activity) crashes nullpointerexception. getting nullpointerexception right in here

if(getintent().getaction().equals(intent.action_send)) 

following how share-via configured in manifest file.

<activity             android:name="com.xx.xx.xx"             android:screenorientation="portrait"             android:label="@string/app_name" >              <intent-filter>                 <action android:name="android.intent.action.send" />                 <category android:name="android.intent.category.default" />                 <data android:mimetype="text/plain"/>             </intent-filter>          </activity> 

what issue here? please help.

either getintent() or getaction() returning null.
need check that.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -