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
class BiCycle { | |
int _speed = 0; | |
int gear; | |
int cadence; | |
BiCycle(this.gear, this.cadence); | |
int get speed => _speed; | |
void applyBrake(int decrement) { |
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 main() { | |
var x= 10.983747; | |
print(x.runtimeType); | |
String s = x.toString(); | |
print(s); | |
String s1 = x.toStringAsFixed(1); | |
print(s1); | |
String name ="Madhan"; | |
print("My name is ${name}"); |
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 { | |
ListView listView ; | |
SensorManager sensorManager ; | |
List<Sensor> listsensor; | |
List<String> liststring ; | |
ArrayAdapter<String> adapter ; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { |
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
var str: String = "Hello World!" //With type specification | |
var str1 = "Get started with Kotlin strings" //With out type specification | |
var str2 = str + ", " | |
var emptyString = String()//Creating an empty string | |
fun main(args: Array<String>) { | |
str2 += str1 | |
println(str) //Result: Hello World! | |
println(str1) //Result: Get started with Kotlin strings | |
println(str2) //Result: Hello World!, Get started with Kotlin strings | |
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
private void saveDBToSDCard() { | |
String databasePath = getActivity().getDatabasePath("Database.sqlite").getPath(); | |
File f = new File(databasePath); | |
OutputStream myOutput = null; | |
InputStream myInput = null; | |
Log.d("testing", " testing db path " + databasePath); | |
Log.d("testing", " testing db exist " + f.exists()); | |
if (f.exists()) { | |
try { |
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 String getLanguage() { | |
Locale locale = Locale.getDefault(); | |
String country = locale.getCountry(); | |
StringBuffer language = new StringBuffer(locale.getLanguage()); | |
language.append("-"); | |
language.append(country); | |
return language.toString().toLowerCase(); | |
} | |
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.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.support.v7.app.AppCompatActivity; | |
public class NetworkActivity extends AppCompatActivity { | |
class NetworkBroadcastReceiver extends BroadcastReceiver { | |
@Override | |
public void onReceive(Context context, Intent intent) { |
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
Open Terminal and type in.. | |
nano ~/.bash_profile | |
Add the below paths | |
export ANDROID_HOME=$HOME/Library/Android/sdk | |
export PATH=$PATH:$ANDROID_HOME/tools | |
export PATH=$PATH:$ANDROID_HOME/tools/bin | |
export PATH=$PATH:$ANDROID_HOME/platform-tools | |
Type source $HOME/.bash_profile to load the config into your current shell. Verify that ANDROID_HOME has been added to your path by running echo $PATH. |