@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.list_item_icon, parent, false); TextView textView = (TextView) rowView.findViewById(R.id.label); ImageView imageView = (ImageView) rowView.findViewById(R.id.icon); textView.setText(mValues[position]); // Set icons String s = mValues[position]; if (s.equals("CPU")) { imageView.setImageResource(R.drawable.ic_drawer_cpu); } else if (s.equals("System")) { imageView.setImageResource(R.drawable.ic_drawer_system); } else if (s.equals("Disks")) { imageView.setImageResource(R.drawable.ic_drawer_disks); } else if (s.equals("Processes")) { imageView.setImageResource(R.drawable.ic_drawer_processes); } else if (s.equals("GPU")) { imageView.setImageResource(R.drawable.ic_drawer_gpu); } else if (s.equals("Overview")) { imageView.setImageResource(R.drawable.ic_drawer_overview); } else if (s.equals("History")) { imageView.setImageResource(R.drawable.ic_drawer_history); } else if (s.equals("Notifications")) { imageView.setImageResource(R.drawable.ic_drawer_notifications); } imageView.setContentDescription(s + " icon"); return rowView; }
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 public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mListView = (ListView) mView.findViewById(R.id.lv); mListView.setOnScrollListener( new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { PullRightLayout.collapseAll(); } } @Override public void onScroll( AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {} }); mStartScanView = (TextView) mView.findViewById(R.id.tv_start_scan); mStartScanView.setBackgroundColor(ThemeManager.with(getActivity()).getCurrentColor()); mStartScanView.setOnClickListener(this); mPullLayout = (PullLayout) mView.findViewById(R.id.pull_layout); mPullLayout.addOnPullListener(this); if (mListener != null) { mPullLayout.addOnPullListener(mListener); mListener = null; } mIvScan = (ImageView) mView.findViewById(R.id.iv_scan); IntentFilter filter = new IntentFilter(ScanService.ACTION_SCAN_FINISH); LocalBroadcastManager.getInstance(getActivity()).registerReceiver(receiver, filter); }
private void setState(State state) { this.state = state; switch (state) { case PULL_TO_REFRESH: spinner.setVisibility(View.INVISIBLE); image.setVisibility(View.VISIBLE); text.setText(pullToRefreshText); if (showLastUpdatedText && lastUpdated != -1) { lastUpdatedTextView.setVisibility(View.VISIBLE); lastUpdatedTextView.setText( String.format(lastUpdatedText, lastUpdatedDateFormat.format(new Date(lastUpdated)))); } break; case RELEASE_TO_REFRESH: spinner.setVisibility(View.INVISIBLE); image.setVisibility(View.VISIBLE); text.setText(releaseToRefreshText); break; case REFRESHING: setUiRefreshing(); lastUpdated = System.currentTimeMillis(); if (onRefreshListener == null) { setState(State.PULL_TO_REFRESH); } else { onRefreshListener.onRefresh(); } break; } }
@Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (BluetoothLeService.ACTION_GATT_CONNECTED.equals(action)) { mConnected = true; updateConnectionState(R.string.connected); invalidateOptionsMenu(); } else if (BluetoothLeService.ACTION_GATT_DISCONNECTED.equals(action)) { mConnected = false; updateConnectionState(R.string.disconnected); invalidateOptionsMenu(); } else if (BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) { BluetoothGattService gattService = mBluetoothLeService.getSoftSerialService(); characteristicTX = gattService.getCharacteristic(BluetoothLeService.UUID_HM_RX_TX); // characteristicRX = gattService.getCharacteristic(BluetoothLeService.UUID_HM_RX_TX); characteristicRX = characteristicTX; if ((gattService != null) && (characteristicTX != null)) { mBluetoothLeService.setCharacteristicNotification(characteristicTX, true); isSerial.setText("Serial ready"); updateReadyState(R.string.ready); } else { isSerial.setText("Serial can't be found"); } } else if (BluetoothLeService.ACTION_DATA_AVAILABLE.equals(action)) { displayData(intent.getStringExtra(mBluetoothLeService.EXTRA_DATA)); } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.estadistica_view, container, false); int idEstadistica = this.mPageNumber; // Titulo y descripcion de estadistica TextView tituloEstadistica = (TextView) rootView.findViewById(R.id.TxtTituloEstadistica); TextView descEstadistica = (TextView) rootView.findViewById(R.id.TxtDescEstadistica); tituloEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getTitulo()); descEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getDescripcion()); rootView.addView( new EstadisticaViewLayout(Utilidades.getAppContext()) .getView(RelacionEstadisticas.getRelacion().get(idEstadistica))); // } // catch (Exception e) // { // Toast.makeText(Utilidades.getAppContext(), "error: " + e.getLocalizedMessage(), // Toast.LENGTH_LONG).show(); // Log.e("ERROR", e.getLocalizedMessage()); // } // Set the title view to show the page number. /*((TextView) rootView.findViewById(android.R.id.text1)).setText( getString(R.string.title_template_step, mPageNumber + 1));*/ return rootView; }
private void initPagerItems() { for (int i = 0; i < bitmapList.size(); i++) { View v = LayoutInflater.from(this).inflate(R.layout.call_activity_itempage, null); ImageView imageView = (ImageView) v.findViewById(R.id.contactIv); TextView textView = (TextView) v.findViewById(R.id.contactTv); imageView.setImageBitmap(bitmapList.get(i)); textView.setText(nameList.get(i)); viewArrayList.add(v); } }
private View getEmptyView() { if (mEmptyRoot == null) { mEmptyRoot = mView.findViewById(R.id.empty_root); ImageView mIvEmpty = (ImageView) mView.findViewById(R.id.iv_empty); TextView mTvEmpty = (TextView) mView.findViewById(R.id.tv_empty); mIvEmpty.setImageResource(R.drawable.hand); mTvEmpty.setText("下拉扫描新歌曲"); } return mEmptyRoot; }
public View getView(int position, View convertView, ViewGroup parent) { final View view = (convertView != null) ? convertView : LayoutInflater.from(parent.getContext()) .inflate(R.layout.bookmark_item, parent, false); final ImageView imageView = (ImageView) view.findViewById(R.id.bookmark_item_icon); final TextView textView = (TextView) view.findViewById(R.id.bookmark_item_text); final TextView bookTitleView = (TextView) view.findViewById(R.id.bookmark_item_booktitle); final Bookmark bookmark = getItem(position); if (bookmark == null) { imageView.setVisibility(View.VISIBLE); imageView.setImageResource(R.drawable.ic_list_plus); textView.setText(ZLResource.resource("bookmarksView").getResource("new").getValue()); bookTitleView.setVisibility(View.GONE); } else { imageView.setVisibility(View.GONE); textView.setText(bookmark.getText()); if (myCurrentBook) { bookTitleView.setVisibility(View.GONE); } else { bookTitleView.setVisibility(View.VISIBLE); bookTitleView.setText(bookmark.getBookTitle()); } } return view; }
public void onFileName(String newFileName) { if (newFileName == null || newFileName.length() <= 0) { return; } TextView txtFilename = (TextView) findViewById(R.id.txtFileName); if (AppSettings.shouldLogToGpx() || AppSettings.shouldLogToKml()) { txtFilename.setText( getString(R.string.summary_current_filename_format, Session.getCurrentFileName())); } else { txtFilename.setText(""); } }
@Override public void onClick(View view) { if (view.getId() == R.id.button1) { // textView.setText(getString(R.string.cambiar_texto)); textView.setText(R.string.cambiar_texto); } }
/* Scan the files in the new directory, and store them in the filelist. * Update the UI by refreshing the list adapter. */ private void loadDirectory(String newdirectory) { if (newdirectory.equals("../")) { try { directory = new File(directory).getParent(); } catch (Exception e) { } } else { directory = newdirectory; } SharedPreferences.Editor editor = getPreferences(0).edit(); editor.putString("lastBrowsedDirectory", directory); editor.commit(); directoryView.setText(directory); filelist = new ArrayList<FileUri>(); ArrayList<FileUri> sortedDirs = new ArrayList<FileUri>(); ArrayList<FileUri> sortedFiles = new ArrayList<FileUri>(); if (!newdirectory.equals(rootdir)) { String parentDirectory = new File(directory).getParent() + "/"; Uri uri = Uri.parse("file://" + parentDirectory); sortedDirs.add(new FileUri(uri, parentDirectory)); } try { File dir = new File(directory); File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file == null) { continue; } String filename = file.getName(); if (file.isDirectory()) { Uri uri = Uri.parse("file://" + file.getAbsolutePath() + "/"); FileUri fileuri = new FileUri(uri, uri.getPath()); sortedDirs.add(fileuri); } else if (filename.endsWith(".mid") || filename.endsWith(".MID") || filename.endsWith(".midi") || filename.endsWith(".MIDI")) { Uri uri = Uri.parse("file://" + file.getAbsolutePath()); FileUri fileuri = new FileUri(uri, uri.getLastPathSegment()); sortedFiles.add(fileuri); } } } } catch (Exception e) { } if (sortedDirs.size() > 0) { Collections.sort(sortedDirs, sortedDirs.get(0)); } if (sortedFiles.size() > 0) { Collections.sort(sortedFiles, sortedFiles.get(0)); } filelist.addAll(sortedDirs); filelist.addAll(sortedFiles); adapter = new IconArrayAdapter<FileUri>(this, android.R.layout.simple_list_item_1, filelist); this.setListAdapter(adapter); }
@Override public void onThemeChange(int color) { mStartScanView.setBackgroundColor(color); if (mSongAdapter != null) { mSongAdapter.notifyDataSetChanged(); } }
@Override public boolean onTouch(View v, MotionEvent event) { builder.setLength(0); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: builder.append("down, "); break; case MotionEvent.ACTION_MOVE: builder.append("move, "); break; case MotionEvent.ACTION_CANCEL: builder.append("cancel, "); break; case MotionEvent.ACTION_UP: builder.append("up, "); break; } builder.append(event.getX()); builder.append(", "); builder.append(event.getY()); String text = builder.toString(); Log.d("TouchTest", text); textView.setText(text); return true; }
/** 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(); }
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.terciaria); Intent i = getIntent(); double raizPotencia = i.getDoubleExtra("raizPotencia", 0.00); btnVoltar = (Button) findViewById(R.id.btnVoltar); btnVoltar.setOnClickListener(this); double raiz = Math.sqrt(raizPotencia); double potencia = Math.pow(raizPotencia, 2); TextView txtRaiz = (TextView) findViewById(R.id.resRaiz); txtRaiz.setText(String.valueOf(raiz)); // TextView txtPotencia = (TextView) findViewById(R.id.resPotencia); txtPotencia.setText(String.valueOf(potencia)); }
@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(); } }); }
public void restartGame(View v) { for (int i = 1; i <= 9; i++) { View mainView = findViewById( getResources() .getIdentifier("mainView" + Integer.toString(i), "id", getPackageName())); if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) { mainView.setBackgroundDrawable(getResources().getDrawable(R.drawable.empty)); } else { mainView.setBackground(getResources().getDrawable(R.drawable.empty)); } player = 1; matriz = new int[3][3]; tv.setText("Jogador 1"); tv1.setText(""); vencedor = false; } }
private void showDeleteDialog() { Log.d(TAG, "showDeleteDialog() called"); final Dialog deleteDialog = new Dialog(NoteActivity.this); LinearLayout dialogLayout = (LinearLayout) View.inflate(NoteActivity.this, R.layout.delete_note_dialog, null); deleteDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); deleteDialog.setContentView(dialogLayout); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(deleteDialog.getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.MATCH_PARENT; deleteDialog.show(); deleteDialog.getWindow().setAttributes(lp); TextView noteTitleTextView = (TextView) dialogLayout.findViewById(R.id.delete_note_dialog_delete_note_title_textview); noteTitleTextView.setText(note.getTitle()); Button confirmDeleteButton = (Button) dialogLayout.findViewById(R.id.delete_note_dialog_confirm_button); confirmDeleteButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "Delete dialog confirm button clicked"); noteProvider.deleteNote(note); finish(); } }); Button cancelDeleteButton = (Button) dialogLayout.findViewById(R.id.delete_note_dialog_cancel_button); cancelDeleteButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "Delete dialog cancel button clicked"); deleteDialog.dismiss(); } }); }
public void run() { /* * If values are not default, then we have values to calculate MPG */ Log.d(TAG, "SPD:" + speed + ", MAF:" + maf + ", LTFT:" + ltft); if (speed > 1 && maf > 1 && ltft != 0) { FuelEconomyWithMAFObdCommand fuelEconCmd = new FuelEconomyWithMAFObdCommand( FuelType.DIESEL, speed, maf, ltft, false /* TODO */); TextView tvMpg = (TextView) findViewById(R.id.fuel_econ_text); String liters100km = String.format("%.2f", fuelEconCmd.getLitersPer100Km()); tvMpg.setText("" + liters100km); Log.d(TAG, "FUELECON:" + liters100km); } if (mServiceConnection.isRunning()) queueCommands(); // run again in 2s mHandler.postDelayed(mQueueCommands, 2000); }
@Override public boolean onTouch(View view, MotionEvent event) { String str = null; int i = 0; str = "x=" + event.getX(i) / view.getMeasuredWidth() + ",y=" + event.getY(i) / view.getMeasuredHeight(); textView.setText(str); return false; }
@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"); }
private void addTableRow(String key, String val) { TableLayout tl = (TableLayout) findViewById(R.id.data_table); TableRow tr = new TableRow(this); MarginLayoutParams params = new MarginLayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.setMargins(TABLE_ROW_MARGIN, TABLE_ROW_MARGIN, TABLE_ROW_MARGIN, TABLE_ROW_MARGIN); tr.setLayoutParams(params); tr.setBackgroundColor(Color.BLACK); TextView name = new TextView(this); name.setGravity(Gravity.RIGHT); name.setText(key + ": "); TextView value = new TextView(this); value.setGravity(Gravity.LEFT); value.setText(val); tr.addView(name); tr.addView(value); tl.addView( tr, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); /* * TODO remove this hack * * let's define a limit number of rows */ if (tl.getChildCount() > 10) tl.removeViewAt(0); }
private void updateLoader() { if (NavigineApp.Navigation == null) return; // Log.d(TAG, String.format(Locale.ENGLISH, "Update loader: %d", mLoader)); long timeNow = DateTimeUtils.currentTimeMillis(); if (mLoader < 0) return; int status = LocationLoader.checkLocationLoader(mLoader); if (status < 100) { if ((Math.abs(timeNow - mLoaderTime) > LOADER_TIMEOUT / 3 && status == 0) || (Math.abs(timeNow - mLoaderTime) > LOADER_TIMEOUT)) { mListView.setVisibility(View.GONE); mStatusLabel.setVisibility(View.VISIBLE); mStatusLabel.setText("Loading timeout!\nPlease, check your internet connection!"); Log.d(TAG, String.format(Locale.ENGLISH, "Load stopped on timeout!")); LocationLoader.stopLocationLoader(mLoader); mLoader = -1; } else { mListView.setVisibility(View.GONE); mStatusLabel.setVisibility(View.VISIBLE); mStatusLabel.setText(String.format(Locale.ENGLISH, "Loading content (%d%%)", status)); } } else { Log.d(TAG, String.format(Locale.ENGLISH, "Load finished with result: %d", status)); LocationLoader.stopLocationLoader(mLoader); mLoader = -1; if (status == 100) { parseMapsXml(); if (mInfoList.isEmpty()) { mListView.setVisibility(View.GONE); mStatusLabel.setVisibility(View.VISIBLE); mStatusLabel.setText("No locations available"); } else { mListView.setVisibility(View.VISIBLE); mStatusLabel.setVisibility(View.GONE); } } else { mListView.setVisibility(View.GONE); mStatusLabel.setVisibility(View.VISIBLE); mStatusLabel.setText("Error loading!\nPlease, check your ID!"); } } }
private void SetBackGroundforList() { // TODO Auto-generated method stub mDownView_parent_txt1 = new TextView(activity.getApplicationContext()); RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp1.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); mDownView_parent_txt1.setId(Integer.parseInt("111111")); mDownView_parent_txt1.setLayoutParams(lp1); mDownView_parent_txt1.setGravity(Gravity.CENTER_HORIZONTAL); mDownView_parent_txt1.setText(HalfText); mDownView_parent_txt1.setWidth(textwidth2); mDownView_parent_txt1.setPadding(0, textheight / 4, 0, 0); mDownView_parent_txt1.setHeight(textheight); mDownView_parent_txt1.setBackgroundColor(Color.parseColor(FullColor)); mDownView_parent_txt1.setTextColor(Color.parseColor(TextColor)); mDownView_parent_txt1.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); mDownView_parent.addView(mDownView_parent_txt1, 0); // if(SwipeType==Double){ // mDownView_parent_txt2 = new TextView(activity.getApplicationContext()); // mDownView_parent_txt2.setId(222222); // RelativeLayout.LayoutParams lp2 =new // RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); // lp2.addRule(RelativeLayout.LEFT_OF,mDownView_parent_txt1.getId()); // mDownView_parent_txt2.setLayoutParams(lp2); // mDownView_parent_txt2.setGravity(Gravity.CENTER_HORIZONTAL); // mDownView_parent_txt2.setText(FullText); // mDownView_parent_txt2.setWidth(textwidth); // mDownView_parent_txt2.setPadding(0, textheight/4, 0, 0); // mDownView_parent_txt2.setHeight(textheight); // mDownView_parent_txt2.setBackgroundColor(Color.parseColor(FullColor)); // mDownView_parent_txt2.setTextColor(Color.parseColor(TextColor)); // mDownView_parent_txt2.setCompoundDrawablesWithIntrinsicBounds(null , // FullDrawable, null, null ); // mDownView_parent.addView(mDownView_parent_txt2, 1); // } }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.menus); String name = "Test"; String hname = "TestH"; String iday = "39"; String simpleinfo = name + "���덈뀞�섏꽭��n" + hname + " 蹂묒썝�낅땲��\n" + iday + "�쇱㎏ �낆썝以묒씠��땲��"; // TextView���쒖떆�댁쨪 �댁슜 TextView tv = (TextView) findViewById(R.id.simpleinfo); tv.setText(simpleinfo); findViewById(R.id.mystatbtn).setOnClickListener(myClickListener); findViewById(R.id.noticebtn).setOnClickListener(myClickListener); findViewById(R.id.requestbtn).setOnClickListener(myClickListener); findViewById(R.id.hospitalinfobtn).setOnClickListener(myClickListener); findViewById(R.id.qrreadbtn).setOnClickListener(myClickListener); findViewById(R.id.parentcallbtn).setOnClickListener(myClickListener); findViewById(R.id.emergencybtn).setOnClickListener(myClickListener); }
public void handleMessage(Message msg) { mValue++; mText.setText(Integer.toString(mValue)); try { Thread.sleep(50); } catch (InterruptedException e) {; } if (mValue < 100 && mQuit == false) { mProgress.setProgress(mValue); mHandler.sendEmptyMessage(0); } else { dismissDialog(0); } }
private void displayData(String data) { if (data != null) { // Log.v(TAG, "BLE Return Data : " + data); sbuffer.append(data); if (data.endsWith("\n")) { String tmp = sbuffer.toString(); if (tmp.startsWith("q")) { returnText.setText(tmp.substring(0, tmp.length() - 1)); onSensorChanged(tmp.substring(2)); } sbuffer = new StringBuilder(); } } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == FILECHOOSER_RESULTCODE) { // found this from StackOverflow if (null == mUploadMessage) return; Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData(); mUploadMessage.onReceiveValue(result); mUploadMessage = null; } else { // -----------I wrote this code below this line---------------------------------- jpegData = intent.getExtras().getByteArray("image"); Bitmap img = BitmapFactory.decodeByteArray(jpegData, 0, jpegData.length); Drawable d = new BitmapDrawable(img); profilePicture.setBackground(d); } }
private void playerInfo() { Player player = getGamesClient().getCurrentPlayer(); String name = player.getDisplayName(); Uri uri = player.getIconImageUri(); String displayName; if (player == null) { Log.w(TAG, "mGamesClient.getCurrentPlayer() is NULL!"); displayName = "???"; } else { displayName = player.getDisplayName(); appPreference.setLoginName(displayName); } userInfo.setText(String.format(getString(R.string.you_are_signed_in_as), displayName)); // userIcon.setImageURI(uri); }