How to display HTML on EditText? - java

I am trying to make an Android Application, it is intended to be a notes app, similar to Evernote.
For the ones that have used Evernote (or every other good notes app) you may already know that it allows users to not only save text, but to add images, files, and other formatting features too.
So I came up with the idea of using HTML so the user can attach images and have different text styles (bold, regular, italics, etc...).
The user would select an Image of his files, and the HTML should show it in the EditText itself. Same thing with the Text Style.
Is it possible to achieve this? Would I need to use a library?
EDIT
I followed Lena's answer, and it works fine, but the main problem now is that it does not displays the images properly, whether they are from Internet or from the sd card. I do have Internet permission available and the Write/Read external storage too.
This is my code:
Edit.setText(Html.fromHtml("<strong>IT IS STRONG</strong>" +
"<p>Tiptoe</p>" +
"<img src=\"/sdcard/Pictures/Screenshots/Screenshot_20200204-230814.png\"/>"));

editText.setText(Html.fromHtml(yourHtmlText))

Related

React Native - Opening Android Image Gallery Directly

As the title states, I am wondering how to open the Android image gallery directly from my app. Every single package that is out there, including react-native-image-picker, react-native-image-crop-picker, and yes, even Expo's expo-image-picker all open the "Recents" area!
Opening the gallery MUST be possible, since apps like Whatsapp, Tinder, Facebook, etc. all have this functionality when choosing pictures.
Such a simple functionality - and yet after a month of on and off search I have come up with no solution. Can anybody provide me with a way to do this? Or guide me in the correct direction? At this point I am prepared to write native Android code or custom React Native to get this to work.
i found this library
react-native-multiple-image-picker
it will open camera roll not recent file

change font size option for mobile web app?

I'm developing an app with phonegap and i want to add text size option for users. but i want this text size change saves to app so when the user reopen the app the text size stays the same he/she choose the last time?
Look at phonegap localstorage, it could be what you're looking for:
http://docs.phonegap.com/en/edge/cordova_storage_localstorage_localstorage.md.html
Alternatively you might want to write some kind of an user configuration file using the file api:
http://docs.phonegap.com/en/edge/cordova_file_file.md.html#File

Detect if .swf has transparent background

Is there a way to do this programmatically in PHP, Python or Java?
Use case:
User uploads .swf through an upload form.
Detect if it has a transparent background.
If it does, change it to something else, e.g. white.
This is very difficult to determine, because all SWFs are actually transparent (or they all can be) - it's just that they can contain shapes which cover the entire stage, which make them appear non-transparent.
To determine this programmatically, you'd need to loop over every shape in the SWF and look at it's bounds. However, that wont be enough since any shapes can be changed by ActionScript blocks and new shapes can be created at run time.
But really, making them transparent is the hard task. Since you want to make sure they're are non-transparent, you can just deal with this at display time - put a colored div behind the object or embed tag.
Probably impossible. I suggest a checkbox on the upload form "This flash app looks best with a transparent background".
Here is a flash app that has
- a transparent background to start
- a slider that lets you adjust the opacity
As you can see it would be impossible to say "transparent" or "opaque"
As far as I know you can't get the background alpha (transparency) of a swf file. what I would do if I were you would put the uploaded swf into a container swf (load the uploaded swf inside it) which only has a background color of your choice.
There used to be a php swf reader in this link. But I didn't see any alpha information in it aswell.
Flash is a bunch of compiled binary data. You Might be able to hunt down a third party library which can un-compile the flash file and get some of the data from the root movie scene, but it's a large stretch. As others have recommended, a checkbox during upload would be the best route to take.
I think you can read the .html where the .swf is placed and see if there is a parameter called "wmode" and is set to "transparent"
If that's the case you can get the html file and read it with Python, Java or PHP.
It's an ugly solution, but it's a solution.
PS: Sorry for my poor English.
The swf files are handled by plugins running inside or outside the browser. There is no way to tell if a certain flash has or hasn't transparent background... i guess you can assume that all of them are transparent..

Use blackberry camera in java app to select a photo that was already on file

I know you can use
Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, null);
to get the blackberry camera application to be shown and allow the user to take photos. From which you can use a FileJournalListener to find any created files.
(As shown/implied in this forum post: http://supportforums.blackberry.com/t5/Java-Development/How-to-use-FileJournalListener/td-p/295424)
There are times however, when the user chooses not to take a photo but selects one from the file system. Since this wasn't created at the time I opened it, using the FileJournalListener is not going to meet my needs.
What should I use to get the selected file?
EDIT: The functionality I'm trying to produce I've seen in the Twitter for blackberry application
I think you should create a file picker first,
http://docs.blackberry.com/en/developers/deliverables/11958/Create_a_file_picker_856986_11.jsp
After that in the application, user could select whether to capture new picture or browse from their storage.
If user select the later, open up this file picker and for every images found user can view the image, and the application can save the path where the images located for further processing.

Architecture for Java, Android, Database Application? what should the app look like

I have a site where, via Android, a user needs to:
fill in a document (simple html I think).
the next step would be to sign on the Android.
the data should be saved into a database inside the site.
Points I should mention:
the UI should be as simple as it gets
I am the one who should build the web database
So therefore my idea was :
the application would open an browser where the user will insert all his stuff into the html.
the html will save automatically all the data into a class called data.
the next intent of the application would be the surfaceView (where like a painter the user will sign).
the surfaceView will be saved into png and with data both will be stored in another class which will be inserted into the server.
so in this class would be two files the png one and one contain all the info that was on the html as strings (Jonathan Leffler I hope this one solves my misleading)
the server will take this class and parse it and save it into tables.
Someone has another idea?
In which language should I write it? I thought Java and Android where the database would be MySQL. Does anyone have another idea?
another idea I have is to change this html file into Android sheet
so all the information would be stored on the device and by clicking upload all the information would be sent to the internet site where a server will store it in his database
Can someone point what would be a better solution
note:in my second solution no internet availability is needed so it can work offline where in the first case its needed.
I would like to hear more then on solution on to pick the best who fits my qualities
You will need a webpage optimized for mobile display for Android. That should be PHP and MySQL.
The next thing would be a native Android application written in Java. That will probably use some local data, so it will use mobile SQLite database on the phone.
When the user logs into your website, that is done by the web, and later it will redirect the user to a custom scheme something like signature://capture . The webview will detect this scheme, and will launch your native app.
You will setup your Android application to react to this custom scheme, so it will open up, and will open up the SurfaceView. Then the user will be able to touch the screen, to give his signature.
When you capture the signature, either the set of the points (reccomended) or the generated image (will cause postprocessing issues) you will issue a simple HTTP Post method, that will send/post the data to your server.
So you will end up having in your web environment the captured signature.
Good luck with development.

Categories