-
Recent Posts
- Hwarang Spirit
- Alchemy
- ListView minHeight, typeface
- Clear All Lint Markers Errors
- android.permission.INTERNET
- eclipse Korean character problem
- OnItemCLickListener not working gridview
- G is G!
- Eclipse shortcut to comment selection in an XML file
- android.app.activitythread.performlaunchactivity nullpointerexception
- How to uninstall Windows Live Essentials via CMD line parameter
- vi fold method
- android.os.NetworkOnMainThreadException
- android socket
- socket2
Tags
Archives
Tag Archives: android
Clear All Lint Markers Errors
case of ”Clear All Lint Markers” error … open AndroidManifest.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 |
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="oh.my.girl" android:versionCode="1" android:versionName="1.0" > <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name="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> </application> <uses-permission android:name="android.permission.INTERNET" /> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="9" /> </manifest> |
eclipse Korean character problem
1 |
Window | Preferences | General | Workspace | Text file encoding | Other | UTF-8 |
OnItemCLickListener not working gridview
true -> false
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:orientation="vertical" android:padding="5dp" android:clickable="false" android:focusable="false" android:background="@drawable/grid_color_selector" > <TextView android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:gravity="center" android:textSize="12sp" > </TextView> </LinearLayout> |
http://stackoverflow.com/questions/5982472/gridview-onitemclicklistener-never-gets-invoked http://stackoverflow.com/questions/5577945/onitemclickevent-not-fired-in-gridview-in-android
android socket
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 |
package oh.my.girl import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.Socket; import android.app.Activity; import android.os.Bundle; import android.widget.Button; import android.widget.TextView; public class SocketClient extends Activity { Button button1; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); String host = "192.168.0.2"; int port = 8080; Socket socket = null; OutputStream os = null; OutputStreamWriter osw = null; try { socket = new Socket(host, port); os = socket.getOutputStream(); osw = new OutputStreamWriter(os); } catch (IOException e) { } String message = "I love you"; try { osw.write(message, 0, message.length()); osw.flush(); } catch (IOException e) { } TextView tv = (TextView) findViewById(R.id.text); tv.setText(message); try { socket.close(); } catch (IOException e) { } } } |
socket2
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 |
public static void main(String args[]) { String ip = "192.168.0.2"; int port = 8080; Socket socket = null; OutputStream os = null; OutputStreamWriter osw = null; Socket socket2 = new Socket(); SocketAddress sock_addr = new InetSocketAddress(ip, port); try { socket2.connect(sock_addr); } catch (UnknownHostException ue) { } catch (IOException ie) { } try { os = socket2.getOutputStream(); osw = new OutputStreamWriter(os); } catch (IOException ie) { } String data = "I love you"; try { osw.write(data, 0, data.length()); osw.flush(); } catch (IOException ie) { } } |
Create a Project with Command Line
1 2 3 |
android create project --target 13 --name XXX --path ./Desktop/XXX --activity XXXActivity --package com.XXX |
http://developer.android.com/training/basics/firstapp/creating-project.html#CommandLine
Java Source Structure
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 |
// =========================================================== // Constants // =========================================================== // =========================================================== // Fields // =========================================================== // =========================================================== // Constructors // =========================================================== // =========================================================== // Getter & Setter // =========================================================== // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== // =========================================================== // Methods // =========================================================== // =========================================================== // Inner and Anonymous Classes // =========================================================== |
Razdroid download
image download http://androidpi.wikia.com/wiki/Android_Pi_Wiki open Git Shell git clone https://github.com/Razdroid/razdroid-kernel <- copy and paste(right-click)