how to show ram used by an application - android

I have a list in my application that shows the running apps and also i want to show used ram by the running application . (other apps)
also i don't want to use this code :
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setClassName("com.android.settings", "com.android.settings.RunningServices");
please give me a solution . thank you!

Related

How can I auto install programmatically app without start Intent.FLAG_ACTIVITY_NEW_TASK

In fact, I want to be noticed when the program is downloaded without the user having to install their own apps (Install without show permissions activity).
Now I use the following code, and I want to change this code to answer my question.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file),"application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
The following image is displayed after downloading the app from my server and i dont want to show

Is it possible to run android application from android application?

Is it possible to run android application from android application? For example, i have a button in application 1 and when i press that button i want application 2 to start. I'm developing application in react-native.
I tried with Linking component but I'm getting this error "No Activity found to handle Intent". So i tried to edit AndroidManifest.xml, also without much success.
Thanks in advance.
Yes through Intent we call Activity of another application like below Intent by passing Application Package name and its class name with full package name .
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.example", "com.example.MyExampleActivity"));
startActivity(intent);
Allowing Other Apps to Start Your Activity

default sms app doesn't open on KITKAT nexus 5

OK, i've tried everything (including several hours of reading and trying a lot of stuff on stackoverflow)
I'm trying to launch the default sms app from the android launcher, and using this code:
Intent smsIntent = new Intent(Intent.ACTION_MAIN);
smsIntent.addCategory(Intent.CATEGORY_DEFAULT);
smsIntent.setType("vnd.android-dir/mms-sms");
smsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(smsIntent);
break;
It works great on all phones BUT my NEXUS 5 .
Guess it has something to do with KITKAT, but not sure how to fix it..
Important - Im not trying to send the text or get it from the user (as i've seen people do here), just getting the user to the main screen of the sms app (hangouts in my case).
Thanks. :)
Intent intent = new Intent();
ComponentName cm =new ComponentName("com.google.android.talk","com.google.android.talk.SigningInActivity");
intent.setComponent(cm);
this adapter nexus, I get the ComponentName by ADB log.

Launching browser on Ice Cream Sandwich

I have a program that I have made for Android 1.6 and up and I have been doing tests to ensure that the program works fine with the new Ice Cream Sandwich (Android 4).
Everything on the app works fine except that when a certain task has been performed by the user it is supposed to automatically launch the android browser. However for some reason it seems to load it up in the background and keeps my app shown which is not what I want it to do.
On every other version of android when I execute the code to launch the browser the browser comes to the top of the screen therefore causing my app to be in the background which is how I wanted it to work.
Below is the code that I have to launch the browser
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setData(Uri.parse(companyURL));
startActivity(intent);
The companyURL is a variable that I am using to parse the url to the browser.
Thanks for any help you can provide.
UPDATE
I have just discovered that if the browser is not currently running (i.e. not been loaded previously) when my app starts the browser it brings it to the front. However, once the browser has been previously loaded, when my app loads it up again, it loads it in the background.
Please try this it is working on ICS for me.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(companyURL));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Typically you don't need the CATEGORY_BROWSABLE category. Try the following instead:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(companyURL));
startActivity(intent);
In fact, the documentation seems to suggest CATEGORY_BROWSABLE is intended to be used in the opposite direction (browser to your app):
Activities that can be safely invoked from a browser must support this category. For example, if the user is viewing a web page or an e-mail and clicks on a link in the text, the Intent generated execute that link will require the BROWSABLE category, so that only activities supporting this category will be considered as possible actions.
http://developer.android.com/reference/android/content/Intent.html#CATEGORY_BROWSABLE
Try adding FLAG_ACTIVITY_BROUGHT_TO_FRONT flag to the intent.
I'm using following code and its working fine with me even when browser is already running in the background.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(intent);

How to launch the third-party android applications I installed through Intent directly?

we can launch android market application from:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData("market://details?id=packgename");
startActivity(intent);
My question is how to launch the third-party android applications I installed through Intent directly? Do you guys have any ideas?
In order to do that, you need to find the following info for the application you want to start:
Package
Startup Class
You can obtain this info if you start third-party app regularly, and in the LogCat inspect the trace.
Then, you just fill in following intent with the info you obtained:
Intent startupIntent = new Intent();
ComponentName distantActivity = new ComponentName("com.third.exampleapp", "com.third.exampleapp.StartupClass");
startupIntent.setComponent(distantActivity);
startupIntent.setAction(Intent.ACTION_MAIN);
startActivity(startupIntent);
Please note that it is very bad practice to start standard Android system Intents this way.

Categories

Resources