Showing posts with label for example. Show all posts
Showing posts with label for example. Show all posts
on Sunday, September 14, 2014


Searching through stackoverflow i found exactly the same question i want to make:


What I am trying to achieve is to get the active 'window' title, for example, when I open a web browser the title is "www.google.com" and if I open a conversation with Mister X in SMS/MMS, the current title is "Mister X 0245478767".


There wasn't any concrete answer. One answer suggested to use getTitle() method from Activity class, but doesn't explain how to use it through activitymanager.


My code to get the current active App is this:



RunningTaskInfo foregroundTaskInfo = am.getRunningTasks(1).get(0);
String foregroundTaskPackageName = foregroundTaskInfo.topActivity.getPackageName();
PackageInfo foregroundAppPackageInfo = pm.getPackageInfo(foregroundTaskPackageName, 0);

foregroundTaskAppNameOld = foregroundTaskAppName;
foregroundTaskAppName = foregroundAppPackageInfo.applicationInfo.loadLabel(pm).toString();

on Sunday, August 31, 2014


What I am trying to accomplish is, starting from an app's ActivityInfo (third party app), I would like to launch it from my Service in the state it was. In the same way that if an user presses the home button and there touches, for example, Whatsapp's icon, Whatsapp will launch to the conversation he previously was. I have managed to launch any app. What I don't know is how to launch the app to the previous state, that is, the particular conversation I (or the user) was in -assuming it is still in memory, of course.


I first tried:



ActivityInfo app = (ActivityInfo) getActivityInfo();
String packName = app.packageName;
Intent appIntent = pm.getLaunchIntentForPackage(packName);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(appIntent);


Then I tried:



ActivityInfo app = (ActivityInfo) getActivityInfo();
String packName = app.packageName;
Intent appIntent = pm.getLaunchIntentForPackage(packName);
appIntent.setFlags(0);
appIntent.setPackage(null);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(appIntent);


I have also tried:



ActivityInfo app = (ActivityInfo) getActivityInfo();
Intent appIntent = new Intent();
appIntent.setComponent(new ComponentName(app.applicationInfo.packageName, app.name));
appIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(appIntent);


So, does anyone know how to achieve this?


on Tuesday, August 12, 2014


i learn about android chat-head, i see many of example of it,but i not got answers of how to remove chat head using any event,i want to create chat-head like Facebook-messenger, many of example of floating-window useful to me to create that,but any one please help me to how to remove chat-head, for example in Facebook-messenger we put chat-head in bottom ,one cross automatic open in bottom through that we can remove chat-head.


enter image description here