Skip to content

Instantly share code, notes, and snippets.

View saturov's full-sized avatar

Eugene Saturov saturov

View GitHub Profile
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MyActivity">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
dependencies {
compile fileTree(dir: ‘libs’, include: [‘*.jar’])
compile ‘com.android.support:support-v4:20.0+’
}
<string name="notify">Notify Wearable</string>
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
Button wearButton = (Button)findViewById(R.id.wearButton);
wearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast toast = Toast.makeText(context, text, duration);
toast.show();
TextFragment textFragment = new TextFragment();
Bundle bundle = new Bundle();
bundle.putString("myText", "Hey ya!");
textFragment.setArguments(bundle);
public class TextFragment extends Fragment {
private static final String ARG_TEXT = "arg_text";
public static TextFragment newInstance(String text) {
TextFragment textFragment = new TextFragment();
Bundle bundle = new Bundle();
bundle.putString(ARG_TEXT, text);
textFragment.setArguments(bundle);
return textFragment;
}
TextFragment textFragment = TextFragment.newInstance("Hello there!");
public class TuningAdapter extends ArrayAdapter<Tuning> {
private ArrayList<Tuning> tunings;
private Context context;
private int itemLayout;
public TuningAdapter(Context context, int itemLayout, ArrayList<Tuning> tunings) {
super(context, itemLayout, tunings);
this.context = context;
this.itemLayout = itemLayout;
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="20">