Kasım, 2017 tarihine ait yayınlar gösteriliyor

sample activity in android

package com.example.android.sunshine; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; import com.example.android.sunshine.data.SunshinePreferences; import com.example.android.sunshine.utilities.NetworkUtils; import com.example.android.sunshine.utilities.OpenWeatherJsonUtils; import java.net.URL; public class MainActivity extends AppCompatActivity { private TextView mWeatherTextView ; // TODO (6) Add a TextView variable for the error message display private TextView errorTextView ; // TODO (16) Add a ProgressBar variable to show and hide the progress bar private ProgressBar progressBar ; @Override protected void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContent

Override onCreateOptionsMenu to inflate the menu for the Activity

Override onCreateOptionsMenu to inflate the menu for the Activity @Override public boolean onCreateOptionsMenu(Menu menu) { /* Use AppCompatActivity's method getMenuInflater to get a handle on the menu inflater */ MenuInflater inflater = getMenuInflater(); /* Use the inflater's inflate method to inflate our menu layout to this menu */ inflater.inflate(R.menu. forecast ,menu); /* Return true so that the menu is displayed in the Toolbar */ return true ; }

Github query URL (using Uri) and get the response data in Android

/* These utilities will be used to communicate with the network.*/ public class NetworkUtils { final static String GITHUB_BASE_URL = "https://api.github.com/search/repositories" ; final static String PARAM_QUERY = "q" ; /** The sort field. Default: results are sorted by best match * if no field is specified. */ final static String PARAM_SORT = "sort" ; final static String sortBy = "stars" ; /** * Builds the URL used to query Github. * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the weather server. */ public static URL buildUrl(String githubSearchQuery) { // To build the proper Github query URL Uri builtUri = Uri. parse ( GITHUB_BASE_URL ) .buildUpon() .appendQueryParameter( PARAM_QUERY ,githubSearchQuery) .appendQueryPara

Some Python Commands

Installation virtual environment for Python project D:\ProgramFiles\Python34> virtualenv projeName New python executable in D:\ProgramFiles\Python34\projeName\Scripts\python.exe Installing setuptools, pip, wheel...done. Activate virtual environment D:\ProgramFiles\Python34>cd  projeName D:\ProgramFiles\Python34\projeName>cd Scripts D:\ProgramFiles\Python34\ projeName \Scripts> activate ( projeName ) D:\ProgramFiles\Python34\ projeName \Scripts> Install a specific version of setup tools in python pip install setuptools==36.0.1 Update pip  pip install -U pip List installed plugins pip list

Android Resource Directories

Some Common Resource Types Name What's Stored Here values XML files that contain simple values, such as string or integers drawable A bunch of visual files, including Bitmap file types and shapes. More information is  here layouts XML layouts for your app Other Resource Types Name What's stored here animator XML files for property animations anim XML files for tween animations color XML files that define state list colors mipmap Drawable files for launcher icons menu XML files that define application menus raw Resource file for arbitrary files saved in their raw form. For example, you could put audio files here. (You might also be interested in the  assets folder , depending on how you use that audio) xml Arbitrary XML; if you have XML configuration files, this is a good place to put them More information

In terms of increasing verboseness in severity in Android Log.

WTF-> Error->Warn-> Info-> Debug->Verbose WTF (What a Terrible Failure) level is for errors that should never, ever happen. Most developers should never, ever use it.

About Android padding, margin, width, height, wrap_content, match_parent, R Class

Padding and Margin padding  and  layout_margin  are two very similar attributes. Both determine the space around a View. The difference is that  padding  determines space within the boundaries of the view, and  layout_margin  determines the space outside the boundaries of the view. Width and Height Some of the most important properties are the width property and height property - those must be defined for every view. Remember that all views occupy a rectangular area on the screen - the width and height are the width and height of that area. You can define this in pixels, or better yet dp (stands for density-independent pixels): android:layout_width="200dp" android:layout_height="300dp" For the sake of having a layout be responsive and adjust to different devices, two common values are not numbers at all, but  wrap_content  and  match_parent  used as shown here: android:layout_width="wrap_content" android:layout_height="match_parent"

Ctrl Alt Delete Function in Remote Desktop

Just Ctrl + Ins :)

Ubuntu useful terminal commands

* restart sudo reboot sudo shutdown -r now * download a file wget url with output file wget  -O /home/omio/Desktop/ "url" After "apt-get install filezilla" I got an error.   dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem..  "It is called when packages are broken, or the package installation is interrupted."  To solve type "dpkg --configure -a", you can type again "apt-get install filezilla", it should work. * list apps (Ubuntu 14.04 above)  apt list --installed * remove an app sudo apt-get remove <application_name> * VSFTPD, stands for Very Secure File Transfer Protocol Daemon sudo apt-get install vsftpd * learn ubuntu version lsb_release -a *add a new user adduser username * format a drive mkfs -t ext4 /dev/xvde * list mounted and unmounted partitions blkid -o list device     fs_type label    mount point    UUID --------------------------------

Start your android app from the command line

 Start your android app from the command line, you could type: adb shell am start -n com.package.name/com.package.name.ActivityName

Show Task in Gradle from command line in the Android Project

Gradle from the Command Line Run gradle build tasks from the command line if you prefer. To start, you should navigate to the root of your project folder. From there you can run: ./gradlew tasks This will give you a full list of runnable tasks. You may need to run chmod +x on gradlew before you can run it.