listView.setOnTouchListener(new OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            scrollView.requestDisallowInterceptTouchEvent(true);
            return false;
        }
    });
Posted by outliers
,


AccountManager am = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE);
Account[] accounts = am.getAccounts();
for (int i = 0; i < accounts.length; i++)
{
        Account account = accounts[i];
        Log.i("test", account.name);
}

Posted by outliers
,

출처 : http://journae.springnote.com/pages/6730933
참조 URL : http://2nd2none.tistory.com/36#tb

주의 :   

          <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
      위와 같은 activity의 경우 

<data android:scheme="myapp"  />

와 같은 설정을 추가해도 scheme을 인식하지 못한다..(내가 테스트한 바로는..)

따라서 android 단말기의 브라우저에서 해당 scheme( "myapp") 을 인식하고 찾아가게 하기 위해서는

이 페이지의 맨 하단의 내용과 같은 설정과 코딩 부분이 들어가면 된다.

 

참조 코드 전문 :

[AndroidManifest.xml]

        <activity android:name=".Activity.XenoboxCustomDataSchemeActivity">
            <intent-filter>  
                <action android:name="android.intent.action.VIEW"/>  
                <category android:name="android.intent.category.DEFAULT"/>  
                <category android:name="android.intent.category.BROWSABLE"/>  
                <data android:scheme="myapp"/>  
            </intent-filter> 
        </activity>

[assets 폴더]
    [test.xml]

        <html>

            <head>
            </head>

            <body>
                <a href="myapp://someaction?var=str&varr=string">Foo</a> 
            </body>
    
        </html>


[XenoboxCodeLabAppCustomScheme extends Activity]

    @Override
    public void onCreate(Bundle savedInstanceState) {
        //.
        mWebView = (WebView) findViewById(R.id.webview);
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.loadUrl("file:///android_asset/test.html");
        mWebView.setWebViewClient(new XenoboxWebViewClient());
    }


    protected class XenoboxWebViewClient extends WebViewClient {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (url.startsWith("myapp:")) {
                Intent i = new Intent();
                i.setAction(Intent.ACTION_VIEW);
                i.setData(Uri.parse(url));
                startActivity(i);
                return true;
            }
            return false;

        }
    }

[XenoboxCustomDataSchemeActivity extends Activity]

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        //.
        Intent intent = getIntent(); 
        if(Intent.ACTION_VIEW.equals(intent.getAction())) { 
            Uri uri = intent.getData(); 
            String var = uri.getQueryParameter("var");        //. "str" is set 
            String varr = uri.getQueryParameter("varr");    //. "string" is set
            
Log.i("xenobox", "var=" + var + ", " + "varr=" + varr);            
        } 
    }

 

 

 

출처 : http://stackoverflow.com/questions/2448213/how-to-implement-my-very-own-uri-schema-on-android/2448531#2448531

 

This is very possible; you define the URI schema in your AndroidManifest.xml, using the <data> element. You setup an intent filter with the <data> element filled out, and you'll be able to create your own schema. (More on intent filters and intent resolution here.)

Here's a short example:

          <activityandroid:name=".MyUriActivity"><intent-filter><actionandroid:name="android.intent.action.VIEW"/><categoryandroid:name="android.intent.category.DEFAULT"/><categoryandroid:name="android.intent.category.BROWSABLE"/><dataandroid:scheme="myapp"android:host="path"/></intent-filter></activity>
          

As per how implicit intents work, you need to define at least one action and one category as well; here I picked VIEW as the action (though it could be anything), and made sure to add the DEFAULT category (as this is required for all implicit intents). Also notice how I added the category BROWSABLE - this is not necessary, but it will allow your URIs to be openable from the browser (a nifty feature).

 

 

출처 ; http://stackoverflow.com/questions/2430045/how-to-register-some-url-namespace-myapp-app-start-for-accessing-your-progra/2430468#2430468

 

 

You need to follow the standard rules for URIs via the W3C and such, which basically means: do not do this.

Android defines a Uri syntax for describing a generic Intent. There are methods on Intent for converting to and from this representation, such as: http://developer.android.com/reference/android/content/Intent.html#toUri(int)

So the way to do this is to use the normal facilities to describe an in your manifest for the kinds of intents you are going to handle with a particular component, especially defining an action name in your own namespace (com.mycompany.myapp.action.DO_SOMETHING or whatever). You can then make an Intent that matches your component, and use Intent.toUri() to get the URI representation of this. This can be placed in your link, and will then when pressed look for something that handles and and thus find your app. Note to be launched from the browser like this, the component's must handle the BROWSABLE category. (You don't need to have this in the Intent you put in the link, the browser will automatically add this in for you.)

Finally, you may want to set the package of the intent to your app with this: http://developer.android.com/reference/android/content/Intent.html#setPackage(java.lang.String)

This is a newer feature in the platform, which allows you to direct link intents to only your app so that other applications can not intercept and handle them.

In summary: read the regular documentation on intents and intent filters (such as the NotePad tutorial, though you won't be using content: URIs here, probably just custom actions) and get your app working that way. Then you can make a browser link to launch your app in the same way, provided your intent-filter handles the BROWSABLE category.

 

 

출처 ; http://stackoverflow.com/questions/2430045/how-to-register-some-url-namespace-myapp-app-start-for-accessing-your-progra/2430468#2430468

 

 

 

First, to be able to start your app from link with custom scheme 'myapp' in browser / mail, set intent filter as follows.

          <intent-filter>   <== AndroidMenifest.xml 의 내용
          
          <actionandroid:name="android.intent.action.VIEW"/>
          
          <categoryandroid:name="android.intent.category.DEFAULT"/>
          
          <categoryandroid:name="android.intent.category.BROWSABLE"/>
          
          <dataandroid:scheme="myapp"/>
          
          </intent-filter>
          
           
          

and to parse queries in your link myapp://someaction/?var=str&varr=string
(the code is over simplified and has no error checking.)

// 소스코드 내용.

          Intent intent = getIntent();// check if this intent is started via custom scheme link
          
          if(Intent.ACTION_VIEW.equals(intent.getAction())){
          
          Uri uri = intent.getData();
          
          // may be some test here with your custom uriString
          
          var= uri.getQueryParameter("var");// "str" is setString
          
          varr = uri.getQueryParameter("varr");// "string" is set
          
          }
          
Posted by outliers
,

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.RelativeLayout


RelativeLayout은 위젯과 부모와의 관계 또는 위젯끼리의 관계를 지정함으로써 뷰를 배치하는 레이아웃이다.




  • XML Attributes

Attribute Name  Related Method  Description
 android:layout_above   ~의 위에 배치한다.
 android:layout_alignBaseline   ~와 베이스 라인을 맞춘다.
 android:layout_alignBottom   ~와 아래쪽 변을 맞춘다.
 android:layout_alignLef   ~와 왼쪽 변을 맞춘다.
 android:layout_alignParentBottom    true이면 부모와 아래쪽 변을 맞춘다.
 android:layout_alignParentLeft    true이면 부모와 왼쪽 변을 맞춘다.
 android:layout_alignParentRight    true이면 부모와 오른쪽 변을 맞춘다.
 android:layout_alignParentTop    true이면 부모와 위쪽 변을 맞춘다
 android:layout_alignRight    ~와 오른쪽 변을 맞춘다
 android:layout_alignTop    ~와 위쪽 변을 맞춘다.
 android:layout_alignWithParentIfMissing   layout_toLeftOf 등의 속성에 대해 앵커가 발견되지 않으면 부모를 앵커로 사용한다.
 android:layout_below    ~의 아래에 배치한다.
 android:layout_centerHorizontal    true이면 부모와 수평 중앙에 배치한다.
 android:layout_centerInParent    true이면 부모의 수평, 수직 중앙에 배치한다.
 android:layout_centerVertical    true이면 부모와 수직 중앙에 배치한다.
 android:layout_toLeftOf    ~의 왼쪽에 배치한다.
 android:layout_toRightOf    ~의 오른쪽에 배치한다.




  • RelativeLayout 안의 Content 배치

위의 Attributes의 값은 true, false 둘 중 하나의 값을 사용해야 한다.

  • Widget 들간의 배치

위의 Attributes 의 속성 값은 Resource ID의 값을 사용해야 한다.



















Posted by outliers
,