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
| /** | |
| * validate your email address format. Ex-akhi@mani.com | |
| */ | |
| public static boolean emailValidator(String email) { | |
| Pattern pattern; | |
| Matcher matcher; | |
| final String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; | |
| pattern = Pattern.compile(EMAIL_PATTERN); | |
| matcher = pattern.matcher(email); | |
| return matcher.matches(); |
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
| /** | |
| * ネットワーク接続チェック | |
| * | |
| * @param context | |
| * @return | |
| */ | |
| public static boolean isConnected() { | |
| ConnectivityManager cm = (ConnectivityManager) MyApplication.getContext() | |
| .getSystemService(Context.CONNECTIVITY_SERVICE); | |
| NetworkInfo ni = cm.getActiveNetworkInfo(); |
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 static String uniqueID = null; | |
| private static final String PREF_UNIQUE_ID = "PREF_UNIQUE_ID"; | |
| public synchronized static String id(Context context) { | |
| if (uniqueID == null) { | |
| SharedPreferences sp = context.getSharedPreferences(PREF_UNIQUE_ID, | |
| Context.MODE_PRIVATE); | |
| uniqueID = sp.getString(PREF_UNIQUE_ID, null); | |
| if (uniqueID == null) { | |
| uniqueID = UUID.randomUUID().toString(); |
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
| TextView tv = (TextView) findViewById(R.id.text); | |
| tv.setSingleLine(); // 文字列を1行で表示. これがないと複数行に渡って表示されてしまうので、スクロールできない | |
| tv.setFocusableInTouchMode(true); | |
| tv.setEllipsize(TruncateAt.MARQUEE); | |
| tv.setText("124567890-^9p@焦ったスクロールskxってちょうど私もでらっしゃるのかしら"); |
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
| package com.example.AnimationTest1; | |
| import android.app.Activity; | |
| import android.os.Bundle; | |
| import android.view.animation.Animation; | |
| import android.view.animation.AnimationUtils; | |
| public class AnimationTest1 extends Activity | |
| { | |
| @Override |
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
| package sakura.example.myexamplemojiscroll4; | |
| import android.app.Activity; | |
| import android.os.Bundle; | |
| public class MainActivity extends Activity { | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(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
| Intent intent = new Intent(Intent.ACTION_SEND); | |
| intent.setType("text/plain"); | |
| intent.putExtra(Intent.EXTRA_SUBJECT, "かかおにおくりたいSubject"); | |
| intent.putExtra(Intent.EXTRA_TEXT, "カカオに送りたいText"); | |
| intent.setPackage("com.kakao.talk"); | |
| try { | |
| startActivity(intent); | |
| } catch (Exception e) { | |
| Toast.makeText(getApplicationContext(), "KAKAOがインストールされていません", Toast.LENGTH_LONG) | |
| .show(); |
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
| Intent intent = new Intent(); | |
| intent.setAction(Intent.ACTION_VIEW); | |
| intent.setData(Uri.parse("line://msg/text/" + "LINEに送りたいテキストの内容"));// ブラウザ起動 | |
| try { | |
| startActivity(intent); | |
| } catch (Exception e) { | |
| Toast.makeText(getApplicationContext(), "LINEアプリがインストールされていません", Toast.LENGTH_LONG) | |
| .show(); | |
| } |
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 void onClick5(View view) { | |
| // ギャラリー呼び出し | |
| Intent intent = new Intent(); | |
| intent.setType("image/*"); | |
| intent.setAction(Intent.ACTION_GET_CONTENT); | |
| startActivityForResult(intent, REQUEST_GALLERY); | |
| } | |
| @Override | |
| protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
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
| String textString = "てすと"; | |
| String url = "https://twitter.com/intent/tweet?source=webclient&text=" + textString; | |
| Intent intent = new Intent(Intent.ACTION_VIEW); | |
| intent.setData(Uri.parse(url)); | |
| startActivity(intent); | |
| try { | |
| startActivity(intent); | |
| } catch (Exception e) { | |
| Toast.makeText(getApplicationContext(), "Twitterアプリがインストールされていません", Toast.LENGTH_LONG) | |
| .show(); |