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
public class JsonResponse extends AsyncTask<String, Void, String> | |
{ | |
String finalData = null; | |
@Override | |
protected String doInBackground(String... params) | |
{ | |
Uri.Builder ub = new Uri.Builder(); | |
ub.scheme("http").authority("api.someapi.com").appendPath("somepath") | |
.appendQueryParameter("lng", "") |
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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.company.product.package"> | |
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | |
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | |
<uses-permission android:name="android.permission.INTERNET" /> | |
<application | |
android:allowBackup="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
void enableGPS() { | |
// locMan = (LocationManager)getSystemService(Context.LOCATION_SERVICE); | |
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | |
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, 1); | |
} | |
else | |
checkIfGPSIsOn(locMan, this); |
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
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
TabLayout tabLayout=(TabLayout)findViewById(R.id.tabs); | |
MyPagerAdapter myPagerAdapter=new MyPagerAdapter(getSupportFragmentManager()); | |
ViewPager viewPager=(ViewPager)findViewById(R.id.pager); | |
viewPager.setAdapter(myPagerAdapter); |
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
/** | |
* Uses the file name of font usually .ttf format from project and creates a typeface | |
* object that can be used to set text typeface where it is supported. | |
**/ | |
public class TypeFaceHelper | |
{ | |
private Typeface typeFace; | |
public TypeFaceHelper(String fileNameWithExtension) | |
{ |
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
import android.app.Activity; | |
import android.hardware.Sensor; | |
import android.hardware.SensorEvent; | |
import android.hardware.SensorEventListener; | |
import android.hardware.SensorManager; | |
import android.os.Bundle; | |
import android.view.animation.Animation; | |
import android.view.animation.RotateAnimation; | |
import android.widget.ImageView; | |
import android.widget.TextView; |
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
public class WifiTest | |
{ | |
// ringerMode = AudioManager.RINGER_MODE_SILENT; | |
// ringerMode = AudioManager.RINGER_MODE_VIBRATE; | |
// ringerMode = AudioManager.RINGER_MODE_NORMAL; | |
// WifiName="Home-Wifi"; | |
public static boolean setVolumeWhenThisWifiConnects(String WifiName,int ringerMode) | |
{ | |
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); |
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
package com.testing.name.locationservicetest; | |
import android.Manifest; | |
import android.content.Context; | |
import android.content.pm.PackageManager; | |
import android.location.Criteria; | |
import android.location.Location; | |
import android.location.LocationManager; | |
import android.os.AsyncTask; |
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
public class BackgroundService extends Service { | |
private static BroadcastReceiver mTickReceiver; | |
public BackgroundService() | |
{ | |
} | |
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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.testbed.projects.stackoverflow"> | |
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> | |
<application | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name" | |
android:supportsRtl="true" | |
android:theme="@style/AppTheme"> |
OlderNewer