List of usage examples for android.content Context MODE_WORLD_WRITEABLE
int MODE_WORLD_WRITEABLE
To view the source code for android.content Context MODE_WORLD_WRITEABLE.
Click Source Link
From source file:Main.java
public static File getCacheDir(Activity act) { return act.getDir("cacheFile", Context.MODE_PRIVATE | Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE); }
From source file:Main.java
public static File getDataUpdateDir(Activity act) { return act.getDir("update", Context.MODE_PRIVATE | Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE); }
From source file:Main.java
/** * (android) write to file//from w w w .j a v a2 s. com * * @param fileName * @param toSave * @return */ public static boolean androidFileSave(Context con, String fileName, String toSave) { Properties properties = new Properties(); properties.put(FILE_ENCODING, toSave); try { FileOutputStream stream = con.openFileOutput(fileName, Context.MODE_WORLD_WRITEABLE); properties.store(stream, ""); } catch (FileNotFoundException e) { return false; } catch (IOException e) { return false; } return true; }
From source file:Main.java
private static boolean levelExist(int level) { if (mLevelSet == null) mLevelSet = mContext.getSharedPreferences(PREFER, Context.MODE_WORLD_READABLE).getStringSet(LEVELSET, null);// w w w . j a v a 2s . c o m if (mLevelSet == null) { mLevelSet = new TreeSet<String>(); mLevelSet.add(String.valueOf(level)); mContext.getSharedPreferences(PREFER, Context.MODE_WORLD_WRITEABLE).edit() .putStringSet(LEVELSET, mLevelSet).commit(); return false; } if (mLevelSet.contains(String.valueOf(level))) return true; else { mLevelSet.add(String.valueOf(level)); mContext.getSharedPreferences(PREFER, Context.MODE_WORLD_WRITEABLE).edit() .putStringSet(LEVELSET, mLevelSet).commit(); } return false; }
From source file:com.klinker.android.twitter.ui.compose.NotificationCompose.java
@Override public void setUpReplyText() { // mark the messages as read here NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); mNotificationManager.cancel(1);/*from w w w.j av a 2s . c o m*/ mNotificationManager.cancel(9); sharedPrefs = getSharedPreferences("com.klinker.android.twitter_world_preferences", Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE); Context context = getApplicationContext(); int currentAccount = sharedPrefs.getInt("current_account", 1); // we can just mark everything as read because it isnt taxing at all and won't do anything in the mentions if there isn't one // and the shared prefs are easy. // this is only called from the notification and there will only ever be one thing that is unread when this button is available MentionsDataSource.getInstance(context).markAllRead(currentAccount); // set up the reply box sharedPrefs.edit().putInt("dm_unread_" + currentAccount, 0).commit(); reply.setText(sharedPrefs.getString("from_notification", "")); reply.setSelection(reply.getText().toString().length()); notiId = sharedPrefs.getLong("from_notification_long", 0); replyText = sharedPrefs.getString("from_notification_text", ""); sharedPrefs.edit().putLong("from_notification_id", 0).commit(); sharedPrefs.edit().putString("from_notification_text", "").commit(); sharedPrefs.edit().putString("from_notification", "").commit(); sharedPrefs.edit().putBoolean("from_notification_bool", false).commit(); String t = reply.getText().toString(); if (!android.text.TextUtils.isEmpty(t) && !t.endsWith(" ")) { reply.append(" "); reply.setSelection(reply.getText().length()); } // try from android wear device CharSequence voiceReply = getVoiceReply(getIntent()); if (voiceReply != null) { if (!voiceReply.equals("")) { // set the text reply.append(voiceReply); // send the message doneClick(); finish(); } } }
From source file:com.klinker.android.twitter.ui.compose.NotificationComposeSecondAcc.java
@Override public void setUpReplyText() { // mark the messages as read here NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); mNotificationManager.cancel(1);//from w w w .ja v a2s. co m mNotificationManager.cancel(9); sharedPrefs = getSharedPreferences("com.klinker.android.twitter_world_preferences", Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE); Context context = getApplicationContext(); int currentAccount = sharedPrefs.getInt("current_account", 1); if (currentAccount == 1) { currentAccount = 2; } else { currentAccount = 1; } useAccOne = false; useAccTwo = true; NetworkedCacheableImageView pic = (NetworkedCacheableImageView) findViewById(R.id.profile_pic); HoloTextView currentName = (HoloTextView) findViewById(R.id.current_name); if (settings.roundContactImages) { pic.loadImage(settings.secondProfilePicUrl, false, null, NetworkedCacheableImageView.CIRCLE); } else { pic.loadImage(settings.secondProfilePicUrl, false, null); } currentName.setText("@" + settings.secondScreenName); MentionsDataSource.getInstance(context).markAllRead(currentAccount); sharedPrefs.edit().putInt("dm_unread_" + currentAccount, 0).commit(); // set up the reply box reply.setText(sharedPrefs.getString("from_notification_second", "")); reply.setSelection(reply.getText().toString().length()); notiId = sharedPrefs.getLong("from_notification_long_second", 0); replyText = sharedPrefs.getString("from_notification_text_second", ""); sharedPrefs.edit().putLong("from_notification_id_second", 0).commit(); sharedPrefs.edit().putString("from_notification_text_second", "").commit(); sharedPrefs.edit().putString("from_notification_second", "").commit(); sharedPrefs.edit().putBoolean("from_notification_bool_second", false).commit(); // try from android wear device CharSequence voiceReply = getVoiceReply(getIntent()); if (voiceReply != null) { if (!voiceReply.equals("")) { // set the text reply.append(voiceReply); // send the message doneClick(); finish(); } } }
From source file:com.klinker.android.twitter.ui.drawer_activities.discover.DiscoverPager.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = this; sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences", Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE); settings = AppSettings.getInstance(this); requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); setUpTheme();//from www .j a v a 2 s . c o m setContentView(R.layout.trends_activity); setUpDrawer(3, getResources().getString(R.string.trends)); actionBar = getActionBar(); actionBar.setTitle(getResources().getString(R.string.trends)); if (!settings.isTwitterLoggedIn) { Intent login = new Intent(context, LoginActivity.class); startActivity(login); finish(); } mSectionsPagerAdapter = new TrendsPagerAdapter(getFragmentManager(), context); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOverScrollMode(ViewPager.OVER_SCROLL_NEVER); mViewPager.setOffscreenPageLimit(3); if (settings.addonTheme) { PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip); strip.setBackgroundColor(settings.pagerTitleInt); } }
From source file:com.klinker.android.twitter.settings.configure_pages.ConfigurePagerActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = this; sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences", Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE); settings = AppSettings.getInstance(this); try {/*from w w w .j a va2 s. c o m*/ requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); } catch (Throwable e) { // don't have a clue why } Utils.setUpTheme(context, settings); setContentView(R.layout.configuration_activity); setUpDoneDiscard(); actionBar = getActionBar(); if (!settings.isTwitterLoggedIn) { Intent login = new Intent(context, LoginActivity.class); startActivity(login); finish(); } mSectionsPagerAdapter = new ConfigurationPagerAdapter(getFragmentManager(), context); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOverScrollMode(ViewPager.OVER_SCROLL_NEVER); mViewPager.setOffscreenPageLimit(3); }
From source file:com.heyzap.http.SDKCookieStore.java
/** * Construct a persistent cookie store.// w w w.ja v a2s .c om */ public SDKCookieStore(Context context) { cookiePrefs = context.getSharedPreferences(COOKIE_PREFS, Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE); cookies = new ConcurrentHashMap<String, Cookie>(); this.context = context; addCookies(HeyzapCookies.getCookie(context)); }
From source file:Main.java
static void createOptOut(Context context, boolean optedOut) { FileOutputStream stream = null; try {/*w w w .j ava2 s . c o m*/ stream = context.openFileOutput(QCMEASUREMENT_OPTOUT_STRING, Context.MODE_WORLD_WRITEABLE | Context.MODE_WORLD_READABLE); stream.write(optedOut ? 1 : 0); } catch (Exception ignored) { } finally { try { if (stream != null) { stream.close(); } } catch (IOException ignored) { } } }