Android studio - Complete operation with "app" (Open .txt file with the app) - android-studio

the thing I want to do is to share a txt file through whatsapp and open it with my app, converting datas written in it, to be able to use them in the application.
I've read something about the "BroadcastReceiver", but what I found didn't work as well.
I attach a pic to let you understand better,
thank you for help!
picture

I resolved, in manifest, inside the activity:
<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>

Related

Getting UID of NDEF tag when scanning NFC tag with AAR Android Studio

The problem i'm having is i'm trying to open an app when I scan the NFC card, and pass in data to the app immediately. All I need passed in is the ID of the card. I already have this working, kind of. In NFC Tools I add an AAR (Add Application Record) and add the package name, and this opens the app. In my code in android studio I have the following intent
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
And in my main activity I have
override fun onResume() {
super.onResume()
UIDLabel.setText(intent.action.toString())
if (NfcAdapter.ACTION_NDEF_DISCOVERED == intent.action) {
val tag = intent.getParcelableExtra<Tag>(NfcAdapter.EXTRA_TAG)
UIDLabel.setText((ByteUtils.bytesToHex(tag!!.id)))
}
}
This does return my UID of the Tag but I also need to have a Text record added to the card for it to work (Obviously because the intent-filter is looking for "text/plain". What i'm trying to do is achieve the same results just without the Text having to be added to the card. I've experimented with different intent-filters and nothing works. Does anyone know what intent-filter I should use in this situation? Thanks

How to animate default splash screen in nativescript angular

I was wondering how to animate the default splash screen which comes with nativescript, possibly the logo?
Is there a way of adding some css animation to the splash_screen.xml file found in the drawable folder? Thanks
You can use nativescript-splashscreen plugin to add animation in your splash screen. You need to update your AndroidManifest.xml e.g.
<activity
android:name="com.tns.NativeScriptActivity"
android:label="#string/title_activity_kimera"
android:configChanges="keyboardHidden|orientation|screenSize">
</activity>
<activity
android:name="co.fitcom.SplashScreen" android:noHistory="true">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>

I want gradle to build only single class instead of the whole project

In Android Studio project I have a separate class where I experiment with java code. The class has method public static void main(String[] args){}
Right click on this class in project tree -> Run (Ctrl+Shift+F10)
And I noticed that gradle starts building the whole project. And it takes certain time but I want it to build and run only this one class. So it is as fast as possible.
How can I achieve this?
You can try modifying your AndroidManifest file to run only the class you want as a main-launcher class:
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#drawable/my_icon"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="android:icon,android:theme">
<activity
android:name=".RUN_YOUR_ACTIVITY"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

How do you get the hardware back button on VideoCastControllerActivity to work?

Once my app starts playing and VideoCastControllerActivity shows up, the hardware back button won't take it back to my activity. The actionbar back button works just fine. I don't see any errors on the logs or anything and looking at the VideoCastControllerActivity I didn't see anything obvious trying to capture the back button behaviour or anything. To start it I am calling startCastControllerActivity.
Here is the chunk of my manifest declaring it:
<activity
android:name="com.google.sample.castcompanionlibrary.cast.player.VideoCastControllerActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:parentActivityName="com.mypackage.myactivity"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.mypackage.myactivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
Thanks.
The CastCompanionLibrary doesn't try to capture the back button at all, so it should work just fine. Please try the CastVideos-andrid (which uses that library) to confirm that.

Can I export FusionCharts data to a CSV file, saved as text/csv (or other graceful solution)?

Right now, FusionCharts 3.1 Flash charts provide a context menu that, if you configure it appropriately, will allow the user to save the data as a JPG / PNG / PDF file. The same menu also allows CSV data to be copied to clipboard.
Excel 2010 does not handle pasted CSV as one might wish here: it pastes into one line per cell without separating on commas. You can, with a song and dance, have the CSV interpreted: click on Data, then Text to Columns, then Delimited and Next, then uncheck Tab and check Comma as separator, and then Finish (English translation: "Please call our help desk!"). This is really a few steps too many for usability concerns.
One could imagine a slightly shorter song and dance (perhaps open up Notepad, paste, and save with a .csv extension), but I would ideally like people to run on a mental model of "I save the data, open it with Excel, and see the data naturally."
Is there a way to let FusionCharts export CSV as text/csv so there is no song and dance required of the end user beyond "Save the data and open it in Excel"?
Could you please try once setting exportDataSeparator='{tab}' in <chart> and try again? My Excel in mac seems to respond well using this.
I have used this XML and right clicked on chart to copy data to clip-board and pasted in excel:
<chart exportDataSeparator='{tab}' showExportDataMenuItem='1'caption='Weekly Sales Summary' xAxisName='Week' yAxisName='Sales' numberPrefix='$' >
<categories>
<category label='Dec'/>
<category label='Jan'/>
<category label='Feb'/>
<category label='Mar'/>
<category label='Apr'/>
<category label='May'/>
</categories>
<dataset seriesName='current'>
<set value='123123' />
<set value='123123' />
<set value='123123' />
<set value='123123' />
<set value='123123' />
<set value='123123' />
</dataset>
<dataset seriesName='2010'>
<set value='123123' />
<set value='123123' />
<set value='123123' />
<set value='123123' />
<set value='123123' />
<set value='123123' />
</dataset>
</chart>
My excel in mac shows this:
And so is my windows Excel 2010:
Not natively, but you can use the javascript API to copy it to a Javascript variable (see http://www.fusioncharts.com/docs/ExportDataJS.html) and then use Downloadify or HTML5 data uris to generate a save file dialog (as covered here Using HTML5/Javascript to generate and save a file).
Let me know if that works: kinda interesting, didn't realize this was running around.

Resources