Skip to content

Instantly share code, notes, and snippets.

cketti cketti

Block or report user

Report or block cketti

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View android-29-sources.md

Build "Sources for Android 29" so you can comfortably browse the Android API source in Android Studio.

  1. Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build

mkdir -p frameworks/base
@cketti
cketti / ContentUriRequestBody.kt
Created Mar 27, 2019
Implementation of OkHttp's RequestBody that supports Android's content:// URIs
View ContentUriRequestBody.kt
import android.content.ContentResolver
import android.net.Uri
import okhttp3.MediaType
import okhttp3.RequestBody
import okio.BufferedSink
import okio.Okio
import java.lang.IllegalStateException
class ContentUriRequestBody(
private val contentResolver: ContentResolver,
@cketti
cketti / android-28-sources.md
Created Aug 7, 2018
Build your own android-28 sources
View android-28-sources.md

Build "Sources for Android 28" so you can comfortably browse the Android API source in Android Studio.

  1. Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build

mkdir -p frameworks/base
@cketti
cketti / android-27-sources.md
Created Dec 18, 2017
Build your own android-27 sources
View android-27-sources.md

Build "Sources for Android 27" so you can comfortably browse the Android API source in Android Studio.

  1. Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build

mkdir -p frameworks/base
@cketti
cketti / android-26-sources.md
Last active Aug 14, 2019
Build your own android-26 sources
View android-26-sources.md

If you are annoyed that "Sources for Android 26" are not yet available via SDK manager, this might be for you:

  1. Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build

mkdir -p frameworks/base
@cketti
cketti / AndroidManifest.xml
Last active Jul 4, 2016
Android manifest entry for CopyToClipboardActivity with icon, label, and transparent theme
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="...">
<application ...>
...
<activity
android:name=".CopyToClipboardActivity"
android:exported="false"
android:icon="@mipmap/ic_copy_link"
@cketti
cketti / CopyToClipboardActivity.java
Last active Jun 13, 2016
Activity that copies the URL from the Intent to the clipboard
View CopyToClipboardActivity.java
public class CopyToClipboardActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Uri uri = getIntent().getData();
if (uri != null) {
copyTextToClipboard(uri.toString());
Toast.makeText(this, "Link copied to clipboard", Toast.LENGTH_SHORT).show();
@cketti
cketti / ShareWithCopyToClipboardAction.java
Created Jun 13, 2016
Share text, but add an additional entry to the Chooser dialog
View ShareWithCopyToClipboardAction.java
String url = "https://example.org/cool-link";
// Create Share Intent
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, "hey kids check out this cool link\n" + url);
// Create "Copy Link To Clipboard" Intent
Intent clipboardIntent = new Intent(context, CopyToClipboardActivity.class);
@cketti
cketti / LaunchWithEmailIntentBuilder.java
Created Jan 7, 2016
Build and launch ACTION_SENDTO Intent using EmailIntentBuilder
View LaunchWithEmailIntentBuilder.java
boolean success = EmailIntentBuilder.from(activity)
.to("support@example.org")
.cc("developer@example.org")
.subject("Error report")
.body(buildErrorReport())
.start();
@cketti
cketti / BuildWithEmailIntentBuilder.java
Created Jan 7, 2016
Build ACTION_SENDTO Intent using EmailIntentBuilder
View BuildWithEmailIntentBuilder.java
Intent emailIntent = EmailIntentBuilder.from(context)
.to("developer@example.org")
.subject("Feedback for MyAwesomeApp")
.build();
You can’t perform that action at this time.