Instantly share code, notes, and snippets.

View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
<application ...>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
View SampleActivity.java
File file = ...
// (1)
// intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
// (2)
Uri uri = FileProvider.getUriForFile(
【アクティビティ名】.this
,getApplicationContext().getPackageName() + ".provider"
, file);
View provider_paths.xml
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
View HttpPostSuccess.java
public JSONObject post(String urlString) throws Exception{
URL url = new URL(urlString);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setConnectTimeout(Const.HTTP_CONNECT_TIMEOUT);
con.setReadTimeout(Const.HTTP_READ_TIMEOUT);
con.setUseCaches(false);
con.setDoInput(true);
con.setDoOutput(true);
con.setChunkedStreamingMode(0);
View HttpPostFailure.java
public JSONObject post(String urlString) throws Exception{
URL url = new URL(urlString);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setConnectTimeout(Const.HTTP_CONNECT_TIMEOUT);
con.setReadTimeout(Const.HTTP_READ_TIMEOUT);
con.setUseCaches(false);
con.setDoInput(true);
con.setDoOutput(true);
con.setChunkedStreamingMode(0);
View completeAuthorization.php
<?php
// Base URL
$baseUrl = 'https://api.fitbit.com';
// Request token path
$req_url = $baseUrl . '/oauth/request_token';
// Authorization path
//【変更】
//$authurl = $baseUrl . '/oauth/authorize';
View enable_vbs.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3]
"140C"=dword:00000000
View ShowMessage.java
/**
* メッセージ表示
*/
private void showMessage(){
final String KEY_OF_PREFERENCES = "KEY_OF_PREFERENCES";
final SharedPreferences preferences = getPreferences(MODE_PRIVATE);
boolean showMessage = preferences.getBoolean(KEY_OF_PREFERENCES, true);
if(showMessage) {
new AlertDialog.Builder(MainActivity.this)
View Main.java
import java.util.List;
import java.util.ArrayList;
public class Main{
public static void main(String[] args) {
List<String> list = new ArrayList();
list.add("one");
View hello.html
<!-- hello.html -->
<html>
<head>
<title>Angular 2 Quickstart</title>
<script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js">
</script>
<script src="https://jspm.io/system@0.16.js">
</script>
<script src="https://code.angularjs.org/2.0.0-alpha.23/angular2.dev.js">
</script>