get Running Activity Name - Android android.content

Android examples for android.content:Context

Description

get Running Activity Name

Demo Code

import android.content.Context;

public class Main{

    public static String getRunningActivityName(Context ctx) {
        String contextString = ctx.toString();
        return contextString.substring(contextString.lastIndexOf(".") + 1,
                contextString.indexOf("@"));
    }//  w  w w  .  j av  a  2s.c  om

}

Related Tutorials