How to open an Activity on Keyguard android studio? - android

i have an App which is running good, but now i want to open that app on Keyguard
i mean while my phone is lock i can still able to open my app
like Camera App while the phone is call we can still use camera just like that i want to open my app without opening the lockscreen
help me what should i do to make this work
have edited the xml file
home_screen | keyguard
as a widget but its not working
can anyone help me on this !!

Run the str_ireplace code to insert the smilies after you use htmlspecialchars instead of before.

If you add htmlspecialchars() function after replacing the smileys with HTML Tags. It will not work correctly.
Output will be as
<strong>Name :</strong> I am Happy <img src="happy.png">
There are two solution to make it work.
Soln 1 :
Don't convert the text into emoticons before storing it in database. While showing it to the user.
First use htmlspecialchars(), then use strireplace().
Soln 2:
First convert the whole message using htmlspecialchars() , then convert the emoticons using strireplace(). After that, Store the result in the database.

Related

filter json results into image path

Hello i am using MIT App Inventor 2 to make an app that runs on an old (spare) android phone to display the folder.jpg of currently playing movie (later on I also want to do that with music).
I can't filter the path to use, for example this is the result of the json:
{"id":"VideoGetItem","jsonrpc":"2.0","result":{"item":{"id":1,"label":"2012","thumbnail":"image://F%3a%5cMovies%5c2012%5cfolder.jpg/","type":"movie"}}}
I want to keep: image://F%3a%5cMovies%5c2012%5cfolder.jpg which is the dvd cover (and maybe the label: 2012 which is the title of the movie).
I tried various options like making a list but then I still get text with lot of params between '()'
Can someone help me with this?
Thanks
Use the JSON decode block together with the lookup in pairs block. As you can see, it helps to use Do it...
I have something that is doing it for me for starters.
I see a flaw but that's in Kodi(.tv) itself (I am not a fan of the library system in kodi, so I put a folder.jpg in every drawer of a movie, but sometimes kodi doesn't display it and presents me with a video preview of the movie, I have to sort that out with kodi developers)
For now I am glad I have it working,
solution picture

Problems with Listpicker App Inventor

I'm a beginner at App Inventor and I don't know what I'm doing wrong with the listpicker.
I am trying to create and app to reproduce the music I have stored in my server but when i display the listpicker I can't click any of the options and also I can't go back to the first screen. Here I put my code:
Image 1
Image 2
I tried to remove the line that says call listpicker.open but it only made appear a totally black screen.
The result of the code I just posted is exactly what I spect a list with the name and the link of the 2 songs I already upload to my server but when I click them it didn't do anything.
Thanks for your help.
The Web component works asynchronously, which means, it takes a little bit, until the result is available. The result you will get in the Web.GotText event.
Therefore it does not make sense to call the updateListpicker procedure in the Listpicker.BeforePicking event, because the result still is not available and you get displayed an empty listpicker. The listpicker will be opened, before you have received the result!
Set the listpicker to visible=false and use a button.click event to call the updateListpicker procedure. Then as you already do it in the Web.GotText event, assign the received list to the listpicker and open it.

Android background service that detects a text copy

I'd like to develop an application that does some processing on text copied on clipboard.
I want to prevent user from copying the text, switching to my application, pasting the text and clicking on process. The process would be done instantly as the user simply copies text on clipboard. He would then go on the application to see the process done on the text copies he's made.
Is there a way to have a kind of listener on text copies on clipboard ?
Thanks
1.Use ClipboardManager.OnPrimaryClipChangedListener for triggering callback when text is copied in any app.
2.Launch your App when text copy event is triggered
3.Use ClipboardManager.getPrimaryClip () to get the copied text in your app. Use the text as you want it.
And you're done.
The way you mention sounds too intrusive. An alternate way is to parse each "keystroke" as it comes into your app. If it comes in too fast, then don't accept it on the theory that it was pasted in.
Override the long press event on the edittext field.
Check out this post on how to do it.

Get an image URI in a preference screen!

So, what I'm actually looking for is this solution: Get/pick an image from Android's built-in Gallery app programmatically but working in a preference and not in an activity.
I created a class that I put in my setting and I want to use that class to be able to find the URI of an image selected by the user on its phone. I couldn't use the code in that link because of "startActivityForResult". Which is not available in a preference.
Any idea how to bypass this ?
PROGRESS REPORT:
So, I tried some stuff in the mean time. Instead, in my settings, I added the following:
<Preference
android:key="test"
android:title="open image"
android:persistent="true">
<intent android:action="android.intent.action.GET_CONTENT"
android:value="image/*"/>
</Preference>
First, instead of "GET_CONTENT", it was "PICK", but with it, I can only go with Google Docs and the Sim Card Tool Kit, which is far from the gallery or any thing to browse the file system.
With "GET_CONTENT", it crashes.
I also added the "android.permission.WRITE_EXTERNAL_STORAGE" premission, even if I just want to read. But I didn't found any (let put this as a sub question, if there's a way to just ask to read and not write).
PROGRESS REPORT #2
I replaced android:value by android:mimeType and I goes directly to the gallery. Now, just need to know if I really got the URI and it's solved.
PROGRESS REPORT #3
At this point, here's the real problem. When I go through my SharedPreferences, the value stays empty, even after selecting an images. So, I guess there a little hack to do. So now, that's the question. Based on the example of my preference screen above, how can I retrieve the value of "test", assuming that when the intent is called, it put it somewhere ?
I finally found a solution... it's not as feng shui as I would like, but it works.
I simply code the preference screen by hand and then I was able to access the "startActivityForResult" function.
From this point, it took 3 to 5 minutes to solve it and finalize all the details.
Hope it helps some people.
You have an example there: http://www.anddev.org/code-snippets-for-android-f33/preference-screen-with-custom-views-t8472.html
But the one I used was on google, but I couldn't find the link.

Force close when trying to use BetterAsyncTask in droid-fu Android

I am currently trying to use the android library android fu to help me with my first proper app.
I am trying to makea test project using the droid fu library but when ever i go to test the app it force closes.
I have used an example of the asynctask and when i test the app it loads and does what its meant to but when i replace it with the betterasynctask the app force closes.
You can download the source of the test app from http://androidapp.dino-digital.com/DroidFuTest.zip
This is caused by you not providing a valid resource pointer for your dialog. Right after you instantiate the task -- try calling the task.disableDialog(); method. It should work after that.
EDIT: Seeing as the user wants a custom dialog -- I'd point you to this link. Just create a new custom dialog(or just use the Android's helper methods for creating a dialog) and reference that ID from your code.
Even though hwrdprkns was correct as to disabling the dialog will make the app work to be able to get the progress dialog to work i add to the following to get the dialog to work.
Call both lines to set the dialog content
super.setProgressDialogTitleId(R.string.dialog_title);
super.setProgressDialogMsgId(R.string.dialog_message);
OR
define "droidfu_progress_dialog_title" and droidfu_progress_dialog_message in your strings.xml

Categories

Resources