How does WhatsApp pop-up notification work? - android

I am trying to mimic the pop-up notification of WhatsApp.
(If you have not seen it, it might be a bit hard for you to understand this.)
Below is an image to give a clearer perspective.
Some suggested that this might be done using an oridnary activity which has the Theme.Holo.Light.Dialog.Alert theme. However, when I implemented that I got half of the activity full with the views (and the other half) which is supposed to be empty like a dialog, showing a white background. ie, I did not have the dialog feel.
Morever, when the device is in standby mode (power button pressed) and locked, whatsapp is able to bypass that and show the popup dialog (or activity, or whatever) above that.
Any ideas how to implement this ?

Oh god! After hours, I found the solution!
Refer link:http://developer.android.com/guide/topics/ui/dialogs.html#CustomLayout
It's extremely easy, you just need to set up the theme of the activity to #android:style/Theme.Holo.Dialog in manifest like:
<activity android:theme="#android:style/Theme.Holo.Dialog" >

Related

Lock screen activity

I've been always curious to know how does lock screen notification view works on IMO messenger app?
So I did some research and some articles were saying it's custom notification layout and part of RemoteView class. So I went through some quick tutorial and gave it a try but still I am not really sure whether I'm going right way. So, finally I'm asking over here. Do you guys have any idea/suggestion to any library or any other way that I can come up with following outcome?
Desire
Result so far
Zip file- if you wanna take a look at the code
https://drive.google.com/file/d/0B9Y-jPBRm4zyTHZsT09kd3pUU0E/view?usp=sharing
What you see in the navigation bar (just a back and home buttons) indicates that this is an Activity, placed above the lock screen with usage of the FLAG_SHOW_WHEN_LOCKED:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
The styling where it looks like a dialog can be done by theming your Activity, probably using something like android:theme="#style/Theme.AppCompat.Dialog"

Android - SMS Popup, wont open over itself

I have made an app that opens a popup, everything is working fine getting the SMS content, sender name and picture.
When a SMS is received it opens a popup shows all the details. But if the popup is already open it wont open another popup showing the content of the second SMS.
The thing that bothers me alot is that, I have PreferenceActivity for this app. When this activity is open then the app is able to open multiple popups, else it doesnt.
I would like to ask
1. How can I make my app to open multiple popups?
2. Why is it when PreferenceActivity is open, the app can make multiple popups
Some details:
For case 1, log is NOT giving me any sort of warning or error.
I have tried to use FLAG_ACTIVITY_NEW_TASK FLAG_ACTIVITY_NO_HISTORY FLAG_ACTIVITY_MULTIPLE_TASK and android:launchMode= "standard"
I have this AlertDialog in an activity, starting this activity from a broadcastreveiver
Thank you.
You are only allowed one popup window at a time and in this case you can treat Dialog like a Popup Window. I'm skeptical that you are able to see more than one popup window in your Preference Activity, but you may be seeing something that looks like it but isn't really more than one. This can be easily checked by using the hierarchy viewer to see what is actually layered.
If you want to have something like layered messages, like in a carousel, card edges, or use some other visual indication you would have use/build a custom view.

Android - Set image over home screen?

I want to set image over home screen when my app runs, like crack screen applications(Ex: https://play.google.com/store/apps/details?id=mk.g6.crackyourscreen&hl=en) to achieve something.
I beileve it has something to do with these permissions;
DISPLAY SYSTEM-LEVEL ALERTS
DISPLAY UNAUTHORIZED WINDOWS
But i cant find an example, tutorial or any article about it?
Thanks...
You should be able to do this by setting a transparent activity. For that matter, you can make your activity use the Translucent theme, like this (put this in the Manifest):
<activity android:theme="#android:style/Theme.Translucent.NoTitleBar">
(source)

Hide Icon and label in Activity (splash screen)

Here's the part of the Manifest that I believe is important:
<application android:icon="#drawable/icon"
android:label="TestApplication"
android:theme="#android:style/Theme.Holo.Light">
<activity android:icon="#drawable/splashicon"
android:label=""
android:name=".Splash">
The splashicon is a 1x1 transparent png. When I try this way, the Application icon renders then fades to the transparent one.
I've tried various combinations of modifying the icon/label section for both activity and application and getting bad results. Removing the icon/label from the activity gives the most preferred result sans icon and label displaying during splash.
How do I get rid of those two items without messing up the icon/label in the app drawer and possibly other locations (haven't tested Market).
Edit:
I'm not after removing the icon/label from the app drawer (in fact, that is one thing I'm trying to retain).
The issue is that if I run the application in 3.0+, I get the icon and the label in the upper lefthand corner of the splash screen which is not what I'm wanting to see.
An example of an application that performs this behavior properly would be Pulse, Angry Birds Rio, and the like.
One application that I've noticed that falls victim to the same issue I'm having is Wyse PocketCloud Pro. If you run it in Honeycomb, look in the upper left hand corner as it is initially loading. Momentarily you can see the icon/label and it fades.
You need to be more specific about what you are looking for. I'll try to answer what you may possibly be asking for.
An activity that is being displayed in the launcher must have a label and icon. That's kind-of... well, it wouldn't make sense to not need these. So please don't play games here and try to not have them. You start to look like a malicious app by doing so.
If you don't want your activity to show up at all in the launcher, then don't declare the intent filter for the MAIN action and LAUNCHER category.
If you want the preview window when launching the app to look more like your real window (let's say you hide the title bar), then in the tag in your manifest use android:theme="..." to declare the theme you use so this can be used for the preview. For example, if you are using Theme.NoTitleBar to not have a title bar, do android:theme="#android:style/Theme.NoTitleBar".
If you want to show a splash screen for your app and have the preview window match it, and one of the standard themes does not match enough, then make your own theme and in the manifest specify it for android:theme. This will let you set a custom background color, or even set the background to an image that is your splash screen.
Keep in mind that launching applications should be fast, so having to show a splash screen every time it launches is very not desirable. On a mobile device, there is a good chance this will greatly reduce the amount your app is used because people won't wait for a long time for it.
If you are looking for something else, please update your question to more clearly state what it is.

Is it possible to launch an Android Activity from an AlertDialog?

I am trying to create a small pop-up in my Android application to let the user choose from one of many items, ala a ListView. I am hoping to make it show up as a translucent box that overlays on the screen, as opposed to completely occupying it like Activities usually do.
One technique for doing this that I've heard is possible is to launch an Activity in an AlertDialog box. This would be perfect - it's the ideal size and has a lot of the mechanical properties I'm looking for, but I'm totally unable to find any more specifics of this technique.
Is this possible? And if not, what is the preferred way of accomplishing something like this?
This should answer your question: http://developer.android.com/guide/topics/ui/themes.html
Quote: For example, you can use the Dialog theme to make your Activity appear like a dialog box. In the manifest, reference an Android theme like so:
<activity android:theme="#android:style/Theme.Dialog">
Maybe you could just display AlertDialog http://developer.android.com/guide/topics/ui/dialogs.html

Categories

Resources