Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I was wondering how could I make in Android something like the popup messages seen in Candy Crush Saga, those messages like "Delicious!", "Tasty!" or similar:

enter image description here

As well as the score of each movement, they will pop up at first and then vanish:

enter image description here

How could I implement something like that in Android?

share|improve this question
    
Javi, welcome to the site. I modified your question a bit. Asking for libraries, etc. is kind of like a polling question, it just produces a list. That's not really what this site is about. So I've changed your question to instead ask How to do it instead of Where can I find out how to do it. –  Byte56 Jul 9 '13 at 17:06

1 Answer 1

Toast message might be the thing, that you are looking for. If you are not familiar with toast messages, i suggest that you take a look at this document page, about Toast messages:

Toast message

And then you should take a look at custom toast view document:

CustomToastView


Here's how to do it. First, create XML layout file and name it "cust_toast_layout.xml" and define the below layout.

cust_toast_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/relativeLayout1"
    android:background="@android:color/white">

<TextView
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:id="@+id/textView1" android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:text="Paresh N. Mayani"
    android:gravity="center"
    android:textColor="@android:color/black">
</TextView>

<ImageView
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:src="@drawable/new_logo"
    android:layout_below="@+id/textView1"
    android:layout_margin="5dip"
    android:id="@+id/imageView1">
</ImageView>

<TextView
    android:id="@+id/textView2"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:text="This is the demo of Custom Toast Notification"
    android:gravity="center"
    android:layout_below="@+id/imageView1"
    android:textColor="@android:color/black">
</TextView>

</RelativeLayout>

And Now inflate the above layout to create/show custom Toast notification:

CustomToastDemoActivity.java

LayoutInflater inflater = getLayoutInflater();
    View view = inflater.inflate(R.layout.cust_toast_layout,
                                   (ViewGroup) findViewById(R.id.relativeLayout1));

    Toast toast = new Toast(this);
    toast.setView(view);
    toast.show();

(same answer can be found from here, thanks to Paresh Mayani) Adding image to toast

share|improve this answer
    
Link only answers are poor answers. I suggest you expand this answer by including an overview of the process for implementing these messages and the basic premise behind how they work. –  Byte56 Jul 9 '13 at 16:58
    
Adding image to toast - link has perfect answer for this. –  Katu Jul 9 '13 at 17:28
    
Great, take it and use it to expand this answer into more than just links. –  Byte56 Jul 9 '13 at 17:31
    
A follow-up to what Byte said. We ask that you expand on the links because links are prone to link-rot and we want to future proof the answers as much as possible. –  Noctrine Jul 9 '13 at 17:39
    
Should be enough information, to implement that feature. –  Katu Jul 9 '13 at 18:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.