This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Present you with the dialler | |
Code: Select all | |
Uri telUri = Uri.parse("tel:100861"); | |
returnIt = new Intent(Intent.ACTION_DIAL, telUri); | |
// Start the call |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*@return boolean return true if the application can access the internet | |
*/ | |
private boolean haveInternet(){ | |
NetworkInfo info=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE).getActiveNetworkInfo(); | |
if(info==null || !info.isConnected()){ | |
return false; | |
} | |
if(info.isRoaming()){ | |
//here is the roaming option you can change it if you want to disable internet while roaming, just return false | |
return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); | |
wifi.setWifiEnabled(enabled); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Way one */ | |
android.os.Process.killProcess(android.os.Process.myPid()) | |
/* Way Two */ | |
System.exit(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try{ | |
File f = new File(Environment.getExternalStorageDirectory()+"/myFile.txt"); | |
fileIS = new FileInputStream(f); | |
BufferedReader buf = new BufferedReader(new InputStreamReader(fileIS)); | |
String readString = new String(); | |
//just reading each line and pass it on the debugger | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double accX = -x/SensorManager.GRAVITY_EARTH; | |
double accY = -y/SensorManager.GRAVITY_EARTH; | |
double accZ = z/SensorManager.GRAVITY_EARTH; | |
double totAcc = Math.sqrt((accX*accX)+(accY*accY)+(accZ*accZ)); | |
double tiltX = Math.asin(accX/totAcc); | |
double tiltY = Math.asin(accY/totAcc); | |
double tiltZ = Math.asin(accZ/totAcc); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Display display; | |
display = ((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); | |
int height = display.getHeight(); | |
int width = display.getWidth(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//for hide the status bar | |
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, | |
WindowManager.LayoutParams.FLAG_FULLSCREEN); | |
//hide the title bar | |
NewerOlder