Skip to content

Instantly share code, notes, and snippets.

View SelvinPL's full-sized avatar

SelvinPL SelvinPL

View GitHub Profile
interface BTPrinter
{
void printAt(int top, int left, String message);
//add more methods here
void selectFont(String font);
void cutThePaper();
}
class ZebraPrinter implements BTPrinter
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Automatically generated file. DO NOT MODIFY -->
<!-- Values from the variant -->
<item name="colorAccent" type="color">#8CC63F</item>
<item name="colorAccentA10" type="color">#198CC63F</item>
<item name="colorAccentA20" type="color">#338CC63F</item>
<item name="colorAccentA30" type="color">#4c8CC63F</item>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="-6dp"
android:right="-6dp"
android:top="-6dp">
<shape>
<solid android:color="@android:color/black" />
<stroke
android:width="5dp"
package pl.selvin.android.broadcastkilled;
import android.app.Activity;
import android.app.Notification;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
public class TestActivity extends Activity {
//well context is not valid yet, but we will use later so it is ok to use "this"
private Helper helper = new Helper(this);
interface IMySuperInterface {
void setNumPlats(int numero);
}
class MyAtivity extends Activity implements IMySuperInterface {
//do the implentation and other stuff;
}
class MyFragment extends Fragment {
IMySuperInterface defaultInstance = new IMySuperInterface {
<!-- values/attr.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="my_image" format="reference" />
</resources>
<!-- values/styles.xml -->
<style name="MyThemeBase" parent="@style/MyThemeBaseBase">
<item name="my_image">@drawable/my_image_en</item>
</style>
@SelvinPL
SelvinPL / build.gradle
Last active August 29, 2015 14:20
Minimal working example ... without NPE
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "pl.selvin.android.actionbar14"
minSdkVersion 14
targetSdkVersion 22
class Service {
onStartCommand() {
enableGatheringOfSignalData();
}
useSignalData(data) {
//do the stuff with signal data
}
@SelvinPL
SelvinPL / app_src_main_AndroidManifest.xml
Last active August 29, 2015 14:23
It's working for me
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pl.selvin.android.sigletaskissingle">
<application
android:allowBackup="true"
android:label="SingleTaskIsSingleTask">
<activity
android:name=".Activities$ActivityA"
android:label="Activity A"
android:launchMode="singleTask">