'Android Java'에 해당되는 글 3건

  1. 2017.12.14 [Android] - NavigationView state_checked 배경색상 변경
  2. 2017.12.07 [Android] - Bitmap from uri ( PS. ImageSize small or normal )
  3. 2017.11.29 [Android] - WebView loadData 한글 깨짐 ( UTF-8 ) 인코딩

[Android] - NavigationView state_checked 배경색상 변경

Android Java 2017. 12. 14. 15:10
반응형

for( int i = 0; i < navigation.getMenu().size(); i++ ) {

  MenuItem tot  = navigation.getMenu().getItem( i );

  int tmpSize   = tot.getSubMenu().size();


  for( int j = 0; j < tmpSize; j++ ) {

    MenuItem temp = tot.getSubMenu().getItem( j );

    temp.setChecked( false );

    temp.setCheckable( true ); // 이놈을 해줘야 selector 에서 checked가 먹힘

  }

}



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

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

    <item

        android:drawable="@color/left_menu_background_over"

        android:state_checked="true" /> // 이친구


    <item

        android:drawable="@android:color/transparent"

        android:state_checked="false" />

</selector>

반응형
:

[Android] - Bitmap from uri ( PS. ImageSize small or normal )

Android Java 2017. 12. 7. 17:29
반응형

InputStream is                   = null;

BufferedInputStream bis      = null;

ByteArrayOutputStream out = null;


if( is == null ) {

  is = ( InputStream ) conn.getContent();


  if( is != null ) {

    bis = new BufferedInputStream( is, 8 * 1024 );

    out = new ByteArrayOutputStream();


    int total     = 0;

    byte[] buffer = new byte[4096];


    while( ( total = bis.read( buffer ) ) != -1 ) {

      out.write( buffer, 0, total );

    }


    out.close();

    bis.close();


    byte[] data = out.toByteArray();

    bitmap = BitmapFactory.decodeByteArray( data, 0, data.length );

  }

}


if( is != null ) {

  is.close();

}



반응형
:

[Android] - WebView loadData 한글 깨짐 ( UTF-8 ) 인코딩

Android Java 2017. 11. 29. 18:08
반응형

webview_mail_content.getSettings().setDefaultTextEncodingName( "UTF-8" );

webview_mail_content.loadData( mailContent, "text/html; charset=UTF-8", null );

반응형
: