Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am surprised that gnclmorais solution should work. Because it having multiple <code>data</code> entries in one <code>intent-filter</code> did not work for me. What did work in the end was multiple <code>intent-filter</code> in one <code>activity</code>:</p> <pre><code>&lt;activity android:description='@string/Activity_Description' android:icon='@drawable/ic_launcher' android:label='@string/Activity_Name' android:name='net.sourceforge.uiq3.fx603p.Calculator_Activity' &gt; &lt;intent-filter&gt; &lt;action android:name='android.intent.action.MAIN' &gt;&lt;/action&gt; &lt;category android:name='android.intent.category.LAUNCHER' &gt;&lt;/category&gt; &lt;/intent-filter&gt; &lt;intent-filter android:icon='@drawable/ic_fx_603p_pf' android:label='FX-603P Simulator Program' android:priority='1' &gt; &lt;category android:name='android.intent.category.DEFAULT' &gt;&lt;/category&gt; &lt;action android:name='android.intent.action.VIEW' &gt;&lt;/action&gt; &lt;data android:host='*' android:pathPattern='.*\\.pf' android:scheme='file' &gt;&lt;/data&gt; &lt;/intent-filter&gt; &lt;intent-filter android:icon='@drawable/ic_fx_603p_df' android:label='FX-603P Simulator Datafile' android:priority='1' &gt; &lt;category android:name='android.intent.category.DEFAULT' &gt;&lt;/category&gt; &lt;action android:name='android.intent.action.VIEW' &gt;&lt;/action&gt; &lt;data android:host='*' android:pathPattern='.*\\.df' android:scheme='file' &gt;&lt;/data&gt; &lt;/intent-filter&gt; &lt;intent-filter android:icon='@drawable/ic_fx_603p_af' android:label='FX-603P Simulator Allfile (Data and Program)' android:priority='1' &gt; &lt;category android:name='android.intent.category.DEFAULT' &gt;&lt;/category&gt; &lt;action android:name='android.intent.action.VIEW' &gt;&lt;/action&gt; &lt;data android:host='*' android:pathPattern='.*\\.af' android:scheme='file' &gt;&lt;/data&gt; &lt;/intent-filter&gt; &lt;intent-filter android:icon='@drawable/ic_fx_603p_pf' android:label='FX-603P Simulator Program' android:priority='1' &gt; &lt;category android:name='android.intent.category.DEFAULT' &gt;&lt;/category&gt; &lt;action android:name='android.intent.action.VIEW' &gt;&lt;/action&gt; &lt;data android:host='*' android:mimeType='application/x-fx-602p.program' &gt;&lt;/data&gt; &lt;/intent-filter&gt; &lt;intent-filter android:icon='@drawable/ic_fx_603p_df' android:label='FX-603P Simulator Datafile' android:priority='1' &gt; &lt;category android:name='android.intent.category.DEFAULT' &gt;&lt;/category&gt; &lt;action android:name='android.intent.action.VIEW' &gt;&lt;/action&gt; &lt;data android:host='*' android:mimeType='application/x-fx-602p.data' &gt;&lt;/data&gt; &lt;/intent-filter&gt; &lt;intent-filter android:icon='@drawable/ic_fx_603p_af' android:label='FX-603P Simulator Allfile (Data and Program)' android:priority='1' &gt; &lt;category android:name='android.intent.category.DEFAULT' &gt;&lt;/category&gt; &lt;action android:name='android.intent.action.VIEW' &gt;&lt;/action&gt; &lt;data android:host='*' android:mimeType='application/x-fx-602p.all' &gt;&lt;/data&gt; &lt;/intent-filter&gt; &lt;/activity&gt; </code></pre> <p>Note that having both <code>pathPattern</code> and <code>mimeType</code> in one <code>data</code> entry did not work as well. Last not least I would suggest a few null checks when getting the file name:</p> <pre><code> /** * &lt;p&gt;Open calculator and load file (if one was passed).&lt;/p&gt; * @see android.app.Activity#onStart() */ @Override public void onStart () { android.util.Log.d (Calculator_Activity.TAG, "+ onStart"); super.onStart (); final android.content.Intent intent = getIntent (); if (intent != null) { android.util.Log.d (Calculator_Activity.TAG, "&gt; Got intent : " + intent); final android.net.Uri data = intent.getData (); if (data != null) { android.util.Log.d (Calculator_Activity.TAG, "&gt; Got data : " + data); final String filePath = data.getEncodedPath (); android.util.Log.d (Calculator_Activity.TAG, "&gt; Open file : " + filePath); // file loading comes here. } // if } // if android.util.Log.d (Calculator_Activity.TAG, "- onStart"); return; } // onStart </code></pre> <p>The actual loading of the file is missing from the sample. It should be inserted after the “Open file” log command.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload