Available Methods
- RESULT_OK
- startActivity ( )
- startActivityForResult ( )
- finish ( )
- findViewById ( )
- getSystemService ( )
- isFinishing ( )
- runOnUiThread ( )
- getWindow ( )
- toString ( )
- RESULT_CANCELED
- overridePendingTransition ( )
- getApplicationContext ( )
- getString ( )
- getCurrentFocus ( )
- getIntent ( )
- setRequestedOrientation ( )
- getResources ( )
- obtainStyledAttributes ( )
- getActionBar ( )
- getFragmentManager ( )
- getLayoutInflater ( )
- setTheme ( )
- requestPermissions ( )
- getPackageManager ( )
- isDestroyed ( )
- setResult ( )
- getApplication ( )
- getSharedPreferences ( )
- checkSelfPermission ( )
- sendBroadcast ( )
- setTitle ( )
- isRestricted ( )
- getClass ( )
- shouldShowRequestPermissionRationale ( )
- invalidateOptionsMenu ( )
- setContentView ( )
- getPackageName ( )
- registerReceiver ( )
- getContentResolver ( )
- managedQuery ( )
- getWindowManager ( )
- startService ( )
- getApplicationInfo ( )
- isChangingConfigurations ( )
- recreate ( )
- unbindService ( )
- getBaseContext ( )
- bindService ( )
- requestWindowFeature ( )
- getRequestedOrientation ( )
- hashCode ( )
- stopService ( )
- getLocalClassName ( )
- getTheme ( )
- getPreferences ( )
- addContentView ( )
- getParent ( )
- finishAffinity ( )
- startIntentSenderForResult ( )
- unregisterReceiver ( )
- isChild ( )
- isInMultiWindowMode ( )
- getCallingPackage ( )
- getCallingActivity ( )
- equals ( )
- setProgressBarIndeterminateVisibility ( )
- setVolumeControlStream ( )
- getComponentName ( )
- MODE_PRIVATE
- getDrawable ( )
- finishAfterTransition ( )
- getTaskId ( )
- getCacheDir ( )
- moveTaskToBack ( )
- openFileOutput ( )
- setTaskDescription ( )
- getExternalFilesDir ( )
- openOrCreateDatabase ( )
Related Classes
- java.io.File
- android.os.Bundle
- android.content.Context
- android.view.View
- android.util.Log
- android.widget.TextView
- android.content.Intent
- android.view.ViewGroup
- android.view.LayoutInflater
- android.os.Build
- android.widget.Toast
- android.widget.ImageView
- android.graphics.Color
- android.os.Handler
- android.net.Uri
- android.widget.Button
- android.graphics.Bitmap
- android.text.TextUtils
- android.view.MotionEvent
- android.graphics.drawable.Drawable
- android.widget.LinearLayout
- android.content.pm.PackageManager
- android.support.annotation.Nullable
- android.widget.EditText
- android.content.SharedPreferences
Java Code Examples for android.app.Activity#openFileOutput()
The following examples show how to use
android.app.Activity#openFileOutput() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayerFragment.java From AudioVideoPlayerSample with Apache License 2.0 | 6 votes |
private final void prepareSampleMovie(File path) throws IOException { final Activity activity = getActivity(); if (!path.exists()) { if (DEBUG) Log.i(TAG, "copy sample movie file from res/raw to app private storage"); final BufferedInputStream in = new BufferedInputStream(activity.getResources().openRawResource(R.raw.easter_egg_nexus9_small)); final BufferedOutputStream out = new BufferedOutputStream(activity.openFileOutput(path.getName(), Context.MODE_PRIVATE)); byte[] buf = new byte[8192]; int size = in.read(buf); while (size > 0) { out.write(buf, 0, size); size = in.read(buf); } in.close(); out.flush(); out.close(); } }
Example 2
Source File: FileIO.java From PHONK with GNU General Public License v3.0 | 5 votes |
/** * Write the data to the file indicate by fileName. The file is created if * it doesn't exists. */ public static void write(Activity activity, String data, String fileName) throws IOException { FileOutputStream fo = activity.openFileOutput(fileName, 0); BufferedWriter bf = new BufferedWriter(new FileWriter(fo.getFD())); bf.write(data); bf.flush(); bf.close(); }
Example 3
Source File: SystemUtils.java From CoolWeather with Apache License 2.0 | 5 votes |
/** * @author htq_ * @param mActivity * bolg:www.csdn.net/htq__ */ public static void shareApp(Activity mActivity) { String shareAppContent="各位亲爱的小伙伴们,我发现了一款简约好用且颜值爆表的天气APP酷我天气,分享给大家,记得关注作者的博客http://blog.csdn.net/htq__,福利多多哦!"; new File(mActivity.getFilesDir(), "share.png").deleteOnExit(); FileOutputStream fileOutputStream=null; try { fileOutputStream = mActivity.openFileOutput( "share.png", 1); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } Bitmap pic=BitmapFactory.decodeResource(mActivity.getResources(),com.htq.coolweather.R.drawable.cool_weather_icon); pic.compress(CompressFormat.JPEG, 100,fileOutputStream); Intent intent = new Intent("android.intent.action.SEND"); intent.setType("image/*"); intent.putExtra("sms_body", shareAppContent); intent.putExtra("android.intent.extra.TEXT",shareAppContent); intent.putExtra("android.intent.extra.STREAM", Uri.fromFile(new File(mActivity.getFilesDir(), "share.png"))); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); mActivity.startActivity(Intent.createChooser(intent,"好东西要与小伙伴们一起分享")); }