[Q]How to expand status bar from app - Java for Android App Development

I want to know the the code which is used to expand status bar using EXPAND_STATUS_BAR permission (by maybe intent).
Sent from my GT-S5570 using XDA Premium 4 mobile app

Have a look at this: http://stackoverflow.com/questions/7021310/how-to-open-or-expand-status-bar-through-intent
(Also read the comments for the 4.2 solution.)
You can also find a Github Gist on that topic here: https://gist.github.com/tom-dignan/2468681 (Support for 4.2+ is missing in that.)

nikwen said:
Have a look at this: http://stackoverflow.com/questions/7021310/how-to-open-or-expand-status-bar-through-intent
(Also read the comments for the 4.2 solution.)
You can also find a Github Gist on that topic here: https://gist.github.com/tom-dignan/2468681 (Support for 4.2+ is missing in that.)
Click to expand...
Click to collapse
I have already tried this but aide says unknown entity 'method'.i dont know what i have to import to solve this.
Sent from my GT-S5570 using XDA Premium 4 mobile app

arpitkh96 said:
I have already tried this but aide says unknown entity 'method'.i dont know what i have to import to solve this.
Sent from my GT-S5570 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Do a long press on the underlined word. Select Fix > Import. That should import the right class.

Thanks it worked
Sent from my GT-S5570 using XDA Premium 4 mobile app

But there is one problem.
I also added a start Activity intent along with this code but surprisingly activity doesnt started rather app also exited(not fc)
Sent from my GT-S5570 using XDA Premium 4 mobile app

arpitkh96 said:
But there is one problem.
I also added a start Activity intent along with this code but surprisingly activity doesnt started rather app also exited(not fc)
Sent from my GT-S5570 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Code?

Code:
public void login(View view){
EditText username=(EditText) findViewById(R.id.username);
EditText password=(EditText) findViewById(R.id.password);
try{
File x=new File("/data/data/com.rockstudios.savedata/login.xml");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(x);
doc.getDocumentElement().normalize();
String u = doc.getElementsByTagName("username").item(0).getTextContent();
String d=doc.getElementsByTagName("password").item(0).getTextContent();
if(username.getText().toString().equals(u) && password.getText().toString().equals(d)){
Object service=getSystemService("statusbar");
Class<?> statusbarManager =Class.forName("android.app.StatusBarManager");
Method expand=statusbarManager.getMethod("expand");
expand.invoke(service);
startActivity(new Intent(this,MainActivity.class));
}else{
Toast.makeText(this,"Wrong Username/password",5000).show();
}
} catch (Exception e) {Toast.makeText(this,"error"+e,5000).show();
}}
Actually app hangs when details are correct and expanded statusbar is collapsed by user .touching anywhere makes it exit
Sent from my GT-S5570 using XDA Premium 4 mobile app

arpitkh96 said:
Code:
public void login(View view){
EditText username=(EditText) findViewById(R.id.username);
EditText password=(EditText) findViewById(R.id.password);
try{
File x=new File("/data/data/com.rockstudios.savedata/login.xml");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(x);
doc.getDocumentElement().normalize();
String u = doc.getElementsByTagName("username").item(0).getTextContent();
String d=doc.getElementsByTagName("password").item(0).getTextContent();
if(username.getText().toString().equals(u) && password.getText().toString().equals(d)){
Object service=getSystemService("statusbar");
Class statusbarManager =Class.forName("android.app.StatusBarManager");
Method expand=statusbarManager.getMethod("expand");
expand.invoke(service);
startActivity(new Intent(this,MainActivity.class));
}else{
Toast.makeText(this,"Wrong Username/password",5000).show();
}
} catch (Exception e) {Toast.makeText(this,"error"+e,5000).show();
}}
Actually app hangs when details are correct and expanded statusbar is collapsed by user .touching anywhere makes it exit
Click to expand...
Click to collapse
Thats probably because the onPause() method is called on expanding the statusbar. If you want to start the MainActivity when the user collapses the statusbar, add some Kind of boolean instance variable (e.g. startActivityFlag) that is set to true before you call expand.invoke(service) . Then override the onResume() method like this:
Code:
@Override
public void onResume() {
super.onResume();
if (startActivityFlag) startActivity(new Intent(this,MainActivity.class));
}

SimplicityApks said:
Thats probably because the onPause() method is called on expanding the statusbar. If you want to start the MainActivity when the user collapses the statusbar, add some Kind of boolean instance variable (e.g. startActivityFlag) that is set to true before you call expand.invoke(service) . Then override the onResume() method like this:
Code:
@Override
public void onResume() {
super.onResume();
if (startActivityFlag) startActivity(new Intent(this,MainActivity.class));
}
Click to expand...
Click to collapse
I will try this.does expanding of status bar pauses the background app?
Sent from my GT-S5570 using XDA Premium 4 mobile app

arpitkh96 said:
I will try this.does expanding of status bar pauses the background app?
Sent from my GT-S5570 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
I haven't actually tested it, but it should: http://developer.android.com/training/basics/activity-lifecycle/pausing.html

Related

Button2 doesnt work until Button1 is clicked

Hi All!
I'm new here and new to the Android Eclipse/development side and I'm having a bit of a problem with a java script.
I have a small advertising app with 2 buttons (looking to expand to 4 but that's a different thread), one for Facebook (Button1) and one for Twitter (Button2) and Button2 won't work until Button1 is clicked. It works fine except for that.
Any ideas on solutions? Aggravating me a bit lol
Thanks!!
We will need to see your layout XML and java code to help out.
not sure how i'd do that atm cos im a new member? i know that some admin members get pi**y when you dont wrap any code for formatting reasons??
i've got ready and i can imagine a senior member such as yourself will notice the mistake straight away.
Use pastebin http://pastebin.com/
not sure how to use it, just tried and i got the same message about not being able to post things outside links until 10 posts and so on? even tried pasting the raw text and still wouldnt let me
any suggestions?
thanks
Or use the CODE tags: [CODE ] and [/CODE ], but without the extra spaces.
adamj1910 said:
not sure how to use it, just tried and i got the same message about not being able to post things outside links until 10 posts and so on? even tried pasting the raw text and still wouldnt let me
any suggestions?
thanks
Click to expand...
Click to collapse
Take http off or www and just paste it as text
pastebin.com/4Q0g9ryg
pastebin.com/rHvFePNM
hopefully that should work?
thanks!
You had your button definition in the wrong place for your twitter button
Code:
package com.MYAPP.MYAPP;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
[user=439709]@override[/user]
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); //Set the screen's view to your xml file
Button facebookbutton = (Button) findViewById(R.id.button1); // Retrieve the button from the XML file
facebookbutton.setOnClickListener(new View.OnClickListener() { //Add a listener for when the button is pressed
[user=439709]@override[/user]
public void onClick(View v) {
sendToFacebook();
}
});
Button twitterbutton = (Button) findViewById(R.id.button2); // Retrieve the button from the XML file
twitterbutton.setOnClickListener(new View.OnClickListener() { //Add a listener for when the button is pressed
[user=439709]@override[/user]
public void onClick(View v) {
sendToTwitter();
}
});
}
protected void sendToFacebook() {
String url = "https://www.facebook.com"; // You could have this at the top of the class as a constant, or pass it in as a method variable, if you wish to send to multiple websites
Intent i = new Intent(Intent.ACTION_VIEW); // Create a new intent - stating you want to 'view something'
i.setData(Uri.parse(url)); // Add the url data (allowing android to realise you want to open the browser)
startActivity(i); // Go go go!
}
protected void sendToTwitter() {
String url = "https://www.twitter.com"; // You could have this at the top of the class as a constant, or pass it in as a method variable, if you wish to send to multiple websites
Intent i = new Intent(Intent.ACTION_VIEW); // Create a new intent - stating you want to 'view something'
i.setData(Uri.parse(url)); // Add the url data (allowing android to realise you want to open the browser)
startActivity(i); // Go go go!
}
}
Thanks for that ill give that a try!!! Really appreciate it
Sent from my GT-I9305 using xda app-developers app
it works!!! would i just repeat that for any additional buttons, same format;
Button onclicklistener etc etc etc
Button onclicklistener etc etc etc
protected void
protected void
and so on
does it work like that?
thanks!
Yes, just besure you place the code in your onCreate method for defining your buttons
Ill remember that haha thanks again really appreciate it!! =D
Sent from my GT-I9305 using xda app-developers app
zalez said:
Yes, just besure you place the code in your onCreate method for defining your buttons
Click to expand...
Click to collapse
Hey zalez
I just tried adding a youtube button in the exact same format obviously changing the button source and so on, eclipse couldn't find any problems so I ran it and it just crashed the app on the avd and on a real device?
Sent from my GT-I9305 using xda app-developers app
There are multiple ways. I like setting a listener, then using an onClick method with switch-case statements for every button.
Sent from my GT-I9300 using Tapatalk 4
you've lost me lol i understand the onclick but switch cases? if you check my .xml and .java from pastebin or the .java that another member posted further up ^ ^ ^ ^ that might show where im going wrong?
edit *** i just googled the switch case thing and ive seen it before, just not sure how i'd implement it into my .java?
thanks
bump?
adamj1910 said:
you've lost me lol i understand the onclick but switch cases? if you check my .xml and .java from pastebin or the .java that another member posted further up ^ ^ ^ ^ that might show where im going wrong?
edit *** i just googled the switch case thing and ive seen it before, just not sure how i'd implement it into my .java?
thanks
Click to expand...
Click to collapse
Sorry, I'm away. I'll look up an example from one of my apps later.
Basically, just make an onClickListener. You are then required to use that interface and implement the onClick method. Do that, you have an empty method, with a parameter like View v.
Then, make a switch statement for v.getId(), and do cases for the buttons (use their XML IDs!) that you have.
Hope that's kind of clear?
Sent from my GT-I9300 using Tapatalk 4
bassie1995 said:
Sorry, I'm away. I'll look up an example from one of my apps later.
Basically, just make an onClickListener. You are then required to use that interface and implement the onClick method. Do that, you have an empty method, with a parameter like View v.
Then, make a switch statement for v.getId(), and do cases for the buttons (use their XML IDs!) that you have.
Hope that's kind of clear?
Sent from my GT-I9300 using Tapatalk 4
Click to expand...
Click to collapse
That's actually starting to make sense! But it's just putting that into a script, not really my strong point yet, I'm more of a designer lol
It would be good if you could find some examples for URL buttons, it'd really help. Thanks!
There shouldn't have been any issues adding more. I would need to see your updated java code. Using switch cases is a good idea but at this point, if I was you, I would avoid it for now until you get the hang of the basics. Also, a log cat would be beneficial in debugging.

How do you make buttons

Hello,
I am now making an App for a hospital. I am making the App with Androidstudio but I cant make a button. I have got 4 buttons, but if I click on them they will do nothing. How can I program that if I clicked on them that they will do something? Please help me I can't figure out how could I do this.
Thanks in Advance
Go through the training session on developer.android.com
Sent from my GT-S5570 using XDA Premium 4 mobile app
what i do is use androidnClick="TAG_HIER"
and the make a simple .ethod ( will write / post hier when i am home )
which launches ( apps or sites etc.)
mostly when u type
Button onclick method
on google you will find some gokd tuts
stackoverflow good help aswell
Sent from my S500 using xda app-developers app
poyu said:
Hello,
I am now making an App for a hospital. I am making the App with Androidstudio but I cant make a button. I have got 4 buttons, but if I click on them they will do nothing. How can I program that if I clicked on them that they will do something? Please help me I can't figure out how could I do this.
Thanks in Advance
Click to expand...
Click to collapse
First go to you activity.java file and initialize a button
Code:
private static Button button1;
Then link it with the button in xml using it's id
Code:
button1= (Button) rootView.findViewById(R.id.button1);
Then add a listener where you define what happens on button press.
Code:
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
system.out.println("Button pressed");
}
});
gh0stslayer said:
First go to you activity.java file and initialize a button
Code:
private static Button button1;
Then link it with the button in xml using it's id
Code:
button1= (Button) rootView.findViewById(R.id.button1);
Then add a listener where you define what happens on button press.
Code:
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
system.out.println("Button pressed");
}
});
[/QUOTE
Thank you very much, but when I did this it gave me a message that I pressed a button. What I want is that when i press the button that I will go to an other page. A new page. How can I get this done. I appreciate it a lot that you have done this for me
Click to expand...
Click to collapse
poyu said:
gh0stslayer said:
First go to you activity.java file and initialize a button
Code:
private static Button button1;
Then link it with the button in xml using it's id
Code:
button1= (Button) rootView.findViewById(R.id.button1);
Then add a listener where you define what happens on button press.
Code:
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
system.out.println("Button pressed");
}
});
[/QUOTE
Thank you very much, but when I did this it gave me a message that I pressed a button. What I want is that when i press the button that I will go to an other page. A new page. How can I get this done. I appreciate it a lot that you have done this for me
Click to expand...
Click to collapse
to go to another activity ,you have to use intents
inside on click put these lines
Code:
Intent intent = new Intent(this, anotheractivity.class);
startActivity(intent);
if you are using fragments, use getActivity() instead of this.
Sent from my Galaxy Nexus using Tapatalk
Click to expand...
Click to collapse
How do you make a button that is only enabled if there is text in the textfields in a fragmentactivityQUOTE=gh0stslayer;52131883]
poyu said:
to go to another activity ,you have to use intents
inside on click put these lines
Code:
Intent intent = new Intent(this, anotheractivity.class);
startActivity(intent);
if you are using fragments, use getActivity() instead of this.
Sent from my Galaxy Nexus using Tapatalk
Click to expand...
Click to collapse
How do you make a button that is only enabled if there is text in the textfields in a fragmentactivityQUOTE=gh0stslayer;52131883]
poyu said:
to go to another activity ,you have to use intents
inside on click put these lines
Code:
Intent intent = new Intent(this, anotheractivity.class);
startActivity(intent);
if you are using fragments, use getActivity() instead of this.
Sent from my Galaxy Nexus using Tapatalk
Click to expand...
Click to collapse
poyu said:
How do you make a button that is only enabled if there is text in the textfields in a fragmentactivityQUOTE=gh0stslayer;52131883]
Click to expand...
Click to collapse
you will have to use onEdittext change listener, here is an example
http://stackoverflow.com/questions/4310525/android-on-edittext-changed-listener

[Q]Execute a method of fragment in host activity

Basically what I want is to override back button behavior in fragment.I tried following code (in activity)but that didn't worked.
Code:
public void onBackPressed(){
String n="path"
new Main().loadlist(n);
}
here I am trying to execute the method loadlist of fragment "Main".so that it updates the list view in the fragment itself.please help me to accomplish this
Sent from my GT-S5570 using XDA Premium 4 mobile app
arpitkh96 said:
Basically what I want is to override back button behavior in fragment.I tried following code (in activity)but that didn't worked.
Code:
public void onBackPressed(){
String n="path"
new Main().loadlist(n);
}
here I am trying to execute the method loadlist of fragment "Main".so that it updates the list view in the fragment itself.please help me to accomplish this
Sent from my GT-S5570 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
There two way
1.use broadcast, the host activity send broadcast and fragment recv it.
2.use FragmentManager to get the fragment via res id
FragmentManager fm = getSupportFragmentManager();
mainFragment = (MyFragment)fm.findFragmentById(R.id.mainfragment);
mainFragment.loadlist;
facetea said:
There two way
1.use broadcast, the host activity send broadcast and fragment recv it.
2.use FragmentManager to get the fragment via res id
FragmentManager fm = getSupportFragmentManager();
mainFragment = (MyFragment)fm.findFragmentById(R.id.mainfragment);
mainFragment.loadlist;
Click to expand...
Click to collapse
I tried your second way like this
Code:
FragmentManager fm=getFragmentManager();
Fragment main=fm.findFragmentById(R.id.main);
main.loadlist(n);
Or
Code:
FragmentManager fm=getFragmentManager();
Fragment main=(Fragment)fm.findFragmentById(R.id.main);
main.loadlist(n);
But it shows unknown method loadlist
Sent from my GT-S5570 using XDA Premium 4 mobile app
Code:
FragmentManager fm=getFragmentManager();
Main main=(Main)fm.findFragmentById(R.id.main);
main.loadlist(n);
This worked thanks for the help
Sent from my GT-S5570 using XDA Premium 4 mobile app

[Q] Need help with a program.

public void click(View view) {
String one = "one";
EditText et = (EditText)findViewById(R.id.editText1);
String entered_text = et.getText().toString();
if(et.getText().toString() == one){
TextView tv1 = (TextView)findViewById(R.id.textView1);
tv1.setText("Correct!");
}
else{
TextView tv = (TextView)findViewById(R.id.textView1);
tv.setText(one+entered_text); }
}
This is a code snippet extracted from my program, i didn't post the whole program because it wasn't necessary, as the program runs fine without any runtime exceptions.
So, the program when executed on eclipse doesn't show any errors and runs fine, but when run the "if" condition "et.getText().toString() == "one"" always returns false even when the "entered_text" is "one" i.e.; it never prints "correct!" and the code always prints "one+entered_text" that is the statement in the else clause. And the interesting thing is, if you enter "one" the output will be "oneone", that is the else statement.
Please help me where i went wrong.
Thanks in advance.
You're passing view argument in function so try initialize edit text with (EditText)view.findViewById(R.id.edittext);
panwrona said:
You're passing view argument in function so try initialize edit text with (EditText)view.findViewById(R.id.edittext);
Click to expand...
Click to collapse
Thanks for the reply.
I did what you said and got a runtime exception.
You're running it in fragment or activity?
panwrona said:
You're running it in fragment or activity?
Click to expand...
Click to collapse
Activity.
Are you initializing it in oncreate or somewhere else?
That's easy. Instead of == use text.equals(one)
String are not compared by mathematical signs
Sent from my XT1033 using XDA Premium 4 mobile app

Trying to expand notifications programmatically

Hey, I have this code to expand the notifications:
Code:
try{
Object service = getSystemService("statusbar");
Class<?> statusbarManager = Class.forName("android.app.StatusBarManager");
Method expand = statusbarManager.getMethod("expand");
expand.invoke(service);
}
catch(Exception ex) {
}
But I get some long errors under the expression "statusbar" in line
Code:
Object service = getSystemService("statusbar");
here is the errors:
Code:
Must be one of: Context.POWER_SERVICE,
Context.WINDOW_SERVICE,
Context.LAYOUT_INFLATER_SERVICE,
Context.ACCOUNT_SERVICE,
Context.ACTIVITY_SERVICE,
Context.ALARM_SERVICE,
Context.NOTIFICATION_SERVICE,
Context.ACCESSIBILITY_SERVICE,
Context.CAPTIONING_SERVICE,
Context.KEYGUARD_SERVICE,
Context.LOCATION_SERVICE,
Context.SEARCH_SERVICE,
Context.SENSOR_SERVICE,
Context.STORAGE_SERVICE,
Context.WALLPAPER_SERVICE,
Context.VIBRATOR_SERVICE,
Context.CONNECTIVITY_SERVICE,
Context.NETWORK_STATS_SERVICE,
Context.WIFI_SERVICE,
Context.WIFI_P2P_SERVICE,
Context.NSD_SERVICE,
Context.AUDIO_SERVICE,
Context.FINGERPRINT_SERVICE,
Context.MEDIA_ROUTER_SERVICE,
Context.TELEPHONY_SERVICE,
Context.TELEPHONY_SUBSCRIPTION_SERVICE,
Context.CARRIER_CONFIG_SERVICE,
Context.TELECOM_SERVICE,
Context.CLIPBOARD_SERVICE,
Context.INPUT_METHOD_SERVICE,
Context.TEXT_SERVICES_MANAGER_SERVICE,
Context.APPWIDGET_SERVICE,
Context.DROPBOX_SERVICE,
Context.DEVICE_POLICY_SERVICE,
Context.UI_MODE_SERVICE,
Context.DOWNLOAD_SERVICE,
Context.NFC_SERVICE,
Context.BLUETOOTH_SERVICE,
Context.USB_SERVICE,
Context.LAUNCHER_APPS_SERVICE,
Context.INPUT_SERVICE,
Context.DISPLAY_SERVICE,
Context.USER_SERVICE,
Context.RESTRICTIONS_SERVICE,
Context.APP_OPS_SERVICE,
Context.CAMERA_SERVICE,
Context.PRINT_SERVICE,
Context.CONSUMER_IR_SERVICE,
Context.TV_INPUT_SERVICE,
Context.USAGE_STATS_SERVICE,
Context.MEDIA_SESSION_SERVICE,
Context.BATTERY_SERVICE,
Context.JOB_SCHEDULER_SERVICE,
Context.MEDIA_PROJECTION_SERVICE,
Context.MIDI_SERVICE less... (Ctrl+F1)
This inspection looks at Android API calls and ensures that the correct type of resource is passed to an int-parameter expecting resources of a given type; it checks that APIs which expect an RGB color integer are passed actual colors rather than color resources; it checks that APIs which require a certain permission have the permission declared in the manifest; it checks that parameters expected to fall within a given range actually do; it checks that results of certain method calls are looked at by the caller, and so on.
JusTeN_ said:
Hey, I have this code to expand the notifications:
Code:
try{
Object service = getSystemService("statusbar");
Class statusbarManager = Class.forName("android.app.StatusBarManager");
Method expand = statusbarManager.getMethod("expand");
expand.invoke(service);
}
catch(Exception ex) {
}
But I get some long errors under the expression "statusbar" in line
Code:
Object service = getSystemService("statusbar");
here is the errors:
Code:
Must be one of: Context.POWER_SERVICE,
Context.WINDOW_SERVICE,
Context.LAYOUT_INFLATER_SERVICE,
Context.ACCOUNT_SERVICE,
Context.ACTIVITY_SERVICE,
Context.ALARM_SERVICE,
Context.NOTIFICATION_SERVICE,
Context.ACCESSIBILITY_SERVICE,
Context.CAPTIONING_SERVICE,
Context.KEYGUARD_SERVICE,
Context.LOCATION_SERVICE,
Context.SEARCH_SERVICE,
Context.SENSOR_SERVICE,
Context.STORAGE_SERVICE,
Context.WALLPAPER_SERVICE,
Context.VIBRATOR_SERVICE,
Context.CONNECTIVITY_SERVICE,
Context.NETWORK_STATS_SERVICE,
Context.WIFI_SERVICE,
Context.WIFI_P2P_SERVICE,
Context.NSD_SERVICE,
Context.AUDIO_SERVICE,
Context.FINGERPRINT_SERVICE,
Context.MEDIA_ROUTER_SERVICE,
Context.TELEPHONY_SERVICE,
Context.TELEPHONY_SUBSCRIPTION_SERVICE,
Context.CARRIER_CONFIG_SERVICE,
Context.TELECOM_SERVICE,
Context.CLIPBOARD_SERVICE,
Context.INPUT_METHOD_SERVICE,
Context.TEXT_SERVICES_MANAGER_SERVICE,
Context.APPWIDGET_SERVICE,
Context.DROPBOX_SERVICE,
Context.DEVICE_POLICY_SERVICE,
Context.UI_MODE_SERVICE,
Context.DOWNLOAD_SERVICE,
Context.NFC_SERVICE,
Context.BLUETOOTH_SERVICE,
Context.USB_SERVICE,
Context.LAUNCHER_APPS_SERVICE,
Context.INPUT_SERVICE,
Context.DISPLAY_SERVICE,
Context.USER_SERVICE,
Context.RESTRICTIONS_SERVICE,
Context.APP_OPS_SERVICE,
Context.CAMERA_SERVICE,
Context.PRINT_SERVICE,
Context.CONSUMER_IR_SERVICE,
Context.TV_INPUT_SERVICE,
Context.USAGE_STATS_SERVICE,
Context.MEDIA_SESSION_SERVICE,
Context.BATTERY_SERVICE,
Context.JOB_SCHEDULER_SERVICE,
Context.MEDIA_PROJECTION_SERVICE,
Context.MIDI_SERVICE less... (Ctrl+F1)
This inspection looks at Android API calls and ensures that the correct type of resource is passed to an int-parameter expecting resources of a given type; it checks that APIs which expect an RGB color integer are passed actual colors rather than color resources; it checks that APIs which require a certain permission have the permission declared in the manifest; it checks that parameters expected to fall within a given range actually do; it checks that results of certain method calls are looked at by the caller, and so on.
Click to expand...
Click to collapse
HTML:
Object sbservice = context.getSystemService("statusbar");try { Class statusbarManager = Class.forName("android.app.StatusBarManager"); Method collapse = statusbarManager.getMethod("expand");collapse.setAccessible(true) collapse.invoke(sbservice); }} catch (Exception e) { e.printStackTrace();}
It may be wrong in typs or something else wrong pls fix it bcoz I am from mobile
Sent from my SM-G530H using XDA Free mobile app
AndroidFire said:
HTML:
Object sbservice = context.getSystemService("statusbar");try { Class statusbarManager = Class.forName("android.app.StatusBarManager"); Method collapse = statusbarManager.getMethod("expand");collapse.setAccessible(true) collapse.invoke(sbservice); }} catch (Exception e) { e.printStackTrace();}
It may be wrong in typs or something else wrong pls fix it bcoz I am from mobile
Sent from my SM-G530H using XDA Free mobile app
Click to expand...
Click to collapse
thx but it doesn't matter at all.. just the first line doing me a lot of troubles.
JusTeN_ said:
thx but it doesn't matter at all.. just the first line doing me a lot of troubles.
Click to expand...
Click to collapse
No need to say just hit
Could you upload full java source here main one where you are trying to do stuff on status bar
Sent from my SM-G530H using XDA Free mobile app

Categories

Resources