글목록

레이블이 Android인 게시물을 표시합니다. 모든 게시물 표시
레이블이 Android인 게시물을 표시합니다. 모든 게시물 표시

2015. 9. 15.

[Android][error] cvc-complex-type.2.4.d: 'd:skin'




Delete in Android SDK

Android Wear ARM EABI v7a System Image
Android Wear Intel x86 Atom System Image







[Android] How to open Android sdk in Eclipse Luna



Window -> Custom Perspective -> Command Groups Availability 

-> Android SDK and AVD Manager check it








2014. 5. 8.

[Android] How to play a video file from SD card


                       

  public void play() {

    
   
         if(myVideoNum == 0 )
         {       
           //Resource
           uri = "android.resource://" + getPackageName() + "/raw/toplogic" ;
           Uri video = Uri.parse(uri);
           mVideoView.setVideoURI(video);
            mVideoView.start();
        
          
         }else{
           
            //SDcard
           File clip=new File(Environment.getExternalStorageDirectory() + "/ToplogicApp/toplogic.mp4");
           
           if (clip.exists()) {
           
            mVideoView.setVideoPath(clip.getAbsolutePath());
            mVideoView.start();
           }
           else
           {
            videoError();
           }
           
         }

  
   
      
  }



2014. 4. 30.

[Android] How to get filesize in android




                       

   String filePath = Environment.getExternalStorageDirectory().toString() + "/toplogic.mp4";
   
   File file =new File(filePath);
    
   if(file.exists()){
   
   double bytes = file.length();
   double kilobytes = (bytes / 1024);
   double megabytes = (kilobytes / 1024);
   double gigabytes = (megabytes / 1024);
   double terabytes = (gigabytes / 1024);
   double petabytes = (terabytes / 1024);
   double exabytes = (petabytes / 1024);
   double zettabytes = (exabytes / 1024);
   double yottabytes = (zettabytes / 1024);
   
    Toast.makeText(getApplicationContext(),"File size  : " + megabytes , Toast.LENGTH_SHORT).show();
   }
   else
   {
    Toast.makeText(getApplicationContext(),"File does not exists!" , Toast.LENGTH_SHORT).show();
   }



2014. 4. 29.

[Android] How to get display resolution in android



DisplayMetrics displayMetrics = new DisplayMetrics();

getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); // set displayMetrics

int deviceWidth = displayMetrics.widthPixels;

int deviceHeight = displayMetrics.heightPixels;



getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); // set displayMetrics

int dipWidth  = (int) (120  * displayMetrics.density);

int dipHeight = (int) (90 * displayMetrics.density);

System.out.println("displayMetrics.density : " + displayMetrics.density);

System.out.println("deviceWidth : " + deviceWidth +", deviceHeight : "+deviceHeight); 


Galaxy S4  resolution

04-29 10:48:48.986: I/System.out(8934): displayMetrics.density : 3.0

04-29 10:48:48.986: I/System.out(8934): deviceWidth : 1080, deviceHeight : 1920


GalaxyNote 2 resolution

04-29 10:51:33.825: I/System.out(29385): displayMetrics.density : 2.0

04-29 10:51:33.825: I/System.out(29385): deviceWidth : 720, deviceHeight : 1280


GalaxyNote1 resolution

04-29 10:56:07.658: I/System.out(8244): displayMetrics.density : 2.0

04-29 10:56:07.658: I/System.out(8244): deviceWidth : 800, deviceHeight : 1280


Galaxy S1 resolution

04-29 11:04:56.105: I/System.out(3466): displayMetrics.density : 1.5
04-29 11:04:56.105: I/System.out(3466): deviceWidth : 480, deviceHeight : 800

Optimus LTE2  resolution

04-29 10:57:18.949: I/System.out(2559): displayMetrics.density : 2.0
04-29 10:57:18.949: I/System.out(2559): deviceWidth : 720, deviceHeight : 1280

2014. 4. 28.

[Android] Splash Screen Activity

1. MainActivity.Class 


package com.toplogic.splash;

import android.support.v7.app.ActionBarActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;



public class MainActivity extends ActionBarActivity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

    //SplashActivity start
        startActivity(new Intent(this, SplashActivity.class));

 }

 @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;
 }


}

2. SplashActivity.Class


package com.toplogic.splash;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.ActionBarActivity;

public class SplashActivity extends ActionBarActivity {
 
    @Override
     protected void onCreate(Bundle savedInstanceState) {
         
         super.onCreate(savedInstanceState);
         setContentView(R.layout.splash);
  
         Handler hdl = new Handler() {
             @Override
             public void handleMessage(Message msg) {
                 
                 finish(); // close splash
             }
  
         };
         hdl.sendEmptyMessageDelayed(0, 3000); // 3 second after finish
     }

}




3. splash.Xml










4. AndroidManifest.Xml



    

    
        
            
                

                
            
        
          
    







[Android] "app_name" is not translated in error

 "app_name" is not translated in af, am, ar, be, bg, ca, cs, da, de, el, en-rGB, en-rIN, es, es-rUS, et, et-rEE, fa, fi, fr, fr-rCA, hi, hr, hu, hy-rAM, in, it, iw, ja, ka-rGE, km-rKH, 
ko, lo-rLA, lt, lv, mn-rMN, ms, ms-rMY, nb, nl, pl, pt, pt-rBR, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rHK, zh-rTW, zu




In "Window" > "Preferences" > "Android" > "Lint Error Checking"





2014. 4. 18.

[Android] How can I get hour/minute from TimePicker



TimePicker timePicker = (TimePicker) findViewById(R.id.timePicker1);
  timePicker.clearFocus();
  int hour = timePicker.getCurrentHour();
  int minute = timePicker.getCurrentMinute();

   

2014. 4. 11.

[Android] VideoView Fullscreen



RelativeLayout

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

       <VideoView
          android:id="@+id/videoView1"
          android:layout_width="fill_parent"
          android:layout_alignParentRight="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true"
          android:layout_alignParentBottom="true"
          android:layout_height="fill_parent"/>

</RelativeLayout>




[Android] Android Emulator Hosting





















Step 1.  http://www.genymotion.com sign up


Download your for OS


Step 4. Eclipse Plugin instll

 Help -> Install New Software 

 http://plugins.genymotion.com/eclipse

add

step 5.

Genymotion path setting



[Andorid] How to enable USB debugging on Android Samsung Galaxy




Step 1: Go to your Samsung Galaxy Note 3 “Application” icon and Open “Setting Option”:




 Step 2: In the upper right corner of your phone screen, select “General” icon 


And Go on “About Device” option






Step 3:  Scroll down and tap Build Number seven times and you see a message that says 
“Developer mode has been enabled“.







Step 4: Return to the “Phone Setting”, you will see “Developer Options”




Step 5: You are ready to use your Samsung Galaxy Note 3 in debugging mode.








Finished!! all done




2014. 4. 10.

[Android] hidden button

   
 <Button
            android:id="@+id/btn_video"
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:gravity="center"
            android:onClick="onClick"
            android:background="#00ff0000"/>



2014. 4. 1.

[Android] ViewPager Example


1. activity_main.xml:
  


    
    




 2.MainActivity.java


 

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

public class MainActivity extends ActionBarActivity
{
    private ViewPager mPager;

    public int[] mRes = new int[] {
            R.drawable.sing_box01, R.drawable.sing_box02, R.drawable.sing_box03,
            R.drawable.sing_box04, R.drawable.sing_box05, R.drawable.sing_box06,
            R.drawable.sing_box07, R.drawable.sing_box08, R.drawable.sing_box09,
            R.drawable.sing_box10
    };


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);



        ViewPager viewPager = (ViewPager) findViewById(R.id.content_pager);
        ImageAdapter adapter = new ImageAdapter();
        viewPager.setAdapter(adapter);

    }



    class ImageAdapter extends PagerAdapter {

        @Override
        public int getCount() {
            return mRes.length;
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == ((ImageView) object);
        }

        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            ImageView imageView = new ImageView(getApplicationContext());
            imageView.setImageResource(mRes[position]);
            ((ViewPager) container).addView(imageView, 0);
            return imageView;
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            ((ViewPager) container).removeView((ImageView) object);
        }
    }


}



2014. 3. 31.

[Android] How to make VideoView url



MediaPlayer(24463): error (1, -2147483648)


Uri video = Uri.parse("android.resource://" + getPackageName() + "/raw/videoname"); 


For example


videoname : myVideo.mp4


Uri video = Uri.parse("android.resource://" + getPackageName() + "/raw/myVideo");




2014. 3. 28.

[Android] titlebar hidden


1. AndroidManifest.xml

   android:theme="@style/AppTheme

   android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"     
   
   

    
        
            
                

                
            
        

    


OR


 2.styles.xml