background preloader

2015/05/16

Facebook Twitter

Select Image from gallery in Android Fragment. Fragment Gallery - Google 搜尋. Android StartActivityForResult Example. By the help of android startActivityForResult() method, we can get result from another activity.

Android StartActivityForResult Example

By the help of android startActivityForResult() method, we can send information from one activity to another and vice-versa. The android startActivityForResult method, requires a result from the second activity (activity to be invoked). In such case, we need to override the onActivityResult method that is invoked automatically when second activity returns result. Method Signature There are two variants of startActivityForResult() method. public void startActivityForResult (Intent intent, int requestCode) public void startActivityForResult (Intent intent, int requestCode, Bundle options) public void startActivityForResult (Intent intent, int requestCode) public void startActivityForResult (Intent intent, int requestCode, Bundle options)

GiveMePasS's Android惡補筆記: 如何使用startActivity與startActivityForResult. 如果想要讓一個Activity跳到另外一個Activity的話, 就可以使用Intent, 設定好要轉跳的Activity, 然後利用startActivity或者startActivityForResult來執行。

GiveMePasS's Android惡補筆記: 如何使用startActivity與startActivityForResult

先寫原始的頁面, 宣告一個EditText, 兩個Button。 然後再寫一個另外一個Activity的頁面。 跟第一個頁面相同, 兩個Button跟一個EditText。 首先定義一個方法, 當按下去的時候, 第一個按鈕會利用startActivity轉跳到另外一個Activity。 Fragment setOnClickListener startActivityForResult - Google 搜尋. Android - setOnClickListener(new OnClickListener() not working in Fragment. Fragment setOnClickListener Intent intent = new Intent(); - Google 搜尋. Android:visibility - Google 搜尋. Androider: Android 執行緒 - Runnable 與 Handler. Life Online: 【Android】ProgressDialog與Thread.

使用執行緒搭配處理中視窗。

Life Online: 【Android】ProgressDialog與Thread

部份程式運算過久的話可能會讓使用者誤會程式掛掉了,所以最好用執行緒讓它獨立執行,並搭配處理中視窗提示使用者或進一步的顯示進度。 Package iamshiao.sample; import android.app.Activity;import android.app.ProgressDialog;import android.os.Bundle; public class ProgressDialogSample extends Activity { //處理中視窗宣告 private ProgressDialog pDialog = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //設定訊息內容後顯示於前景 pDialog = ProgressDialog.show( this, this.getString(R.string.processing_title), this.getString(R.string.processing_content) ); //建構執行緒 new Thread(){ @Override public void run(){ try{ //下行為表現效果,可取代為欲執行程式。 Thread.sleep(5000); } catch (Exception e){ e.printStackTrace(); } finally{ pDialog.dismiss(); } } }.start(); //開始執行執行緒 }} pDialog取得由ProgressDialog.show產生的實體時即會在前景show出處理中視窗,你可以把這段改到任何你希望show出視窗的地方。

Felix' Space: Android Thread - 執行緒筆記. 這裡會介紹 Thread, Runnable, Handler, AsyncTask等相關的android thread class android 程式一開啟的時候,系統會創造並執行一個main thread 所有UI顯示或者widget的event都在這個thread完成,所以又叫UI thread 有時候我們需要進行一些比較花時間的運算, 為了避免UI thread的阻塞,我們必須另外使用另外一個thread來處理(worker thread) 使用thread的方法很簡單,只需要定義run()方法再叫用run()函式即可 public void onClick(View v) { new Thread() { public void run() { // do something.. } }.start(); } 為了閱讀性及彈性,Android API有另外提供一個 Runnable 的class。

Felix' Space: Android Thread - 執行緒筆記

Runnable 裡面定義了 run() function,我們僅需要把Runnable 物件丟給thread執行就可以了 就像是把工作(Runnable)交給工人(worker thread) Android Thread() 注意 - Google 搜尋. Activity Activity - Google 搜尋. 您的访问请求被拒绝 403 Forbidden - ITeye技术社区. 自学笔记:Activity的启动模式:FLAG_ACTIVITY_CLEAR_TOP和FLAG_ACTIVITY_REORDER_TO_FRONT - 天空没有痕迹但我飞过 - 51CTO技术博客. Activity中Flag的解释FLAG_ACTIVITY_SINGLE_TOP. Activity的两种启动模式:FLAG_ACTIVITY_CLEAR_TOP和FLAG_ACTIVITY_REORDER_TO_FRONT 1.

Activity中Flag的解释FLAG_ACTIVITY_SINGLE_TOP

若是已经启动了四个Activity:A,B,C和D。 在D Activity里,我们要跳到B Activity,同时欲望C finish掉,可以在startActivity(intent)里的intent里添加flags标识表记标帜,如下所示: Java代码. 自学笔记:Activity的启动模式:FLAG_ACTIVITY_CLEAR_TOP和FLAG_ACTIVITY_REORDER_TO_FRONT - 天空没有痕迹但我飞过 - 51CTO技术博客. Android - How do you use Intent.FLAG_ACTIVITY_CLEAR_TOP to clear the Activity Stack? Intent.FLAG_ACTIVITY_SINGLE_TOP) - Google 搜尋. Android getResources的作用和需要注意点 - 清沁. 读取系统资源函数getResources()小结 - 泡在网上的日子. 开发中经常用到 getResources() 函数,开始不知道如何使用 res 或者 assets 的文件,现在终于知道了其用法,记录下来以便有朋友能使用到。

读取系统资源函数getResources()小结 - 泡在网上的日子

概要说明:数据包package:android.content.res主要类:ResourcesInputStream openRawResource(int id) 获取资源的数据流,读取资源数据把一个图片资源,添加你的文件到你工程中res/drawable/目录中去,可以在代码或XML布局中,引用它也可以用资源编号,比如你选择一个文件只要去掉后缀就可以了(例如:mmm_image.png 引用它是就是mm_image)。 当需要使用的xml资源的时候,就可以使用context.getResources().getDrawable(R....资源的地址如:R.String.ok);当你方法里面没有Context参数,可以 this.getContext().getResources();这样就可以了。 下面详细说明一下使用场景: 1、需要使用getResource()的时候一定要注意 必须要有Context, 这个一般的service或者activity即带有 可以用作成员变量,构造传入或方法参数传入就可以了 2、引用xml文件时,可能通过:getResources().getXml()获的XML原始文件,然后再得到XmlResourceParser对象XmlResourceParser xrp = mRes.getXml(R.xml.personal); 而利用R....可以指定文件夹下面的某个xml文件进行加载使用 3、其它的一些文件读取方法a、把资源文件放到应用程序的/raw/raw下,那么就可以在应用中使用getResources获取资源后, 以openRawResource方法(不带后缀的资源文件名)打开这个文件. 读取系统资源函数getResources()小结 - 泡在网上的日子. Untitled. Android getResources的作用和需要注意点 - 傲慢的上校的专栏. 今天做一个Android的文件管理器,里面用到很多的地方用到了getResources。

Android getResources的作用和需要注意点 - 傲慢的上校的专栏

Drawable currentIcon = null; currentIcon = getResources().getDrawable(R.drawable.folder); currentIcon = getResources().getDrawable(R.drawable.image); 一开始不是很理解为什么用 getResources()这个方法就可以获取存在系统的资源。 于是看了一下文档和翻阅了一下资料: 例如:把资源文件放到应用程序的/raw/raw下,那么就可以在应用中使用getResources获取资源后,以openRawResource方法(不带后缀的资源文件名)打开这个文件。 例如: Resources myResources = getResources(); InputStream myFile = myResources.openRawResource(R.raw.myfilename); 和传统的java文件操作一样,在android Api中提供了openFileInput和openFileOutput方法来读取设备上的文件。 简写. Android getResources的作用和需要注意点 - 傲慢的上校的专栏. 读取系统资源函数getResources()小结 - 泡在网上的日子. 读取系统资源函数getResources()小结 - 泡在网上的日子. Untitled. Android getResources的作用和需要注意点 - 傲慢的上校的专栏. 读取系统资源函数getResources()小结 - 泡在网上的日子. 程式搖滾: Android Resources 資源檔-使用(三) ResourceID的值由兩個部份組成type(如string)與name(如hello) 取得Resource的方式一.在Java Code中使用resource 1.取得resourceID的語法為 package_name.R.resource_type.resource_name 若在自己專案內package_name可以不用寫 例 R.string.hello android.R.color.secondary_text_dark 2.取得Resource Class 利用 Context.getResources()取得Resource Class 再利用Resource提供的各項method來取得各類型的resource 3.範例 例1:

程式搖滾: Android Resources 資源檔-使用(三)

Android 关键资源的定义和使用 - 定义: <resources...

Android 关键资源的定义和使用 -

> <string-array name = "test_array"> <item>one</item> <item>two</item> <item>three</item> </string-array> </resources> <resources... ><string-array name = "test_array"><item>one</item><item>two</item><item>three</item></string-array></resources> 调用: Resources res = yourActivity.getResources(); String s[] = res.getStringArray(R.array.test_array); Resources res = yourActivity.getResources(); //yourActivity是你的Activity String s[] = res.getStringArray(R.array.test_array);

Android .Clear - Google 搜尋. 各位大虾!如何清除bitmap上已保存的图像???-CSDN论坛-CSDN.NET-中国最大的IT技术社区. Android 避免bitmap記憶體限制(轉) Android 清除 Bitmap. Android M Bitmap - Google j M. Android 清除 Bitmap - Google 搜尋. 【Android】FragmentでIdを取得する方法 - My Blog. SDK toolがバージョン22.6になり、自動生成されるファイルが増えました。

【Android】FragmentでIdを取得する方法 - My Blog

Android - How to get Activity's content view? Android - Get root view from current activity. Android rootview 取得 - Google 搜尋. Android.view. Drawable. Class Overview A Drawable is a general abstraction for "something that can be drawn. " Most often you will deal with Drawable as the type of resource retrieved for drawing things to the screen; the Drawable class provides a generic API for dealing with an underlying visual resource that may take a variety of forms. Unlike a View, a Drawable does not have any facility to receive events or otherwise interact with the user.

In addition to simple drawing, Drawable provides a number of generic mechanisms for its client to interact with what is being drawn: Android中Bitmap和Drawable. 1、Drawable就是一個可畫的對象,其可能是一張位圖(BitmapDrawable),也可能是一個圖形(ShapeDrawable),還有可能是一個圖層(LayerDrawable),我們根據畫圖的需求,創建相應的可畫對象 2、Canvas畫布,繪圖的目的區域,用於繪圖 3、Bitmap位圖,用於圖的處理 4、Matrix矩陣 二、Bitmap 1、從資源中獲取Bitmap Java代碼 1.Resources res = getResources(); 2.Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.icon); 2、Bitmap → byte[] Java代碼 1.public byte[] Bitmap2Bytes(Bitmap bm) { 2. 如何改善Bitmap所帶來的Out of Memory(OOM)問題.

我們很常使用Bitmap來存放圖片,但是常常因為檔案太大, 一不小心就跳出Out of Memory(OOM)的訊息, 對於這樣的訊息, 到目前為止, 在網路上還沒看到一個徹底解決的辦法, 大部分都是對記憶體作管理, 所以我們來討論一下目前的幾個方法。 為什麼會產生OOM的問題呢? 原因就出在Android的限制, Android是跑在手機上的作業系統, 因此我們手機上的記憶體就不可能像PC上面的記憶體一樣, 想擴增就擴增, 因此每一點一滴的記憶體我們都必須斤斤計較, 而Android的限制就是當你超過16MB的檔案, 它就會跳出OOM的警告視窗, 警告你不能使用這麼大的檔案。 從這個角度來想, 我們就有幾個思考的方向, 1.從圖檔著手。 如何了解Bitmap、View、Drawable、Canvas以及Paint的差異. 常常搞不清楚這幾個元件的差異, 後來找了許多資料, 釐清相關的功能, 總算稍微搞懂這些元件的相關性, 雖然我要講的是View、Drawable、Canvas以及Paint的差異, 但是其實大家常常也把Bitmap搞混, 所以我把這個加進來做一些解釋。

Bitmap指的是你今天有一張圖片存在電腦, 它的格式可能是bmp, jpg, png或者gif, 常看到的是這幾個, 而Android剛好也支援這幾個, 因此我們可以用Bitmap這個類別的物件, 將我們的圖檔讀進Android, 通常讀進去以後它就變成串流模式(Stream), 為什麼呢? 很簡單, 因為電腦看不懂圖片, 只認得二進制碼, 所以我們打成串流才可以讓電腦了解我們的圖是什麼東西。 Bitmap android - Google 搜尋. Android - Clear Image in the Imageview. Java - Remove the image from a imageview Android. How to clear an ImageView in Android? ImageView.setImageDrawable(null); - Google 搜尋.

Android 關掉 rootView - Google 搜尋. Fragment. The Fragment class can be used many ways to achieve a wide variety of results. In its core, it represents a particular operation or interface that is running within a larger Activity. A Fragment is closely tied to the Activity it is in, and can not be used apart from one. Though Fragment defines its own lifecycle, that lifecycle is dependent on its activity: if the activity is stopped, no fragments inside of it can be started; when the activity is destroyed, all fragments will be destroyed.

All subclasses of Fragment must include a public no-argument constructor. The framework will often re-instantiate a fragment class when needed, in particular during state restore, and needs to be able to find this constructor to instantiate it. Topics covered here: Developer Guides For more information about using fragments, read the Fragments developer guide. Older Platforms. Android rootview - Google 搜尋. Android: 如此接近這個布置下來,RelativeLayout / LinearLayout困境 - 數碼維基. 我在一周前,這個問題並沒有真正理解人的意思。 我希望能得到一些澄清。 編輯我已經得到了非常接近的;事實上,我最近還。 Android使用代码实现RelativeLayout,LinearLayout布局 - luckyjda — —you can , I can . you can't , I can ! 今天由于项目需要,学习了用代码动态来布局,下面参考一些代码现学了怎样布局。 现在和大家分享一下: 其实这个LayoutParams类是用于child view(子视图) 向 parent view(父视图)传达自己的意愿的一个东西(孩子想变成什么样向其父亲说明)其实子视图父视图可以简单理解成 一个LinearLayout 和 这个LinearLayout里边一个 TextView 的关系 TextView 就算LinearLayout的子视图 child view 。

需要注意的是LayoutParams只是ViewGroup的一个内部类 这里边这个也就是ViewGroup里边这个LayoutParams类是 base class 基类 实际上每个不同的ViewGroup都有自己的LayoutParams子类 比如LinearLayout 也有自己的 LayoutParams 大家打开源码看几眼就知道了。 [Android] 從新建專案看版面Layout設計 @ 清新下午茶. 這部分給剛入門的Android新手看的,寫的不好請多包涵 一個Android手機程式中 一個畫面,包含可能程式化的內容,就可以稱為一個Activity 定義不重要,這只是我的解釋而已 至少一個Activity會抓一個Layout檔,來顯示版面 才能做之後的事情. Corn-Android 學習手札: Android 元件佈局(二) RelativeLayout. 上一篇介紹過如何使用LinearLayout進行元件佈局,但是單靠一種排版方式,設計出來的介面並不豐富,所以Android也有提供其它的排版方式,本篇將介紹如何使用RelativeLayout(相對佈局)進行排版。 Relativelayout linearlayout 使用 - Google 搜尋. Android开发之setFocusable()和 setFocusableInTouchMode()方法的区别 - 成信物联星的学习笔记.

Android 开发之setFocusable 焦点问题 - sziicool的专栏. SetFocusable(true)和requestFocus();的区别-Android开发问答-eoe 移动开发者论坛. Android Fragment handle back button press. OnKeyListener is not working, why? Fragment监听返回键 - seeytom的专栏. Android setOnKeyListener not working when used in fragment. In the past I have been able to successfully set an onKeyListener that would detect if a user selected the return button on the android keyboard, this would then fire and action to send the user to another activity, however I now need to build this same functionality into a fragment, but when I use setOnKeyListener in the fragment it does not work for some reason, below I will post the code My EditText My setOnKeyListener. Fragment setOnKeyListener - Google 搜尋. 4.1 EditText与TextView共舞setOnKeyListener事件.

第4章 史上超豪华的手机控件. Android程式設計實例入門 -Sample改寫分享 (2014/09/22) @ jashliao的部落格. [Android] 輸入即時輸出(同Ajax) @ Victoria Journal. 本範例將用EditText以及TextView示範如何捕捉User輸入的文字,同時即時取得文字,同步顯示於TextView,這步驟相當於網頁的Ajax技術,即時輸入即時輸出效果。 How to solve "setOnKeyListener(View.OnKeyListener) in the type View is not applicable for the arguments (new OnKeyListener(){})" error on android? SetOnKeyListener(new OnKeyListener() - Google 搜尋. Java 清除缓存文件. JAVA 建立\刪除\修改\複製目錄及檔案. Android: 清除緩存的其他應用程序在Android不重複 - 數碼維基. 嗨,我要乾淨的其他應用程序緩存從我的申請,我能清楚的其他應用程序緩存現在至4.1.2版本的Android使用下面的代碼. 清除 printStackTrace - Google 搜尋. E.printStackTrace() ; 是什么意思?_百度知道. GetBackStackEntryCount() - Google 搜尋. Android - Is this the right way to clean-up Fragment back stack when leaving a deeply nested stack?

Share & Open - 如果移除FragmentManger裡的BackStack entry. FragmentManager. Class Overview Interface for interacting with Fragment objects inside of an Activity Developer Guides For more information about using fragments, read the Fragments developer guide. While the FragmentManager API was introduced in HONEYCOMB, a version of the API at is also available for use on older platforms through FragmentActivity. See the blog post Fragments For All for more details.

大话Fragment管理 - 让创意的火花散落到屏幕的每一个dp. POP_BACK_STACK_INCLUSIVE - Google 搜尋. Untitled. Android - The method pushFragments(String, Fragment) in the type MainActivity is not applicable for the arguments (String, Fragment1) PushFragments - Google 搜尋. 多次切换Viewpager后Fragment的内容被清空了-Android开发问答-eoe 移动开发者论坛. 清空fragments的back stack - niuls的专栏. Android - Fragment BackStack 清空 - 小賴的實戰記錄- 點部落. Fragment 清空 - Google 搜尋. StackEdit – In-browser markdown editor. Online regular expression testing for Java. Online JSON Viewer. Json Parser Online. Refresh-SF - Online JavaScript and CSS Compressor. Create a new fiddle - JSFiddle. 色彩配置. Android Action Bar Style Generator. 匯整 Android 在 UI/UX 的一些資料.