Android APK 추출 툴

Programming/Android 2014. 3. 7. 22:06 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Android APK 추출 툴



336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Android 화면 크기 읽기, dpi, inch, cm


1. DPI 얻기



DisplayMetrics dm = new DisplayMetrics();

getWindowManager().getDefaultDisplay().getMetrics(dm);

int dpiClassification = dm.densityDpi;

float xDpi = dm.xdpi;

float yDpi = dm.ydpi;


도트 퍼 인치(Dots per inch, DPI)는 인쇄 디스플레이 해상도의 측정 단위이며, 특히 1 제곱인치 (2.54 제곱센티미터) 공간 안에 만들어진 점이나 화소의 수를 말한다.


ex) DPI 가 30 이라는 말은 30 dots(pixel) 이 1 inch 라는 말이다.


1inch 를 화면에 그리고 싶으면


canvas.drawLine( x , y , x + xdpi , y );



1cm 를 화면에 그리고 싶으면


canvas.drawLine( x , y , x + xdpi / 2.54  , y );



2. 화면의 크기 (pixel)단위


// Load Screen Width Height
Display display = getWindowManager().getDefaultDisplay(); 
int width = display.getWidth();  // deprecated
int height = display.getHeight();  // deprecated


'Programming > Android' 카테고리의 다른 글

MediaPlayer Source 선택  (0) 2015.11.16
Android APK 추출 툴  (0) 2014.03.07
Android 지도 테스트  (0) 2014.03.01
Android 2014-03-01 GoogleMap V2 띄우기  (0) 2014.03.01
Android 반짝이는 화면  (0) 2014.02.22

Android 지도 테스트

Programming/Android 2014. 3. 1. 13:10 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);


LocationManager locationManager;

GoogleMap googleMap = ((SupportMapFragment) getSupportFragmentManager()

.findFragmentById(R.id.map)).getMap();

locationManager = (LocationManager) this

.getSystemService(Context.LOCATION_SERVICE);


Criteria criteria = new Criteria();

criteria.setAccuracy(Criteria.ACCURACY_COARSE);

criteria.setAltitudeRequired(false);

criteria.setBearingRequired(false);

criteria.setSpeedRequired(false);


String provider = locationManager.getBestProvider(criteria, true);// "gps";

Location location = locationManager.getLastKnownLocation(provider);


double[] result = new double[] {

location.getLatitude(), location.getLongitude()

};

LatLng myPosition = new LatLng(result[0], result[1]);

googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myPosition, 15));



Marker myMarker = googleMap

.addMarker(new MarkerOptions()

.position(new LatLng(result[0], result[1]))

.title("MyPosition")

.icon(BitmapDescriptorFactory

.fromResource(R.drawable.ic_launcher)));



'Programming > Android' 카테고리의 다른 글

Android APK 추출 툴  (0) 2014.03.07
Android 화면 크기 읽기, dpi, inch, cm  (0) 2014.03.02
Android 2014-03-01 GoogleMap V2 띄우기  (0) 2014.03.01
Android 반짝이는 화면  (0) 2014.02.22
Android GoogleMap API V2  (0) 2014.01.19
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Android 2014-03-01 GoogleMap V2 띄우기


1. 프로젝트 생성




Comple With 를 GoogleAPIs 버전으로


2. google-play-services_lib 를 Import


이클립스 Project Explorer 에서 우클릭하여 Import





SDK폴더\extras\google\google_play_services\libproject\google-play-services_lib





Import 한 google-play-services-lib 를 Add Library






4. Manifest 수정


<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.example.androidmaptest"

    android:versionCode="1"

    android:versionName="1.0" >


    <uses-sdk

        android:minSdkVersion="8"

        android:targetSdkVersion="18" />


    <permission

        android:name="com.example.androidmaptest.permission.MAPS_RECEIVE"

        android:protectionLevel="signature" />


    <uses-permission android:name="com.example.androidmaptest.permission.MAPS_RECEIVE" />

    <uses-permission android:name="android.permission.INTERNET" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />


    <uses-feature

        android:glEsVersion="0x00020000"

        android:required="true" />


    <application

        android:allowBackup="true"

        android:icon="@drawable/ic_launcher"

        android:label="@string/app_name"

        android:theme="@style/AppTheme" >

        <uses-library android:name="com.google.android.maps" />


        <activity

            android:name="com.example.androidmaptest.MainActivity"

            android:label="@string/app_name"

            android:theme="@android:style/Theme.NoTitleBar" >

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />


                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>

        </activity>

        

        <meta-data

            android:name="com.google.android.gms.version"

            android:value="@integer/google_play_services_version" />

        <meta-data

            android:name="com.google.android.maps.v2.API_KEY"

            android:value="API키값" />

   

    </application>


</manifest>



빨간색으로 표시된 패키지명API키값 입력



5. Layout XML 생성

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>



6. 사용할 API키 값 발급 받기


실행 -> cmd 





cmd 창을 띄운후


cd .android 

입력 후


keytool -list -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android 

입력


SHA1 값 저장

( keytool 이 제대로 실행되지 않을시

JAVA jdk 폴더 밑 bin 폴더에 있는 keytool.exe 파일을 .android 폴더로 복사. jli.dll 없다고 할 시 해당 파일도 복사)


https://console.developers.google.com/ 로 접속


로그인 후 프로젝트 생성






생성한 프로젝트를 클릭





APIs & auth 메뉴




Google Maps Android API v2 를 On 으로 변경



Credentials 메뉴 






Android Key 생성





발급 된 키를 사용



그리고


public class MainActivity extends FragmentActivity {


MainActivity 는 Activity 가 아닌 FragmentActivity 를 상속 받는다.




'Programming > Android' 카테고리의 다른 글

Android 화면 크기 읽기, dpi, inch, cm  (0) 2014.03.02
Android 지도 테스트  (0) 2014.03.01
Android 반짝이는 화면  (0) 2014.02.22
Android GoogleMap API V2  (0) 2014.01.19
viewpagertest  (0) 2014.01.14

Android 반짝이는 화면

Programming/Android 2014. 2. 22. 12:10 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

package com.example.androidtest0222;

 

import android.R.bool;

import android.app.Activity;

import android.content.Context;

import android.graphics.Canvas;

import android.graphics.Color;

import android.os.Bundle;

import android.os.Handler;

import android.util.AttributeSet;

import android.view.Menu;

import android.view.View;

import android.widget.RelativeLayout;

 

public class MainActivity extends Activity {

 

      RelativeLayout backLayout;

 

      @Override

      protected void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);

            setContentView(R.layout.activity_main);

      }

 

      @Override

      public boolean onCreateOptionsMenu(Menu menu) {

           // Inflate the menu; this adds items to the action bar if it is present.

            getMenuInflater().inflate(R.menu.main, menu);

            return true;

      }

 

}

 

class MyView extends View {

      public MyView(Context context) {

            super(context);

      }

      public MyView(Context context, AttributeSet attri) {

            super(context, attri);

            mHandler.sendEmptyMessageDelayed(0, 500);

      }

      boolean flag = false;

      @Override

      protected void onDraw(Canvas canvas) {

            // TODO Auto-generated method stub

            if(flag)

            {

                  canvas.drawColor(Color.YELLOW);

                  flag = !flag;

            }

            else

            {

                  canvas.drawColor(Color.GREEN);

                  flag = !flag;

            }

            super.onDraw(canvas);

      }

      Handler mHandler = new Handler()

      {

            public void handleMessage(android.os.Message msg) {

                  invalidate();

                  mHandler.sendEmptyMessageDelayed(0, 500);

            };

      };

}

 

'Programming > Android' 카테고리의 다른 글

Android 지도 테스트  (0) 2014.03.01
Android 2014-03-01 GoogleMap V2 띄우기  (0) 2014.03.01
Android GoogleMap API V2  (0) 2014.01.19
viewpagertest  (0) 2014.01.14
Android FrameLayout 예제  (0) 2014.01.12

Android GoogleMap API V2

Programming/Android 2014. 1. 19. 11:50 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

안드로이드 맵에 검색창 띄워서 검색하기



Android Geocoding – Showing User Input Location on Google Map Android API V2



In this article, we will create an Android application which facilitates users to input street address in an EditText and on clicking the find button, application draws corresponding location marker on the Google Map Android API v2 using Google’s Geocoder API.

This application is an upgraded version of the application discussed in the article titled “Android Geocoding – Showing User Input Location on Google Map” where the location is shown in Google Map Android API v1.

This application is developed in Eclipse 4.2.1 with ADT plugin ( 21.0.0 ) and Android SDK ( 21.0.0 ) and is tested in a real Android Phone with Android 2.3.6  ( GingerBread ).


1. Download and configure Google Play Services Library in Eclipse

Please follow the given below link to setup Google Play Service library in Eclipse.

http://developer.android.com/google/play-services/setup.html


2. Create a new Android Application Project namely “LocationGeocodingV2″

Create new Android application project

Figure 1 : Create new Android application project


3. Configure Android Application Project

Configure Android Application Project

Figure 2 : Configure Android Application Project


4. Design Application Launcher Icon

Design Application Launcher Icon

Figure 3 : Design Application Launcher Icon


5. Create a blank activity

Create a blank activity

Figure 4 : Create a blank activity


6. Enter Main Activity Details

Enter Main Activity Details

Figure 5 : Enter Main Activity Details


7. Link to Google Play Service Library

Link to Google Play Services Library

Figure 6 : Link to Google Play Services Library


8. Get the API key for Google Maps Android API v2

We need to get an API key from Google to use Google Maps in Android application. Please follow the given below link to get the API key for Google Maps Android API v2.

https://developers.google.com/maps/documentation/android/start


9. Add Android Support library to this project

By default, Android support library (android-support-v4.jar ) is added to this project by Eclipse IDE to the directory libs. If it is not added, we can do it manually by doing the following steps :

  • Open Project Explorer by Clicking “Window -> Show View -> Project Explorer”
  • Right click this project
  • Then from popup window, Click “Android Tools -> Add Support Library “

10. Update the file AndroidManfiest.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?xml version="1.0" encoding="utf-8"?>
    package="in.wptrafficanalyzer.locationgeocodingv2"
    android:versionCode="1"
    android:versionName="1.0" >
 
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />
 
    <permission
        android:name="in.wptrafficanalyzer.locationgeocodingv2.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
 
    <uses-permission android:name="in.wptrafficanalyzer.locationgeocodingv2.permission.MAPS_RECEIVE"/>
 
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
 
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>
 
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
 
        <activity
            android:name="in.wptrafficanalyzer.locationgeocodingv2.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
 
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="YOUR_API_KEY"/>
    </application>
</manifest>

11. Update the layout file res/layout/activity_main.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity" >
 
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
 
        <Button
            android:id="@+id/btn_find"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/str_btn_find"
            android:layout_alignParentRight="true" />
 
        <EditText
            android:id="@+id/et_location"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:inputType="text"
            android:hint="@string/hnt_et_location"
            android:layout_toLeftOf="@id/btn_find" />
 
    </RelativeLayout>
 
    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment" />
 
</LinearLayout>

12. Update the file res/values/strings.xml

1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">LocationGeocodingV2</string>
    <string name="hello_world">Hello world!</string>
    <string name="menu_settings">Settings</string>
    <string name="str_btn_find">Find</string>
    <string name="hnt_et_location">Enter location</string>
</resources>

13. Update the file src/in/wptrafficanalyzer/locationgeocodingv2/MainActivity.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package in.wptrafficanalyzer.locationgeocodingv2;
 
import java.io.IOException;
import java.util.List;
 
import android.location.Address;
import android.location.Geocoder;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
 
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
 
public class MainActivity extends FragmentActivity {
 
    GoogleMap googleMap;
    MarkerOptions markerOptions;
    LatLng latLng;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        SupportMapFragment supportMapFragment = (SupportMapFragment)
        getSupportFragmentManager().findFragmentById(R.id.map);
 
        // Getting a reference to the map
        googleMap = supportMapFragment.getMap();
 
        // Getting reference to btn_find of the layout activity_main
        Button btn_find = (Button) findViewById(R.id.btn_find);
 
        // Defining button click event listener for the find button
        OnClickListener findClickListener = new OnClickListener() {
            @Override
            public void onClick(View v) {
                // Getting reference to EditText to get the user input location
                EditText etLocation = (EditText) findViewById(R.id.et_location);
 
                // Getting user input location
                String location = etLocation.getText().toString();
 
                if(location!=null && !location.equals("")){
                    new GeocoderTask().execute(location);
                }
            }
        };
 
        // Setting button click event listener for the find button
        btn_find.setOnClickListener(findClickListener);
 
    }
 
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
 
    // An AsyncTask class for accessing the GeoCoding Web Service
    private class GeocoderTask extends AsyncTask<String, Void, List<Address>>{
 
        @Override
        protected List<Address> doInBackground(String... locationName) {
            // Creating an instance of Geocoder class
            Geocoder geocoder = new Geocoder(getBaseContext());
            List<Address> addresses = null;
 
            try {
                // Getting a maximum of 3 Address that matches the input text
                addresses = geocoder.getFromLocationName(locationName[0], 3);
            } catch (IOException e) {
                e.printStackTrace();
            }
            return addresses;
        }
 
        @Override
        protected void onPostExecute(List<Address> addresses) {
 
            if(addresses==null || addresses.size()==0){
                Toast.makeText(getBaseContext(), "No Location found", Toast.LENGTH_SHORT).show();
            }
 
            // Clears all the existing markers on the map
            googleMap.clear();
 
            // Adding Markers on Google Map for each matching address
            for(int i=0;i<addresses.size();i++){
 
                Address address = (Address) addresses.get(i);
 
                // Creating an instance of GeoPoint, to display in Google Map
                latLng = new LatLng(address.getLatitude(), address.getLongitude());
 
                String addressText = String.format("%s, %s",
                address.getMaxAddressLineIndex() > 0 ? address.getAddressLine(0) : "",
                address.getCountryName());
 
                markerOptions = new MarkerOptions();
                markerOptions.position(latLng);
                markerOptions.title(addressText);
 
                googleMap.addMarker(markerOptions);
 
                // Locate the first location
                if(i==0)
                    googleMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));
            }
        }
    }
}

14. Screenshot of the application in execution

Showing Street Address in Google Map Android API V2

Figure 7 : Showing Street Address in Google Map Android API V2


15. Download Source Code









출처 : http://wptrafficanalyzer.in/blog/android-geocoding-showing-user-input-location-on-google-map-android-api-v2/



'Programming > Android' 카테고리의 다른 글

Android 2014-03-01 GoogleMap V2 띄우기  (0) 2014.03.01
Android 반짝이는 화면  (0) 2014.02.22
viewpagertest  (0) 2014.01.14
Android FrameLayout 예제  (0) 2014.01.12
안드로이드 위치 기록, 위치 추적  (0) 2014.01.12

viewpagertest

Programming/Android 2014. 1. 14. 18:35 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

package com.example.viewpagertest;

 

import java.util.Locale;

 

import android.os.Bundle;

import android.support.v4.app.Fragment;

import android.support.v4.app.FragmentActivity;

import android.support.v4.app.FragmentManager;

import android.support.v4.app.FragmentPagerAdapter;

import android.support.v4.app.NavUtils;

import android.support.v4.view.ViewPager;

import android.view.Gravity;

import android.view.LayoutInflater;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

import android.view.ViewGroup;

import android.widget.TextView;

 

public class MainActivity extends FragmentActivity {

 

    /**

     * The {@link android.support.v4.view.PagerAdapter} that will provide

     * fragments for each of the sections. We use a

     * {@link android.support.v4.app.FragmentPagerAdapter} derivative, which

     * will keep every loaded fragment in memory. If this becomes too memory

     * intensive, it may be best to switch to a

     * {@link android.support.v4.app.FragmentStatePagerAdapter}.

     */

    SectionsPagerAdapter mSectionsPagerAdapter;

 

    /**

     * The {@link ViewPager} that will host the section contents.

     */

    ViewPager mViewPager;

 

    @Override

    protected void onCreate(Bundle savedInstanceState) {

       super.onCreate(savedInstanceState);

       setContentView(R.layout.activity_main);

 

       // Create the adapter that will return a fragment for each of the three

       // primary sections of the app.

       mSectionsPagerAdapter = new SectionsPagerAdapter(

              getSupportFragmentManager());

 

       // Set up the ViewPager with the sections adapter.

       mViewPager = (ViewPager) findViewById(R.id.pager);

        mViewPager.setAdapter(mSectionsPagerAdapter);

 

    }

 

    @Override

    public boolean onCreateOptionsMenu(Menu menu) {

       // Inflate the menu; this adds items to the action bar if it is present.

       getMenuInflater().inflate(R.menu.main, menu);

       return true;

    }

 

    /**

     * A {@link FragmentPagerAdapter} that returns a fragment corresponding to

     * one of the sections/tabs/pages.

     */

    public class SectionsPagerAdapter extends FragmentPagerAdapter {

 

       public SectionsPagerAdapter(FragmentManager fm) {

           super(fm);

       }

 

       @Override

       public Fragment getItem(int position) {

           // getItem is called to instantiate the fragment for the given page.

           // Return a DummySectionFragment (defined as a static inner class

           // below) with the page number as its lone argument.

           Fragment fragment = new DummySectionFragment();

           Bundle args = new Bundle();

       args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, position + 1);

           fragment.setArguments(args);

           return fragment;

       }

 

       @Override

       public int getCount() {

           // Show 3 total pages.

           return 5;

       }

 

       @Override

       public CharSequence getPageTitle(int position) {

           Locale l = Locale.getDefault();

           switch (position) {

           case 0:

              return getString(R.string.title_section1).toUpperCase(l);

           case 1:

              return getString(R.string.title_section2).toUpperCase(l);

           case 2:

              return getString(R.string.title_section3).toUpperCase(l);

           case 3:

              return getString(R.string.title_section2).toUpperCase(l);

           case 4:

              return getString(R.string.title_section3).toUpperCase(l);

           }

           return null;

       }

    }

 

    /**

     * A dummy fragment representing a section of the app, but that simply

     * displays dummy text.

     */

    public static class DummySectionFragment extends Fragment {

       /**

        * The fragment argument representing the section number for this

        * fragment.

        */

       public static final String ARG_SECTION_NUMBER = "section_number";

 

       public DummySectionFragment() {

       }

 

       @Override

       public View onCreateView(LayoutInflater inflater, ViewGroup container,

              Bundle savedInstanceState) {

           View rootView = null;

           if (getArguments().getInt(ARG_SECTION_NUMBER) == 1) {

              rootView = inflater.inflate(R.layout.page1,

                     container, false);

           } else {

              rootView = inflater.inflate(R.layout.fragment_main_dummy,

                     container, false);

              TextView dummyTextView = (TextView) rootView

                      .findViewById(R.id.section_label);

           dummyTextView.setText(Integer.toString(getArguments().getInt(

                     ARG_SECTION_NUMBER)));

           }

           return rootView;

       }

    }

 

}

 

Android FrameLayout 예제

Programming/Android 2014. 1. 12. 11:36 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Android FrameLayout 예제


MainAcitivity.java


 

package com.example.test2;


import android.app.Activity;

import android.os.Bundle;

import android.view.Menu;

import android.view.View;

import android.view.View.OnClickListener;

import android.widget.Button;


public class MainActivity extends Activity implements OnClickListener {


Button button1;

Button button2;

Button button3;

    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        button1 = (Button)findViewById(R.id.button1);

        button2 = (Button)findViewById(R.id.button2);

        button3 = (Button)findViewById(R.id.button3);

        

        button1.setOnClickListener(this);

        button2.setOnClickListener(this);

        button3.setOnClickListener(this);

    }



    @Override

    public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.

        getMenuInflater().inflate(R.menu.main, menu);

        return true;

    }



@Override

public void onClick(View v) {

View temp;

// TODO Auto-generated method stub

if( v.getId() == R.id.button1 )

{

temp = (View)findViewById(R.id.tab1);

temp.setVisibility(View.VISIBLE);

temp = (View)findViewById(R.id.tab2);

temp.setVisibility(View.INVISIBLE);

temp = (View)findViewById(R.id.tab3);

temp.setVisibility(View.INVISIBLE);

}

else if( v.getId() == R.id.button2 )

{


temp = (View)findViewById(R.id.tab2);

temp.setVisibility(View.VISIBLE);

temp = (View)findViewById(R.id.tab1);

temp.setVisibility(View.INVISIBLE);

temp = (View)findViewById(R.id.tab3);

temp.setVisibility(View.INVISIBLE);

}

else if( v.getId() == R.id.button3 )

{


temp = (View)findViewById(R.id.tab3);

temp.setVisibility(View.VISIBLE);

temp = (View)findViewById(R.id.tab1);

temp.setVisibility(View.INVISIBLE);

temp = (View)findViewById(R.id.tab2);

temp.setVisibility(View.INVISIBLE);

}

}

    

}




activity_main.xml



 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:paddingBottom="@dimen/activity_vertical_margin"

    android:paddingLeft="@dimen/activity_horizontal_margin"

    android:paddingRight="@dimen/activity_horizontal_margin"

    android:paddingTop="@dimen/activity_vertical_margin"

    tools:context=".MainActivity" >


    <Button

        android:id="@+id/button1"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_alignParentLeft="true"

        android:layout_alignParentTop="true"

        android:text="Button1" />


    <Button

        android:id="@+id/button3"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_alignBaseline="@+id/button2"

        android:layout_alignBottom="@+id/button2"

        android:layout_toRightOf="@+id/button2"

        android:text="Button3" />


    <Button

        android:id="@+id/button2"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_alignBaseline="@+id/button1"

        android:layout_alignBottom="@+id/button1"

        android:layout_toRightOf="@+id/button1"

        android:text="Button2" />


    <FrameLayout

        android:layout_width="match_parent"

        android:layout_height="match_parent"

        android:layout_below="@+id/button2">


        <ImageView

            android:id="@+id/tab1"

            android:layout_width="match_parent"

            android:layout_height="match_parent"

            android:src="@drawable/image" />


        <LinearLayout

            android:id="@+id/tab2"

            android:visibility="invisible"

            android:layout_width="match_parent"

            android:layout_height="match_parent"

            android:orientation="vertical" >


            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button" />


            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button" />

        </LinearLayout>


        <LinearLayout

            android:id="@+id/tab3"

            android:visibility="invisible"

            android:layout_width="match_parent"

            android:layout_height="match_parent"

            android:orientation="vertical" >


            <TableLayout

                android:layout_width="match_parent"

                android:layout_height="match_parent" >


                <TableRow>


                    <Button

                        android:layout_width="wrap_content"

                        android:layout_height="wrap_content"

                        android:text="Button" />


                    <Button

                        android:layout_width="wrap_content"

                        android:layout_height="wrap_content"

                        android:text="Button" />


                    <Button

                        android:layout_width="wrap_content"

                        android:layout_height="wrap_content"

                        android:text="Button" />

                </TableRow>


                <TableRow>


                    <Button

                        android:layout_width="wrap_content"

                        android:layout_height="wrap_content"

                        android:text="Button" />


                    <Button

                        android:layout_width="wrap_content"

                        android:layout_height="wrap_content"

                        android:text="Button" />


                    <Button

                        android:layout_width="wrap_content"

                        android:layout_height="wrap_content"

                        android:text="Button" />

                </TableRow>

            </TableLayout>

        </LinearLayout>

    </FrameLayout>


</RelativeLayout>


336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.



안드로이드 폰 위치 기록 확인

https://maps.google.com/locationhistory/



안드로이드 폰 현재 위치 확인

https://www.google.com/android/devicemanager

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Windows 7 환경에서 Android Fulll Source 다운로드 받기


http://source.android.com/source/downloading.html


위 링크에서


안드로이드 전체 소스코드를 다운로드 받을 수 있다.


Windows 환경에서 받는 방법을 설명한다


Cygwin: http://www.cygwin.com

Cygwin 설치 시 추가로 선택해야 할 패키지들: curl, git, python, readline


일단 Cygwin 을 이용하여 Windows 환경에서 리눅스 명령어를 사용 할 수 있게한다.


그 중 위 4개의 명령어는 반드시 필요하다.


Cygwin 홈페이지에서 setup.exe 파일을 다운로드한 후 실행한다.







대부분의 설정은 default 상태로 유지하고 넘어가는데, mirror site 선택할 때는 한국 내에 거주하는 경우 ftp.daum.net 을 선택해주는 것이 가장 빠르게 받을 수 있는 방법이다.



설치해야 할 package를 선택하는 화면이 나오면 우측 상단의 "View" 버튼을 눌러 Full 보기 상태로 만든 후 위에서 언급했던 모듈들을 추가로 선택해준다.


View 버튼은 그림에서 1. 번 위치에 있다.

모듈 설치 선택하는 방법은 그림에서 2. 번 위치를 눌러주는 것으로 결정이 가능하다.

Keep: 이미 설치되어 있는 버전을 그대로 유지할 것임을 나타냄.

Skip: 아직 설치되지 않은 모듈이며 설치하지 않을 것임을 나타냄. 이 부분을 마우스로 클릭하면 버전 번호로 바뀌게 되는데 설치 과정에서 설치하게 될 것임을 나타냄.

Uninstall: 이미 설치되어 있는 모듈을 제거할 것임을 나타냄.






Cygwin 설치가 완료되면


http://source.android.com/source/downloading.html


경로에 있는 대로


Full Source 를 받을 폴더로 Cygwin 에서 경로를 이동하고


curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo


repo 를 만든다.


chmod a+x ~/bin/repo


그 다음 repo 의 권한 설정을 변경해주고


repo init -u https://android.googlesource.com/platform/manifest


(위 명령어가 안 먹는 경우 git 설치가 덜 된 경우)

(http://git-scm.com/book/ko/%EC%8B%9C%EC%9E%91%ED%95%98%EA%B8%B0-Git-%EC%84%A4%EC%B9%98)

(위 링크로 들어가서 git 설치 후 진행)


repo 를 초기화 한 후


repo sync


repo sync 를 호출하게 되면 약 1시간 이상동안 android full source 를 다운로드 받게 된다.


중간에 이름과 이메일을 물어보는 질문이 있다.