@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.line_list); // Setup the list adapter = new IconAdapter<FileWrapper>(this, R.layout.line_list_item); ListView list = (ListView) findViewById(R.id.list); list.setAdapter(adapter); list.setOnItemClickListener(this); // Load Directory if (savedInstanceState != null) { backStack = savedInstanceState.getParcelableArrayList("BACKSTACK"); } if (backStack == null || backStack.size() == 0) { backStack = new ArrayList<BackStackItem>(); String startPath = (startDirectory == null || startDirectory.isEmpty()) ? Environment.getExternalStorageDirectory().getPath() : startDirectory; backStack.add(new BackStackItem(startPath, false)); } wrapFiles(); this.setVolumeControlStream(AudioManager.STREAM_MUSIC); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); textView = new TextView(this); textView.setText("Toca y arrastra (solo un dedo)"); textView.setOnTouchListener(this); setContentView(textView); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // remove title requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main_game); allDoneLevels = new ArrayList<>(); AssetManager am = getResources().getAssets(); final GameBoard boardView = (GameBoard) this.findViewById(R.id.gameBoard); final HowdyShadeView howdyShadeView = (HowdyShadeView) this.findViewById(R.id.howdyShadeView); final GlowingBoard glowingBoard = (GlowingBoard) this.findViewById(R.id.glowingBoard); final HowdyView howdyView = (HowdyView) this.findViewById(R.id.howdyView); this.game = new Game(); boardView.setHowdyShadeView(howdyShadeView); boardView.setGlowingBoard(glowingBoard); boardView.setHowdyView(howdyView); boardView.setOnTouchListener(new BoardGameTouchListener(this)); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { // We can read and write the media try { url = (String) getIntent().getExtras().get(Intent.EXTRA_TEXT) + "#view:list"; } catch (Exception e) { url = "https://www.dropbox.com/s/8owsfcia59ko76i#view:list"; // Used for testing if it's not opened from the dropox action menu // Obviously what needs to happen here is a message suggesting that the user use the dropbox // app, and a textbox in case they've got the url copied. } showDialog( PROGRESS_DIALOG); // Do the work in a separate thread so we can update the UI // simultaneously. } else { // Can't write files, so show a message and quit. } }
/** Called when the activity is first created */ @Override public void onCreate(Bundle savedInstanceState) { Log.d(TAG, "LoaderActivity created"); super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.content); // Instantiate custom adapter mAdapter = new LoaderAdapter(); // Handle listview and assign adapter mListView = (ListView) findViewById(R.id.content_list_view); mListView.setAdapter(mAdapter); mListView.setVisibility(View.GONE); mListView.setOnItemLongClickListener( new AdapterView.OnItemLongClickListener() { public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { selectItem(position); return true; } }); mStatusLabel = (TextView) findViewById(R.id.content_status_label); mStatusLabel.setVisibility(View.VISIBLE); String userHash = NavigineApp.Settings.getString("user_hash", ""); if (userHash.length() == 0) showUserHashDialog(); else refreshMapList(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); // // this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.main_login); mEtAccount = (EditText) findViewById(R.id.mainLoginEditAccount); mEtPassword = (EditText) findViewById(R.id.mainLoginEditPassword); mBtnLogin = (Button) findViewById(R.id.mainLoginBtn); mBtnRegister = (Button) findViewById(R.id.main_btn_register); /* this is to render the password edittext font to be default */ mEtPassword.setTypeface(Typeface.DEFAULT); mEtPassword.setTransformationMethod(new PasswordTransformationMethod()); mBtnLogin.setOnClickListener( new OnClickListener() { public void onClick(View v) { MainActivity.this.tryLogin(); } }); mBtnRegister.setOnClickListener( new OnClickListener() { public void onClick(View v) { Intent intent0 = new Intent(MainActivity.this, RegisterActivity.class); startActivity(intent0); } }); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Create a SQLite database holding event info DatabaseOpener dbopenhelper = new DatabaseOpener(this); db = dbopenhelper.getWritableDatabase(); setContentView(R.layout.event_list); this.lv = (ListView) findViewById(R.id.eventListView); // Subclass CursorAdapter to read data from the database into the // ListView Cursor c = db.query( "event", new String[] {"_id", "isfavorite", "name", "starttime", "endtime"}, null, null, null, null, "starttime asc"); dbadapter = new EventListCursorAdapter(this, c, false); lv.setAdapter(dbadapter); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.detailedtask); service = AndroidCMWebService.service().userWebService(); task = getIntent().getParcelableExtra(TaskAdapter.TASK_KEY); fillInTaskInformation(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.xiph_copyright); TextView tv = (TextView) findViewById(R.id.text); tv.setText(getXiphCopyright()); tv.setMovementMethod(new ScrollingMovementMethod()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); sdk = android.os.Build.VERSION.SDK_INT; player = 1; tv = (TextView) findViewById(R.id.mainTextView); tv1 = (TextView) findViewById(R.id.mainTextViewVencedor); tv.setText("Jogador 1"); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings); this.setTitle(R.string.setting); sp = PreferenceManager.getDefaultSharedPreferences(this); edit = sp.edit(); Button widgettheme = (Button) findViewById(R.id.widgettheme); Button settime = (Button) findViewById(R.id.settime); Button save = (Button) findViewById(R.id.set_save); nc = (CheckBox) findViewById(R.id.nightcheck); rs = (CheckBox) findViewById(R.id.ringswitch); widgettheme.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View Button) { AlertDialog.Builder ad = new AlertDialog.Builder(Settings.this) .setTitle("选择颜色?") .setItems( color, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface p1, int p2) { edit.putInt("widgetTextColor", colori[p2]); edit.commit(); } }); ad.show(); } }); settime.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View Button) { Intent set = new Intent(Settings.this, Settime.class); startActivity(set); return; } }); save.setOnClickListener( new View.OnClickListener() { public void onClick(View Button) { save(); return; } }); nc.setChecked(sp.getBoolean("nightmode", false)); if (sp.getBoolean("timewrong", false) == true) { rs.setChecked(false); rs.setClickable(false); } }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.data_callwordcp); mText = (EditText) findViewById(R.id.edittext); findViewById(R.id.readall).setOnClickListener(mClickListener); findViewById(R.id.readone).setOnClickListener(mClickListener); findViewById(R.id.insert).setOnClickListener(mClickListener); findViewById(R.id.delete).setOnClickListener(mClickListener); findViewById(R.id.update).setOnClickListener(mClickListener); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.codelayout); LinearLayout MyLinear = (LinearLayout) findViewById(R.id.mylinear); MyLinear.setOrientation(LinearLayout.HORIZONTAL); Button MyBtn = (Button) findViewById(R.id.mybutton); MyBtn.setTextSize(40); EditText MyEdit = (EditText) findViewById(R.id.myedit); MyEdit.setBackgroundColor(0xff00ff00); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.input_contextmenu); mBtn = (Button) findViewById(R.id.button); registerForContextMenu(mBtn); mEdit = (EditText) findViewById(R.id.edittext); registerForContextMenu(mEdit); mImage = (MyImage) findViewById(R.id.myimage); registerForContextMenu(mImage); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.c09_overscroll); for (int i = 1001; i <= 1003; i++) { mItem.add(Integer.toString(i)); } mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mItem); mList = (ListView) findViewById(R.id.list); mList.setAdapter(mAdapter); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ac_loading); getWindow().setFormat(PixelFormat.RGBA_8888); mPref = new Manage_Camera_SharedPreference(AC_Loading.this); loadingIconLayout = (ImageView) findViewById(R.id.loadingIcon); cTimer.start(); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.c19_sdcard); mEdit = (EditText) findViewById(R.id.edittext); String ext = Environment.getExternalStorageState(); if (ext.equals(Environment.MEDIA_MOUNTED)) { mSdPath = Environment.getExternalStorageDirectory().getAbsolutePath(); } else { mSdPath = Environment.MEDIA_UNMOUNTED; } }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.addprescription); add = (Button) findViewById(R.id.pAdd); timeTTWidget = (TimePicker) findViewById(R.id.timePicker); mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); provider = mLocationManager.getBestProvider(criteria, false); Location location = mLocationManager.getLastKnownLocation(provider); latitude = location.getLatitude(); longitude = location.getLongitude(); add.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { name = (EditText) findViewById(R.id.pName); hour = timeTTWidget .getCurrentHour(); // returns int from 0-23 (24 hour clock), no need to worry // about am or pm minute = timeTTWidget.getCurrentMinute(); reason = (EditText) findViewById(R.id.pFor); boolean[] daysOfWeekToTake = { ((CheckBox) findViewById(R.id.sunday)).isChecked(), ((CheckBox) findViewById(R.id.monday)).isChecked(), ((CheckBox) findViewById(R.id.tuesday)).isChecked(), ((CheckBox) findViewById(R.id.wednesday)).isChecked(), ((CheckBox) findViewById(R.id.thursday)).isChecked(), ((CheckBox) findViewById(R.id.friday)).isChecked(), ((CheckBox) findViewById(R.id.saturday)).isChecked(), }; prescription_name = name.getText().toString(); prescription_sickness = reason.getText().toString(); EditText notesWidget = (EditText) findViewById(R.id.notes); String notes = notesWidget.getText().toString(); String daysString = booleanArrToStr( daysOfWeekToTake); // For some reason, cant store a boolean[] in a ParseObject, // so I created a method to convert boolean[] to a string of // 0s and 1s parsePrescription( daysString, prescription_name, prescription_sickness, notes, hour, minute); parseOutbreak(prescription_sickness, latitude, longitude); finish(); } }); }
@Override public void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate"); super.onCreate(savedInstanceState); Thread.currentThread().setUncaughtExceptionHandler(this); setContentView(R.layout.main); inputView = (EditText) findViewById(R.id.input_view); inputView.setOnEditorActionListener(this); listAdapter = new ArrayAdapter<String>(this, R.layout.row); listAdapter.setNotifyOnChange(true); resultsView = (ListView) this.findViewById(R.id.results_view); resultsView.setAdapter(listAdapter); resultsView.setOnItemClickListener(this); }
@Override public void onCreate(Bundle savedInstanceState) { c = this; preferences = PreferenceManager.getDefaultSharedPreferences(c); super.onCreate(savedInstanceState); setContentView(R.layout.gpu_sgx540); gpuCurrent = readFile(Constants.GPU_SGX540); seekGpu = (SeekBar) findViewById(R.id.seek_gpu); gpu = Arrays.asList(153, 307, 384); seekBar(gpu.size() - 1, gpu.indexOf(gpuCurrent)); /*else{ seekGpu.setEnabled(false); seekIva.setEnabled(false); TextView ns = (TextView)findViewById(R.id.not_supported); ns.setVisibility(View.VISIBLE); }*/ preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); curGpuTxt = (TextView) findViewById(R.id.current_gpu); maxGpuTxt = (TextView) findViewById(R.id.max_gpu); minGpuTxt = (TextView) findViewById(R.id.min_gpu); mhz = getResources().getString(R.string.mhz); current = getResources().getString(R.string.current); max = getResources().getString(R.string._max); min = getResources().getString(R.string._min); curGpuTxt.setText(current + ": " + (gpuCurrent) + mhz); maxGpuTxt.setText(max + ": " + gpu.get(2) + mhz); minGpuTxt.setText(min + ": " + gpu.get(0) + mhz); Button cancel = (Button) findViewById(R.id.cancel); cancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { finish(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); drawView = (DrawingView) findViewById(R.id.drawing); smallBrush = getResources().getInteger(R.integer.small_size); mediumBrush = getResources().getInteger(R.integer.medium_size); largeBrush = getResources().getInteger(R.integer.large_size); drawBtn = (ImageButton) findViewById(R.id.draw_btn); drawBtn.setOnClickListener(this); drawView.setBrushSize(mediumBrush); eraseBtn = (ImageButton) findViewById(R.id.erase_btn); eraseBtn.setOnClickListener(this); newBtn = (ImageButton) findViewById(R.id.new_btn); newBtn.setOnClickListener(this); equalsBtn = (ImageButton) findViewById(R.id.equals_btn); equalsBtn.setOnClickListener(this); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dialog_showdialog); Button btn = (Button) findViewById(R.id.call); btn.setOnClickListener( new Button.OnClickListener() { public void onClick(View v) { showDialog(SampleDialog); } }); Button btn2 = (Button) findViewById(R.id.call2); btn2.setOnClickListener( new Button.OnClickListener() { public void onClick(View v) { showDialog(QuestionDialog); } }); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.receiver); final Button cancelbtn = (Button) findViewById(R.id.ButtonCancel); // cancelbtn.setEnabled(false); cancelbtn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // streamtask.cancel(true); finish(); } }); try { Intent intent = getIntent(); String action = intent.getAction(); String type = intent.getType(); if ((!(Intent.ACTION_SEND.equals(action))) || (type == null)) { throw new RuntimeException("Unknown intent action or type"); } if (!("text/plain".equals(type))) { throw new RuntimeException("Type is not text/plain"); } String extra = intent.getStringExtra(Intent.EXTRA_TEXT); if (extra == null) { throw new RuntimeException("Cannot get shared text"); } final DownloadStreamTask streamtask = new DownloadStreamTask(this); // Once created, a task is executed very simply: streamtask.execute(extra); } catch (Exception e) { Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show(); } }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); helper = new dbHelper(this); try { db = helper.getWritableDatabase(); } catch (SQLiteException ex) { db = helper.getReadableDatabase(); } edit_name = (EditText) findViewById(R.id.name); edit_tel = (EditText) findViewById(R.id.tel); findViewById(R.id.add) .setOnClickListener( new View.OnClickListener() { public void onClick(View v) { String name = edit_name.getText().toString(); String tel = edit_tel.getText().toString(); db.execSQL("INSERT INTO contact VALUES (null, '" + name + "', '" + tel + "');"); } }); findViewById(R.id.query) .setOnClickListener( new View.OnClickListener() { public void onClick(View v) { String name = edit_name.getText().toString(); Cursor cursor; cursor = db.rawQuery("SELECT name, tel FROM contact WHERE name='" + name + "';", null); while (cursor.moveToNext()) { String tel = cursor.getString(1); edit_tel.setText(tel); } } }); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); View vw = new MyView(this); setContentView(vw); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { mAppContext = this; mMainHandler = new Handler(); if (!sTryCatchAttached) { sTryCatchAttached = true; mMainHandler.post( new Runnable() { public void run() { try { Looper.loop(); } catch (Exception e) { Log.e(LOG_FILE_NAME, "top level exception", e); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); pw.flush(); GeckoAppShell.reportJavaCrash(sw.toString()); } // resetting this is kinda pointless, but oh well sTryCatchAttached = false; } }); } SharedPreferences settings = getPreferences(Activity.MODE_PRIVATE); String localeCode = settings.getString(getPackageName() + ".locale", ""); if (localeCode != null && localeCode.length() > 0) GeckoAppShell.setSelectedLocale(localeCode); Log.i(LOG_FILE_NAME, "create"); super.onCreate(savedInstanceState); if (sGREDir == null) sGREDir = new File(this.getApplicationInfo().dataDir); getWindow() .setFlags( mFullscreen ? WindowManager.LayoutParams.FLAG_FULLSCREEN : 0, WindowManager.LayoutParams.FLAG_FULLSCREEN); if (cameraView == null) { cameraView = new SurfaceView(this); cameraView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } if (surfaceView == null) surfaceView = new GeckoSurfaceView(this); else mainLayout.removeAllViews(); mainLayout = new AbsoluteLayout(this); mainLayout.addView( surfaceView, new AbsoluteLayout.LayoutParams( AbsoluteLayout.LayoutParams.MATCH_PARENT, // level 8 AbsoluteLayout.LayoutParams.MATCH_PARENT, 0, 0)); setContentView( mainLayout, new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); mConnectivityFilter = new IntentFilter(); mConnectivityFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mConnectivityReceiver = new GeckoConnectivityReceiver(); IntentFilter batteryFilter = new IntentFilter(); batteryFilter.addAction(Intent.ACTION_BATTERY_CHANGED); mBatteryReceiver = new GeckoBatteryManager(); registerReceiver(mBatteryReceiver, batteryFilter); if (SmsManager.getInstance() != null) { SmsManager.getInstance().start(); } GeckoNetworkManager.getInstance().init(); if (!checkAndSetLaunchState(LaunchState.PreLaunch, LaunchState.Launching)) return; checkAndLaunchUpdate(); mLibLoadThread = new Thread( new Runnable() { public void run() { // At some point while loading the gecko libs our default locale gets set // so just save it to locale here and reset it as default after the join Locale locale = Locale.getDefault(); GeckoAppShell.loadGeckoLibs(getApplication().getPackageResourcePath()); Locale.setDefault(locale); Resources res = getBaseContext().getResources(); Configuration config = res.getConfiguration(); config.locale = locale; res.updateConfiguration(config, res.getDisplayMetrics()); } }); mLibLoadThread.start(); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.c16_longtime); mText = (TextView) findViewById(R.id.text); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.profile); findViews(); /*Select Category work */ final String[] categories = getIntent().getStringArrayExtra("Options"); ArrayAdapter<String> catadapt; catadapt = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, categories); mCatSpin.setAdapter(catadapt); mCatSpin.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View v, int pos, long id) { mChosenCategory = categories[pos]; } public void onNothingSelected(AdapterView<?> parent) {} }); /*Availability selection work*/ mAvail = (Button) findViewById(R.id.editavail); mAvail.setOnClickListener(this); /*Submit/Back button work*/ mSub = (Button) findViewById(R.id.submitbutton); mSub.setOnClickListener(this); mBack.setOnClickListener(this); /*Web View & Camera uploader work*/ openCam.setOnClickListener(this); openWeb.setOnClickListener(this); web.getSettings().setJavaScriptEnabled(true); web.loadUrl("http://www.monkbananas.com/uploader/index.php"); // ------Everything below this line was found on StackOverflow-------------------- web.setWebChromeClient( new WebChromeClient() { @Override public boolean shouldOverrideUrlLoading(WebView v, String url) { web.loadUrl(url); return true; } // The undocumented magic method override // Eclipse will swear at you if you try to put @Override here // For Android 3.0+ public void openFileChooser(ValueCallback<Uri> uploadMsg) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("image/*"); startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); } // For Android 3.0+ public void openFileChooser(ValueCallback uploadMsg, String acceptType) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE); } // For Android 4.1 public void openFileChooser( ValueCallback<Uri> uploadMsg, String acceptType, String capture) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("image/*"); startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); } }); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.copyintent); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); }