Tuesday, January 28, 2014

Android APK installation will ask for advice to / system / app approach


            
I find a lot of information, with the code to their APK install / system / app project testing needs, so that their service is not
kill off third-party softwareHere is an article http://chongye89.iteye.com/blog/1412488
I tried, but no response do not know what areas need attention
Hope expert guidance or what better way to achieve the effect I want
Thank you
Reply:
Neighborhoods ah have puzzled for a long time
Hope someone pointing pointing thank you
Reply:
Nobody?

Reply:
adb shell ok then.


Direct 1, adb remount
2, adb push XXX.apk (absolute path) / system / app

This can ah.
Reply:
reference to the third floor of the reply:
adb shell ok then.


Direct 1, adb remount
2, adb push XXX.apk (absolute path) / system / app

This can ah.

Do you mean that
1. $ Adb push SecureSetting.apk / sdcard / / / upload files to install, to prepare for the installation.
2. $ Adb shell
3. $ Su / / switch to the root user. If you do not get Root privileges, this step will not be successful.
4. # Mount-o remount, rw-t yaffs2 / dev/block/mtdblock3 / system / / make partition writable.
5. # Cat / sdcard / SecureSetting.apk> / system / app / SecureSetting.apk / / This step can be achieved using cp, but generally not included in the command device. If you are using mv an error: failed on '/ sdcard / NetWork.apk' - Cross-device link.
6. # Mount-o remount, ro-t yaffs2 / dev/block/mtdblock3 / system / / restore partition properties, read-only.
7. # Exit
8. $ Exit
This right is not it?
Reply:
reference to the third floor of the reply:
adb shell ok then.


Direct 1, adb remount
2, adb push XXX.apk (absolute path) / system / app

This can ah.

You mean
1. $ Adb push SecureSetting.apk / sdcard / / / upload files to install, to prepare for the installation.
This wrong?
Reply:
Mainly requires root privileges. . No root does not work
Reply:
references 6th Floor reply:
mainly requires root privileges. . No root does not work

With root privileges phone is that according to the Internet, but I do not know what went wrong it does not respond
Reply:
Well, I posted the code
 
package com.sfer.install;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

public final class RootCmd {
/ / Execute linux commands and output
protected static String execRootCmd (String paramString) {
String result = "result:";
try {
Process localProcess = Runtime.getRuntime (). Exec ("su") ;/ / Root handled through the android system that is su command
OutputStream localOutputStream = localProcess.getOutputStream ();
DataOutputStream localDataOutputStream = new DataOutputStream (
localOutputStream);
InputStream localInputStream = localProcess.getInputStream ();
DataInputStream localDataInputStream = new DataInputStream (
localInputStream);
String str1 = String.valueOf (paramString);
String str2 = str1 + "\ n";
localDataOutputStream.writeBytes (str2);
localDataOutputStream.flush ();
String str3 = null;
/ / While ((str3 = localDataInputStream.readLine ())! = Null) {
/ / Log.d ("result", str3);
/ /}
localDataOutputStream.writeBytes ("exit \ n");
localDataOutputStream.flush ();
localProcess.waitFor ();
return result;
} Catch (Exception localException) {
localException.printStackTrace ();
return result;
}
}

/ / Run linux command but does not care about the result output
protected static int execRootCmdSilent (String paramString) {
try {
. Process localProcess = Runtime.getRuntime () exec ("su");
Object localObject = localProcess.getOutputStream ();
DataOutputStream localDataOutputStream = new DataOutputStream (
(OutputStream) localObject);
String str = String.valueOf (paramString);
localObject = str + "\ n";
localDataOutputStream.writeBytes ((String) localObject);
localDataOutputStream.flush ();
localDataOutputStream.writeBytes ("exit \ n");
localDataOutputStream.flush ();
localProcess.waitFor ();
int result = localProcess.exitValue ();
return (Integer) result;
} Catch (Exception localException) {
localException.printStackTrace ();
return -1;
}
}

/ / Determine whether the machine Android root, that is, whether to obtain root privileges
protected static boolean haveRoot () {

int i = execRootCmdSilent ("echo test"); / / to detect
by executing the test commandif (i! = -1) {
return true;
}
return false;
}

}

Reply:
 
package com.sfer.install;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

public class InstallActivity extends Activity {
/ ** Called when the activity is first created. * /
@ Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.main);
String paramString = "$ adb push MySMS.apk / sdcard /" + "\ n" +
"$ Adb shell" + "\ n" +
"$ Su" + "\ n" +
"# Mount-o remount, rw-t yaffs2 / dev/block/mtdblock3 / system" + "\ n" +
"# Cat / sdcard / MySMS.apk> / system / app / MySMS.apk" + "\ n" +
"# Mount-o remount, ro-t yaffs2 / dev/block/mtdblock3 / system" + "\ n" +
"# Exit" + "\ n" +
"$ Exit";
if (RootCmd.haveRoot ()) {
if (RootCmd.execRootCmdSilent (paramString) == -1) {
Toast.makeText (this, "Installation unsuccessful", Toast.LENGTH_LONG) show ();.
} Else {
Toast.makeText (this, "successful installation", Toast.LENGTH_LONG) show ();.
}
} Else {
. Toast.makeText (this, "without root privileges", Toast.LENGTH_LONG) show ();
}


}
}

Reply:
Your use adb shell line by line execution, which step wrong, Tieshanglai
Reply:
Find a reason in the code execution to be changed so that the string on the line
 
String paramString = "adb push MySMS.apk / system / app" + "\ n" +
"Adb shell" + "\ n" +
"Su" + "\ n" +
"Mount-o remount, rw-t yaffs2 / dev/block/mtdblock3 / system" + "\ n" +
"Cat / sdcard / MySMS.apk> / system / app / MySMS.apk" + "\ n" +
"Mount-o remount, ro-t yaffs2 / dev/block/mtdblock3 / system" + "\ n" +
"Exit" + "\ n" +
"Exit";

Reply:
But now I do not know whether this will succeed, I can only do the test on my phone
Interested parties can get to try to put the code in the code you want to install the APK name to his own need to install the APK into / sdcard what is the root of the problem exchange exchange
Reply:
The reply was deleted at the moderator 2012-08-13 11:30:52

Reply:
The reply was deleted at the moderator 2012-08-13 12:59:14

Reply:
reference to the 12th floor sfer520_1314 reply:
but now I do not know whether this will succeed, I can only do the test on my phone
Interested parties can get to try to put the code in the code you want to install the APK name to his own need to install the APK into / sdcard what is the root of the problem AC AC


My phone was unsuccessful. . You can add my QQ? 231599447
Reply:
LZ I successfully install apk to system / app, but the authority has not changed over the installation by the above code, apk permissions to rw -------
installedIf normal, it should be rw-r - r -, neighborhoods QQ: 263687542
Reply:
Apk successfully installed system / app and change the permissions under, but if the command is wrong, cause Runtime.getRuntime () exec (cmd);. Obstruction, now being addressed
Reply:
Upstairs, is how to solve?
Reply:
Does not have root privileges to push into it
Reply:
cited 19th floor shen332401890 reply:
without root privileges can not be pushed into it

Applications have root privileges, and now is how to copy itself in the past.
Reply:
/ System / bin / sh: cannot create / system / app / fruit.apk: Permission denied
Reply:
This post is good, my experiment has succeeded. Upstairs chmod 777 system

Fail to connect to camera service


            
Solving.
I do automatically take pictures and get recognition.
Turn off then turn on each release has this problem. Has not been resolved. (Closed code execution, or has this problem when opening.)
The camera can not restart the service on or off camera is turned on.
Reply:
First Determine whether you look at your apk are so many loom, such as the Samsung htc try try try to get different models
Exclude individual platform issues


Second, you have release
Determine whether your code logic problem.
Reply:
This model is a special case of the problem in addition to outside, that you did not release a success.
Reply:
AF solve it removed

android play video! Urgent! ! ! !


 package com.cn; 

import android.app.Activity;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;

/ **
* @ Description achieve their players
by SurfaceView / SurfaceHolder* @ Description here about the supplement, we can add OnPreparedListener
by mediaplayer* And OnCompletionListener and other events to play and ready to play after the completion of the operation control.
* When using SurfaceView and SurfaceHolder video playback, the structure is such that:
* 1, first of all, we get a surfaceView
from layout file* 2, to obtain the corresponding surfaceHolder
container think through surfaceView.getHolder () method* 3, srufaceHolder some default settings, such as addCallback () and setType ()
* 4 through mediaPlayer.setDisplay () method to play the video playback and container linked
* /
public class TestInternetActivity extends Activity {

MediaPlayer mediaPlayer; / / player's internal implementation is through MediaPlayer
SurfaceView surfaceView ;/ / video in a container
SurfaceHolder surfaceHolder ;/ / control surfaceView attributes (size, format, etc.) object
boolean isPause; / / if already suspended

@ Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.main);
surfaceView = (SurfaceView) findViewById (R.id.surfaceView1);
/ **
* Get the surefaceHolder
that is associated with the current surfaceView* /
surfaceHolder = surfaceView.getHolder ();
/ **
* Registration When surfaceView create, change, and should be performed when the destruction method
* /
surfaceHolder.addCallback (new SurfaceHolder.Callback () {

@ Override
public void surfaceDestroyed (SurfaceHolder holder) {
Log.i ("notice", "surfaceHolder been destroyed");
if (mediaPlayer! = null)
mediaPlayer.release ();
}

@ Override
public void surfaceCreated (SurfaceHolder holder) {
Log.i ("notice", "surfaceHolder is create a");
}

@ Override
public void surfaceChanged (SurfaceHolder holder, int format,
int width, int height) {
Log.i ("notice", "surfaceHolder was changed");
}
});

/ **
* This must be set to SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS oh, meaning
* Create a push in the 'surface', the main feature is not buffered
* /
surfaceHolder.setType (SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}

/ ***
* @ Param targetButton
* User button is clicked
* /
public void buttonClick (View targetButton) {
int buttonId = targetButton.getId ();
switch (buttonId) {
case R.id.button_play:
play ();
break;
case R.id.button_pause:
pause ();
break;
case R.id.button_reset:
reset ();
break;
case R.id.button_stop:
stop ();
break;
default:
break;
}

}

/ **
* Play
* /
private void play () {

mediaPlayer = new MediaPlayer ();
/ / Set the multimedia stream type
mediaPlayer.setAudioStreamType (AudioManager.STREAM_MUSIC);


Container / / set for the show mediaPlayermediaPlayer.setDisplay (surfaceHolder);
try {
/ / MediaPlayer.setDataSource ("/ sdcard/001.mp4");
mediaPlayer
. SetDataSource ("http://192.168.1.114:8080/webdav/china.3gp");
mediaPlayer.prepareAsync ();
mediaPlayer.start ();
isPause = false;
} Catch (Exception e) {
/ / Log.i ("notice", "An error occurred during playback oh");
e.printStackTrace ();
}
}

/ **
* Pause
* /
private void pause () {
Log.i ("notice", "click on the pause button");
if (isPause == false) {
mediaPlayer.pause ();
isPause = true;
} Else {
mediaPlayer.start ();
isPause = false;
}
}

/ **
* Reset
* /
private void reset () {
Log.i ("notice", "click on the reset button");
/ / Jump to the beginning
videomediaPlayer.seekTo (0);
mediaPlayer.start ();
}

/ **
* Stop
* /
private void stop () {
Log.i ("notice", "click the stop button");
mediaPlayer.stop ();
mediaPlayer.release ();

}
}


Why when playing online video will be reported

05-10 03:14:44.555: ERROR / gralloc (52): [unregister] handle 0x274308 still locked (state = 40000001)
05-10 03:14:47.408: ERROR / MediaPlayer (2060): start called in state 4
05-10 03:14:47.408: ERROR / MediaPlayer (2060): error (-38, 0)
05-10 03:14:47.425: ERROR / MediaPlayer (2060): Error (-38,0)

05-10 03:14:48.095: WARN / MediaPlayer (2060): info / warning (1, 26)
05-10 03:14:48.107: INFO / MediaPlayer (2060): Info (1,26)
05-10 03:14:48.136: ERROR / PlayerDriver (31): Command PLAYER_INIT completed with an error or info PVMFFailure
05-10 03:14:48.136: ERROR / MediaPlayer (2060): error (1, -1)
05-10 03:14:48.146: ERROR / MediaPlayer (2060): Error (1, -1)

05-10 03:14:48.146: WARN / PlayerDriver (31): PVMFInfoErrorHandlingComplete
05-10 03:14:49.336: DEBUG / dalvikvm (225): GC freed 43 objects / 1968 bytes in 90ms
05-10 03:14:54.385: DEBUG / dalvikvm (106): GC freed 2514 objects / 142304 bytes in 132ms




Such nice? However, when playing local video can play normally? Hope to have experts to answer! ! ! !
Reply:
Network video is not http protocol is rtsp
This is a streaming media
You play your local files that are already playing
operationNetwork can not be so engaged
Reply:
Here I want to play online video should be how to get ah?
Tell me achieve program do? Thank you!
Reply:


This is the main thing that you need a server to store the network supports RTSP video resources
Client connections corresponding address on
http://blog.csdn.net/kepoon/article/details/6772060
Reply:
The reply was deleted at the moderator 2012-05-10 16:15:32

Reply:
1. Ensure that you can open http streaming media address on a computer browser
2 There http streaming and rtsp, setDataSource url can be directly transmitted, but time-consuming preparation stage of streaming media, you can not call the start function directly after prepare, need to meidplayer registered OnPreparedListener functions. In onPrepared function to call start function.
You also have the class to write the first comment there, but did not.
Reply:
Too, do not understand this stuff, learning
Reply:
i am studying your document
Reply:
mediaPlayer.setDataSource ("http://192.168.1.114:8080/webdav/china.3gp");

Here the usage right.

Should:

Uri uri = Uri.parse ("http://192.168.1.114:8080/webdav/china.3gp");
mediaPlayer.setDataSource (this, uri);


android Backspace how to achieve


            
Each one has a text input box, type a lot of character, I click backspace button to delete a character.
Now you want is to click backspace to delete the character in front of the cursor; when the character is also re-entered input before the cursor; when the first input, the cursor backward.
Ask, how does this implementation
Reply:
Seek expert answer Yeah,,,
Reply:
= Pending. .
Reply:
Landlord solved? With seeking ah
Reply:
My question is how the landlord point backspace to delete characters

android camera development setParameters failed error


            
Recently wrote a custom camera, Sky, motorcycles do the above tests are no problem, but to the htc to die at setParameters failed error, I do not know how else? Her brother help? Thank you, ah
Reply:
No detailed error information it?
Reply:
I found the main phone system that does not match, and when I set the image size, so the resulting
Reply:
I am also, how did you solve it? I was on htc g12 testing, qq: 1030103135, thanks
Reply:
Set the preview window size and image size and system support is not the same cause,
Reply:
Give solution ah ...... I also met this problem
Reply:
You have to get the system to support the camera preview size and image size. Then set
Reply:
Specifically how to set ah, masters teach me! ! ! Thanks ah

Reply:
/ / Select the appropriate size
previewList sizeList = parameters.getSupportedPreviewSizes ();

/ / If sizeList only one we do not need to do anything, because then he has no choice
aif (sizeList.size ()> 1) {
Iterator itor = sizeList.iterator ();
while (itor.hasNext ()) {
Camera.Size cur = itor.next ();
if (cur.width> = PreviewWidth
&& Cur.height> = PreviewHeight) {
PreviewWidth = cur.width;
PreviewHeight = cur.height;
break;
}
}
}

/ / Set Preview (preview) dimensions
parameters.setPreviewSize (PreviewWidth, PreviewHeight);

/ / Set the picture size
parameters.setPictureSize (Picwidth, Picheight);

Reply:
I was given .... I rely on
Reply:
try {
int PreviewWidth = 0;
int PreviewHeight = 0;
WindowManager wm = (WindowManager) getSystemService (Context.WINDOW_SERVICE) ;/ / get the window manager
Display display = wm.getDefaultDisplay () ;/ / get the window inside the screen
Camera.Parameters parameters = mCamera.getParameters ();
/ / Select the appropriate size
previewList sizeList = parameters.getSupportedPreviewSizes ();

/ / If sizeList only one we do not need to do anything, because then he has no choice
aif (sizeList.size ()> 1) {
Iterator itor = sizeList.iterator ();
while (itor.hasNext ()) {
Camera.Size cur = itor.next ();
if (cur.width> = PreviewWidth
&& Cur.height> = PreviewHeight) {
PreviewWidth = cur.width;
PreviewHeight = cur.height;
break;
}
}
}
parameters.setPreviewSize (PreviewWidth, PreviewHeight); / / get the size of the imaging area
parameters.setPreviewFrameRate (3) ;/ / 3 frames per second to get 3 pictures from the camera inside
parameters.setPictureFormat (PixelFormat.JPEG) ;/ / set the output format
photosparameters.set ("jpeg-quality", 85) ;/ / set the photo quality
parameters.setPictureSize (PreviewWidth, PreviewHeight) ;/ / set shot out of the screen size
/ /
mCamera.setParameters (parameters) ;/ / the above settings assigned to the camera
mCamera.setPreviewDisplay (mySurfaceView.getHolder ()) ;/ / get the camera screen display controls inside
in SurfaceViewmCamera.startPreview () ;/ / start preview
mPreviewRunning = true;
} Catch (IOException e) {
Log.e (TAG, e.toString ());
}
}
Reply:
After how I tried this method, when the preview screen has been flashing green preview does not see anything but it will also issue a set attribute failed. Reply
10th floor lxp5201314 of references:
try {
int PreviewWidth = 0;
int PreviewHeight = 0;
WindowManager wm = (WindowManager) getSystemService (Context.WINDOW_SERVICE) ;/ / get the window manager
Display display = wm.getDefaultDisplay () ;/ / get the window inside the screen
Cam ......

Reply:
reference to the 8th floor haojunming reply:
/ / Select the appropriate size
previewList sizeList = parameters.getSupportedPreviewSizes ();

/ / If sizeList only one we do not need to do anything, because then he has no choice
aif (sizeList.size ()> 1) {
Iterator itor = sizeList.iterator ();
while (itor.hasNext ()) {
Camera.Size cur = itor.next ();
if (cur.width> = PreviewWidth
&& Cur.height> = PreviewHeight) {
PreviewWidth = cur.width;
PreviewHeight = cur.height;
break;
}
}
}

/ / Set Preview (preview) dimensions
parameters.setPreviewSize (PreviewWidth, PreviewHeight);

/ / Set the picture size
parameters.setPictureSize (Picwidth, Picheight);

I was being given. Give me a Demo Why? Extremely grateful.
yali1014@163.com
Reply:
Why is not my resolve. .
Reply:
reference to the 12th floor xyl1014 reply:
Quote: references to the 8th floor haojunming reply:

/ / Select the appropriate size
previewList sizeList = parameters.getSupportedPreviewSizes ();

/ / If sizeList only one we do not need to do anything, because then he has no choice
aif (sizeList.size ()> 1) {
Iterator itor = sizeList.iterator ();
while (itor.hasNext ()) {
Camera.Size cur = itor.next ();
if (cur.width> = PreviewWidth
&& Cur.height> = PreviewHeight) {
PreviewWidth = cur.width;
PreviewHeight = cur.height;
break;
}
}
}

/ / Set Preview (preview) dimensions
parameters.setPreviewSize (PreviewWidth, PreviewHeight);

/ / Set the picture size
parameters.setPictureSize (Picwidth, Picheight);

I was being given. Give me a Demo Why? Extremely grateful.
yali1014@163.com



Remove the break
Reply:
Because some phones are put in ascending order of size, some descending, descending, whether large or small to arrange when you are only executed once, descending is no problem, but encountered phone is in ascending order, then it is easy to just get the smallest problem, you can print out the data the whole look, multiple phone comparison
Reply:
You can get to the data

How to communicate in real-time two Activity


            
I'm doing stuff serial communications, I find a ready serial transceiver, but need to write in an Activity inside the interface jump, I want other serial transceiver interface can also be achieved, can by One way to build a real-time communication between Activity, seek expert advice.
Reply:
A crude way is to put the data in a static class inside, 2 Activity which were constantly open a thread to get this static class data.

There is also a public data on the Service inside, Activity can also register a real-time broadcast data is received.
Reply:
The best serial transceiver and activity separate notice to each activity can change the data, radio, handler, listener callbacks can be achieved.
Reply:
Could be considered serial communication service writes, and then notify the activity issued by the broadcasting service

Based on how the android platform based on the product barcode to check the commodity prices?


            
I look to make a similar software product bar codes scanned by mobile phone, how to query based on the commodity price barcode it? ?
Please answer! ! !
Reply:
Seeking answers ah ah ah
Reply:
It is the same no answer. . . .
Reply:
There is a software called or what I look up, there is the official website prices can search platform, which information is very wide. You can use the network to connect up to get html, and then resolve.
Reply:
You have to have the service side of this interface supports job ah, or the like ls to say, after obtaining html parsing using regular, but this method did not feel too tricky, too strong variability
Reply:
There is a price api website, through which some of the parameters and the key seems to be able to get the price offered, but I do not know how to call from the phone?
reference to the third floor a328240784 reply:
software called or what I look up, there is the official website prices can search platform, which information is very wide. You can use the network to connect up to get html, and then resolve.

Reply:
To call looks like an open api interface, but do not know how to adjust?
references, 4th Floor syab1108 reply:
you have to have the service side of this interface supports job ah, or the like ls to say, after obtaining html parsing using regular, However, this method did not feel too tricky, too strong variability

Reply:
reference to the 6th floor markabao reply:
looks like to be called an open api interface, but do not know how to adjust? References to the 4th floor syab1108 reply:
You have to have the service side of this interface supports job ah, or the like ls to say, after obtaining html parsing using regular, but this method did not feel too tricky, too strong variability
. . . Sent to the site to see. .
Reply:
Barcode open source library.
zxing

You can search baidu
Reply:
Price check online merchants comparison. Looking using open api, see http://baike.baidu.com/view/7009197.htm.
reference to the 7th floor a328240784 reply:
reference to the 6th floor markabao reply:
To call looks like an open api interface, but do not know how to adjust? References to the 4th floor syab1108 reply:
You have to have the service side of this interface supports job ah, or the like ls to say, after obtaining html parsing using regular, but this method did not feel too tricky, too strong variability
. . . Sent to the site to see. .

Reply:
This zxing library just scan the bar code, I now get out of the bar code, and want to check the price based on the bar code, I do not know how to call
cited the 8th floor winter_sui reply:
barcode The open source library.
zxing

You can baidu search

Reply:
A rookie, had only done small projects J2EE direction, but not the android development, graduation actually do this, Great God answers you seek. Thank you! ! !
Reply:
reference to the 10th floor markabao reply:
this zxing library just scan the bar code, bar code, I get out now, and want to check the price based on the bar code, I do not know how to call references 8th Floor winter_sui reply:
Barcode open source library.
zxing

You can baidu search


Barcode identified should be a string of numbers or letters. This is your product ID A. Take this ID to check the goods inside the shell.
If you ask me, what if commodities. Then I was speechless.

Reply:
In fact, these features certainly has a similar API provided by a third party, the landlord can go to find.
Reply:
Thank you for your answer me this API Study
Reply:
Long time no csdn on, come Guanguan!
Reply:
I am also looking for a long time did not find any open API or interface, which can do ah hey ~
Reply:
Direct write their own servers. . . .
Reply:
Will the landlord, this issue is resolved yet, with demand

Help, socket connected to the network debugging assistant can not get fat? ?


posts by bigbillybear edited 2012-03-31 10:44:04
Brother wrote a socket connected to a computer program, but found to not get fat, but I wrote a server program, the client will be able to receive it? ? Is that why it? ? ?
I think the program is estimated no problem

Client: pitch-catch. . . . PC network debugging assistant hair received, but the client will block read that
 
public class Main extends Activity
{

public void onClick_Data_Transmit (View view)
{
try
{
Socket socket = new Socket ("114.250.22.85", 7002);

OutputStream os = socket.getOutputStream ();
OutputStreamWriter osw = new OutputStreamWriter (os);
BufferedWriter bw = new BufferedWriter (osw);
bw.write ("111111111111");
bw.flush ();

InputStream is = socket.getInputStream ();
InputStreamReader isr = new InputStreamReader (is);
BufferedReader br = new BufferedReader (isr);
String s = "";
TextView textView = (TextView) findViewById (R.id.textview);
s = br.readLine ();
/ / While ((s = br.readLine ())! = Null)
textView.append (s + "\ n");
socket.close ();
}
catch (Exception e)
{
/ / TODO: handle exception
}
}
}


I wrote a server:
 
class SimpleServer
{
public static void main (String [args)
throws IOException
{
/ / Create a ServerSocket, Socket to listen for client connection requests
ServerSocket ss = new ServerSocket (7002);
/ / Use cycle continuously receiving requests from the client
while (true)
{
/ / Whenever Socket client receives the request, the server also generates a corresponding Socket
Socket s = ss.accept ();
OutputStream os = s.getOutputStream ();
os.write ("Hello, you receive the server's New Year greeting!"
. GetBytes ("utf-8"));
/ / Close the output stream, close Socket
os.close ();
s.close ();
}
}
}


Some people say to add the / r / n in the data sent, I added, or wood with ah ~ ~ ~

Reply:
I found the network debugging assistant disconnected. . . Client actually received the code. . . . However, / r / n or the like as a character string to be completely received. . . .
Reply:
In hexadecimal display with 0D 0A
Reply:
reference to the second floor of the reply:
in hexadecimal display with 0D 0A

Sure enough so
Reply:
Thank you thank you, bothering me one day, I really do not know how to thank you
Reply:
reference to the second floor soundbird reply:
in hexadecimal display with 0D 0A

I would like to ask, why do so you can communicate it
Reply:
references, 5th Floor u013044300 reply:
Quote: references to the second floor soundbird reply:

In hexadecimal display with 0D 0A

I would like to ask, why do so you can communicate with it

Indicates the end

How to shield Android Home button


            
I think on the inside of my Activity shielded Home button, watch my activity lunchMode is singleInstance. It is FullScreen. Requires shielding the Home key method does not affect the full-screen display (onAttatchToWindow not), and can be used in all android versions, not tight or a limited android4.0 platform. Please understand took stickers, help us put this out android who will encounter the problem completely resolved. Know how to say how much, we got closer, I'll summarize a.
Reply:
I would like to say that my problems encountered Ha, my Activity is full screen. Press the Home key to the future when there is a recent mission pop up, then come call, my program is SIP telephony program. But recently, the system is still in the above tasks, under my Activity is full screen. Into other programs, and then back to my program will be above the status bar (with getWindow (). SetType method set TYPE_KEYGROUND, in onAttatchOnWindow inside, if not set, then no problem). However, the program must be shielded Home. So I want to learn about other ways to shield Home, and this way I can shield the following version 2.2. Daniel seeking advice, vigorously scattered points
Reply:
Principle is to reload button in response to events
Reply:
The home key you can not do, windowmanagerservice of policy, phonewindowmanager before distribution key will first determine whether you want to distribute this event, in interceptKeyBeforeDispatching inside, he intercepted the home key.
Reply:
Ditto, home treatment is not distributed to the topmost View that went
Reply:
But it looks like I have seen in the post there buddy
position using the following method
Cite 17th floor nj_dobetter reply:

Make sure to add the following permissions in AndroidManifest.xml inside:



References ......

Thank you very much for your help, with your approach to indeed achieve a shield home button, but brings along a problem that the screen (my lock screen activity) can not respond to touch events, and I want the user by clicking on the screen block all keys except the off button on the outside of the button to unlock, so I based on your tips to your methods were slightly modified to achieve the full screen and can respond to the keyboard. Share my method:
================================================== ===============
Statement permissions:



Declare the function and activity class members:

Runnable mDisableHomeKeyRunnable = new Runnable () {

@ Override
public void run () {
disableHomeKey ();

}
};

Handler mHandler = new Handler ();

public void disableHomeKey ()
{
this.getWindow () setType (WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);.
}

In onCreate call:
mHandler.postDelayed (mDisableHomeKeyRunnable, 200);
================================================== ============


But I'm on my samsung System 2.3.4 in the interview for a moment, only to shield press, not shielded short press, who knows how it

Reply:
Well, do not tangle with the shield Home, it is best not to shield encountered asked feeds from the front solved. My solution of the BUG, ​​you only need to send a broadcast system to get rid of the DLG on OK
Reply:

A puzzled about downloading files


            
android by HttpURLConnection download files exactly apk files on the file size and the server to get the download is complete, but the apk file with the server files do not get the same, suggesting that it is illegal to install apk, it was not proven legitimate apk, But wonder children are exactly the same size ah, is it in the download process where a subtle difference? (A total of 45 points got left,,,,)
protected SizeData doInBackground (String. .. params) {
Log.e (TAG, "doInBackground");
int totalLength = urlConn.getContentLength ();
onStart (Math.max (0, totalLength), startLocation) ;/ / notice, ready to start

SizeData result = null;
int downloadSize = 0;
try {
inputStream = urlConn.getInputStream ();
} Catch (IOException e1) {
e1.printStackTrace ();
result = SizeData.createErrorData (downloadSize);
}

if (inputStream! = null) {
try {
outputStream = getFileStream (tempPath);
} Catch (IOException e1) {
e1.printStackTrace ();
result = SizeData.createErrorData (downloadSize);
}

byte [] bufByte = new byte [128];
int receiveCount = noticeBitSize / 128;
int curtCount = 0;
try {
while (alive) {
curtCount + +;
int count = inputStream.read (bufByte);
if (count == -1) {
Log.e (TAG, tempPath + "Download Complete");
onReceiveSuccess (downloadSize);
curtCount = 0;
result = SizeData.createRightData (downloadSize);
break;
}

if (count == 0) {
result = SizeData.createErrorData (downloadSize);
break;
}

outputStream.write (bufByte, 0, count);
downloadSize + = count;
if (curtCount> = receiveCount) {
onReceiveSuccess (downloadSize);
curtCount = 0;
}
}
} Catch (IOException e) {
e.printStackTrace ();
result = SizeData.createErrorData (downloadSize);
}

if (! alive) {
result = SizeData.createOtherData (downloadSize);
}

try {
outputStream.flush ();
} Catch (IOException e) {
e.printStackTrace ();
} Finally {
try {
outputStream.close ();
} Catch (IOException e) {
e.printStackTrace ();
}
}
}

return result;
}
Reply:
You can save the file on the server MD5 code, after downloading the file server to complete the calculation of MD5 and MD5 file in the terminal for comparison to determine whether to download the file is complete. Download the file on your code does not look, GOOGLE what many ready-made code
Reply:
cited a floor sinom reply:
can save the file on the server MD5 code, after downloading the file server to complete the calculation of MD5 and MD5 file in the terminal for comparison to determine whether to download the file is complete. Download the file on your code does not look, GOOGLE what many ready-made code
MD5 checksum is currently no way to use and is currently judged by the size of the file is downloaded and getContentLength () Comparison

tabhost nested scrollview can not scroll up and down? ? ? ? ?


            
tabhost the content, the use of a scrollview, when the height does not exceed the height of the phone screen to scroll up and down, how to solve? ? ?
Of course, if you have an alternative, you can. . .
The code:
android: id = "@ + id / mediatabhost"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent">

android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: orientation = "vertical">

android: id = "@ android: id / tabs"
android: layout_width = "fill_parent"
android: layout_height = "50.0dip"
android: layout_gravity = "top"
android: background = "@ drawable / suma_tab_bkg"
android: paddingBottom = "0.0dip"
android: paddingLeft = "0.0dip"
android: paddingRight = "0.0dip"
android: paddingTop = "1.0dip" />

android: id = "@ android: id / tabcontent"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: orientation = "vertical">

android: id = "@ + id/suma_media_tab1"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: scrollbarStyle = "insideOverlay"
android: scrollbars = "vertical">


android: layout_width = "fill_parent"
android: layout_height = "wrap_content"
layout = "@ layout / layout_media_detail_desc" />



layout_media_detail_desc.xml (This file nothing special)

android: id = "@ id / media_detail_desc"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: orientation = "vertical">

android: id = "@ id / suma_media_detail_tv_director"
android: layout_width = "wrap_content"
android: layout_height = "20dip"
android: layout_weight = "1"
android: textColor = "# 000000" />

android: id = "@ id / suma_media_detail_tv_actor"
android: layout_width = "wrap_content"
android: layout_height = "20dip"
android: layout_weight = "1"
android: textColor = "# 000000" />

android: id = "@ id / suma_media_detail_tv_description"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: layout_marginTop = "20dp"
android: textColor = "# 000000" />


Reply:
ScrollView should be placed in the outermost layer of your tabhost.
 android: id = "@ + id/suma_media_tab1" 
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: scrollbarStyle = "insideOverlay"
android: scrollbars = "vertical">
. . . . . . .


Reply:
cited a floor ncepu307 reply:
ScrollView should be placed in the outermost layer of your tabhost.
 android: id = "@ + id/suma_media_tab1" 
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: scrollbarStyle = "insideOverlay"
android: scrollbars = "vertical">
. . . . . . .


1st Floor, hello, you use the wrong of this, ah, are directly connected tabhost scroll up and down the title.
Reply:
How nobody can return it? ? Csdn so fewer people are now?
Reply:
tabhost The id should be set up so it .......?
android: id = "@ android: id / tabhost"
Reply:
references, 4th Floor u012476249 reply: id should be set
tabhost like it .......?
android: id = "@ android: id / tabhost"


No, it is. . . If the Activity inherited from TabActivity so id Andrews built-id, just like you write. If you do not inherit,
So id can easily write
Reply:
references, 5th Floor leehu1987 reply:
Quote: references to the 4th floor u012476249 reply:

tabhost The id should be set up so it .......?
android: id = "@ android: id / tabhost"


No, it is. . . If the Activity inherited from TabActivity so id Andrews built-id, just like you write. If you do not inherit,
So id can easily write


Well ... this is the way, but I have inherited TabActivity Activity wooden Yeah ....
And why did you want to pack a LinearLayout outside TabWidget it?
Reply:
reference to the 6th floor u012476249 reply:
Well ... this is the way, but I have inherited TabActivity Activity wooden Yeah ....
And why did you want to pack a LinearLayout outside TabWidget it?


TabWidget heading can be understood as a tabhost, the latter tabcontent content. After adding LinearLayout, can make the title, content installed vertically order. Specific reason is that I found the following version 3.0 style confusing, so before adding this LinearLayout. Then tabcontent after FrameLayout assembled tab.

Also you do not inherit TabActivity, then use getTabHost id you get to?
Reply:
reference to the 7th floor leehu1987 reply:
Quote: references to the 6th floor u012476249 reply:

Well ... this is the way, but I have inherited TabActivity Activity wooden Yeah ....
And why did you want to pack a LinearLayout outside TabWidget it?


TabWidget heading can be understood as a tabhost, the latter tabcontent content. After adding LinearLayout, can make the title, content installed vertically order. Specific reason is that I found the following version 3.0 style confusing, so before adding this LinearLayout. Then tabcontent after FrameLayout assembled tab.

Also you do not inherit TabActivity, then use getTabHost id you get to?


Possible eh

Issues related to R file resources can not be referenced


            
R file has this:
public static final class drawable {
public static final int ic_launcher = 0x7f020000;
public static final int widget_battery_bg1 = 0x7f020001;
}
But I was being given such references in the java file:
mImageView.setImageResource (R.drawable.widget_battery_bg1);

Error message:
widget_battery_bg1 cannot be resolved or is not a field

highly dynamic setting edittext android


            
I used setMaxLines () and setHeight, will not work, you come across someone
Reply:
Layout nothing special
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: layout_weight = "1.0"
android: autoText = "true"
android: capitalize = "sentences"
android: hint = "@ string / type_to_compose_text_enter_to_send"
android: textCursorDrawable = "@ null"
android: textColor = "@ android: color / black"
android: maxLines = "4"
android: nextFocusRight = "@ + id / send_button"
android: gravity = "top" />
Reply:
By LayoutParams set!
Reply:
 int newHeight = 200; 
/ / Note that here, in the end is still using ViewGroup LinearLayout or FrameLayout, mainly to see you this EditTex
/ / Controls where the layout of the parent control is what, if LinearLayout, then here he will change LinearLayout.LayoutParams
ViewGroup.LayoutParams lp = editText.getLayoutParams ();
lp.height = newHeight;
editText.setLayoutParams (lp);

Reply:
reference to the second floor fzty1126410594 reply:
can LayoutParams set!

Ah, thank you, this can be set. . I would like to ask, is there a way to get the edittext display line, because the resolution of issues to consider cell phone may not set a fixed height. . If you can set the display line will feel a little better
Reply:
reference to the third floor ncepu307 reply:
 int newHeight = 200; 
/ / Note that here, in the end is still using ViewGroup LinearLayout or FrameLayout, mainly to see you this EditTex
/ / Controls where the layout of the parent control is what, if LinearLayout, then here he will change LinearLayout.LayoutParams
ViewGroup.LayoutParams lp = editText.getLayoutParams ();
lp.height = newHeight;
editText.setLayoutParams (lp);


Ah, thank you, this can be set. . I would like to ask, is there a way to get the edittext display line, because the resolution of issues to consider cell phone may not set a fixed height. . If you can set the display line will feel a little better
Reply:
references, 5th Floor lichao6934 reply:
Quote: references to the third floor ncepu307 reply:

 int newHeight = 200; 
/ / Note that here, in the end is still using ViewGroup LinearLayout or FrameLayout, mainly to see you this EditTex
/ / Controls where the layout of the parent control is what, if LinearLayout, then here he will change LinearLayout.LayoutParams
ViewGroup.LayoutParams lp = editText.getLayoutParams ();
lp.height = newHeight;
editText.setLayoutParams (lp);


Ah, thank you, this can be set. . I would like to ask, is there a way to get the edittext display line, because the resolution of issues to consider cell phone may not set a fixed height. . If you can set the display line will feel a little better


Before you call setMaxLines, first call setSingleLine (false);
 edittext.setSingleLine (false); 
edittext.setMaxLines (2);

Reply:
reference to the 6th floor ncepu307 reply:
Quote: references, 5th Floor lichao6934 reply:

Quote: references to the third floor ncepu307 reply:

 int newHeight = 200; 
/ / Note that here, in the end is still using ViewGroup LinearLayout or FrameLayout, mainly to see you this EditTex
/ / Controls where the layout of the parent control is what, if LinearLayout, then here he will change LinearLayout.LayoutParams
ViewGroup.LayoutParams lp = editText.getLayoutParams ();
lp.height = newHeight;
editText.setLayoutParams (lp);


Ah, thank you, this can be set. . I would like to ask, is there a way to get the edittext display line, because the resolution of issues to consider cell phone may not set a fixed height. . If you can set the display line will feel a little better


Before you call setMaxLines, first call setSingleLine (false);
 edittext.setSingleLine (false); 
edittext.setMaxLines (2);


Ah did not respond, according to what you write. I do not know why online are generally written. . I put the entire parent layout posted
android: id = "@ + id / bottom_panel"
android: layout_width = "match_parent"
android: layout_height = "wrap_content"
android: orientation = "horizontal"
android: paddingBottom = "2dip"
android: paddingLeft = "5dip"
android: paddingRight = "5dip"
android: paddingTop = "5dip">
android: id = "@ + id / editor_with_counter"
android: layout_width = "wrap_content"
android: layout_height = "match_parent"
android: layout_weight = "1.0"
android: orientation = "horizontal">

android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: layout_weight = "1.0"
android: autoText = "true"
android: capitalize = "sentences"
android: hint = "@ string / type_to_compose_text_enter_to_send"
android: textCursorDrawable = "@ null"
android: textColor = "@ android: color / black"
android: maxLines = "4"
android: nextFocusRight = "@ + id / send_button"
android: gravity = "top" />
Reply:
reference to the 7th floor lichao6934 reply:
Quote: references to the 6th floor ncepu307 reply:

Quote: references, 5th Floor lichao6934 reply:

Quote: references to the third floor ncepu307 reply:

 int newHeight = 200; 
/ / Note that here, in the end is still using ViewGroup LinearLayout or FrameLayout, mainly to see you this EditTex
/ / Controls where the layout of the parent control is what, if LinearLayout, then here he will change LinearLayout.LayoutParams
ViewGroup.LayoutParams lp = editText.getLayoutParams ();
lp.height = newHeight;
editText.setLayoutParams (lp);


Ah, thank you, this can be set. . I would like to ask, is there a way to get the edittext display line, because the resolution of issues to consider cell phone may not set a fixed height. . If you can set the display line will feel a little better


Before you call setMaxLines, first call setSingleLine (false);
 edittext.setSingleLine (false); 
edittext.setMaxLines (2);


Ah did not respond, according to what you write. I do not know why online are generally written. . I put the entire parent layout posted
android: id = "@ + id / bottom_panel"
android: layout_width = "match_parent"
android: layout_height = "wrap_content"
android: orientation = "horizontal"
android: paddingBottom = "2dip"
android: paddingLeft = "5dip"
android: paddingRight = "5dip"
android: paddingTop = "5dip">
android: id = "@ + id / editor_with_counter"
android: layout_width = "wrap_content"
android: layout_height = "match_parent"
android: layout_weight = "1.0"
android: orientation = "horizontal">

android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: layout_weight = "1.0"
android: autoText = "true"
android: capitalize = "sentences"
android: hint = "@ string / type_to_compose_text_enter_to_send"
android: textCursorDrawable = "@ null"
android: textColor = "@ android: color / black"
android: maxLines = "4"
android: nextFocusRight = "@ + id / send_button"
android: gravity = "top" />

Oh, right
setSingleLine (false); to be placed in front of setText.
Which is the last call to setText try again
Reply:
A great relationship with the calling sequence
Reply:
reference to the 9th floor ncepu307 reply:
a great relationship with the calling sequence

Ah, yes, I'm wondering about, thank you very much

apk decompile nothing changed repackaged error solved


            
invalid resource directory name: f: \ tang \ res / drawable-xhdpi
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.Androl
ibException: brut.common.BrutException: could not exec command: [aapt, p, - min-
sdk-version, 8, - target-sdk-version, 15,-F, C: \ Users \ ADMINI ~ 1 \ AppData \ Local \ Te
mp \ APKTOOL15587.tmp, -0, arsc,-I, C: \ Users \ Administrator \ apktool \ framework \ 1.ap
k,-S, f: \ tang \ res,-M, f: \ tang \ AndroidManifest.xml]
at brut.androlib.Androlib.buildResourcesFull (Androlib.java: 358)
at brut.androlib.Androlib.buildResources (Androlib.java: 283)
at brut.androlib.Androlib.build (Androlib.java: 206)
at brut.androlib.Androlib.build (Androlib.java: 176)
at brut.apktool.Main.cmdBuild (Main.java: 228)
at brut.apktool.Main.main (Main.java: 79)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not
exec command: [aapt, p, - min-sdk-version, 8, - target-sdk-version, 15,-F, C: \
Users \ ADMINI ~ 1 \ AppData \ Local \ Temp \ APKTOOL15587.tmp, -0, arsc,-I, C: \ Users \ Admin
istrator \ apktool \ framework \ 1.apk,-S, f: \ tang \ res,-M, f: \ tang \ AndroidManifest.x
ml]
at brut.androlib.res.AndrolibResources.aaptPackage (AndrolibResources.jav
a: 357)
at brut.androlib.Androlib.buildResourcesFull (Androlib.java: 336)
... 5 more
Caused by: brut.common.BrutException: could not exec command: [aapt, p, - min-sd
k-version, 8, - target-sdk-version, 15,-F, C: \ Users \ ADMINI ~ 1 \ AppData \ Local \ Temp
\ APKTOOL15587.tmp, -0, arsc,-I, C: \ Users \ Administrator \ apktool \ framework \ 1.apk,
-S, f: \ tang \ res,-M, f: \ tang \ AndroidManifest.xml]
at brut.util.OS.exec (OS.java: 89)
at brut.androlib.res.AndrolibResources.aaptPackage (AndrolibResources.jav
a: 355)
... 6 more
Reply:
Seems to re-sign the
Reply:
cited a floor guoyoulei520 reply:
like re-signing




However, it is re-sign apk signature not know why you do not
Reply:
reference to the second floor ruilina reply:
Quote: references to a floor guoyoulei520 reply:

Seems to re-sign the




However, it is re-sign apk signature not know why you do not

Internet seems to have a special tool, you look for the Internet
Reply:
Apk duplicate signatures, it needs to apk package inside MATE-INF folder deleted.
Reply:
references, 4th Floor a220315410 reply:
duplicate signatures apk, then, need to apk package inside MATE-INF folder deleted.



I did not come out decompile MATE-INF file decompiler is to have assets lib res smali four folders and AndroidManifest.xml / apktool.yml
Reply:
aapt.exe not
Reply:
You can look at this article (similar issues)
http://blog.csdn.net/tibib/article/details/8876615
Reply:
references, 5th Floor ruilina reply:
Quote: references to the 4th floor a220315410 reply:

Apk duplicate signatures, it needs to apk package inside MATE-INF folder deleted.



I did not come out decompile MATE-INF file decompiler is to have assets lib res smali four folders and AndroidManifest.xml / apktool.yml


Last time I encountered this problem when indeed MATE-INF deleted this folder can be signed. Possible reasons for your mistakes and I was not the same bar.
Reply:
f: \ tang \ res / drawable-xhdpi

The folder path, you are so determined to write?
Reply:
aapt old version
Reply:
The landlord, how about your situation how?

After progurad program can not run


            
Apk packaged properly after installation may be out of the running, but after playing the apk with proguard confuse normal installation, but even when running on the flash screen to get in the back, there is no error, and then I put all the items in the category both keep out, and then packaged by proguard, but it is still running flash back. I do not know how to engage
Reply:
That is certainly not the code you confused, as no anomalies rather strange! Can be confusing code stickers!

Android application development eclipse java, visual controls are right (like VB, DELPHI)?


            
Android application development eclipse java, visual controls are right (like VB, DELPHI)?
If you manually edit it would be too tired, can not like VB, DELPHI, C + + BUILDER as visual programming it?
Reply:
There visualization, but a lot worse and C + + Builder that level, it is not recommended to use visualization tools, most of them own a little bit of writing.
Reply:
No CB so smart
Reply:
There is also a visual interface like it, but the function is not so powerful, can be used like.

Reply:
There are tools. However, the manual is king ah
Reply:
Like visual interface that, but not so powerful functionality
Reply:
Generally do not have visual limitations bigger
Reply:
Can not visualize, develop it very troublesome ah
Reply:
cited a floor birdsaction reply:
have visualization, but a lot worse, and C + + Builder that level, it is not recommended to use visualization tools, most of them own a little writing.

Why not visualize it? ? ? We do not use the development tools in order to reduce development pressures and the difficulty it?
Reply:
You can use some resources directly from these R classes in your own applications, but you should generally use only resources that you've provided directly in your application, in order to provide a cohesive application package that has no external dependencies. In particular, you should not use drawable resources from the android package, because they may change between platform versions, causing unforeseen conflicts with your design. Typically, styles are the only resources you should use directly from these resources.
android developer documentation inside this sentence, as if that is not recommended to use visual controls. Is that right?
Reply:
reference to the 8th floor cankoo reply:
[Quote = reference to a floor birdsaction reply:]

There visualization, but a lot worse and C + + Builder that level, it is not recommended to use visualization tools, most of them own a little bit of writing.

Why not visualize it? ? ? We do not use the development tools in order to reduce development pressures and the difficulty it?
Reply:
Can it

Reply:
Indeed, ask God to open a large lecture hall, to a few simple examples. Ready to turn the mobile platform.

Android calls ASMX issues, life and death unsuccessful.


            
I saw them in the online code is very simple, but I'm not here to live or die, why ah?
I just follow this tutorial to get, http://hi.baidu.com/java6666/blog/item/9fa635176b517f06962b4332.html

I downloaded and imported the jar package, add the then write a few lines of code
private static String SOAP_ACTION = "http://tempuri.org/HelloWorld";

private static String NAMESPACE = "http://tempuri.org/";
private static String METHOD_NAME = "HelloWorld";

private static String URL = "http://192.168.1.100:92/MyWebService.asmx?WSDL";



@ Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.main);

/ / Initialize soap request + add parameters
try
{
SoapObject request = new SoapObject (NAMESPACE, METHOD_NAME);
}
catch (Exception e)
{
String a = e.getMessage ();
}


}

It's that simple lines of code, an execution to SoapObject request = new SoapObject (NAMESPACE, METHOD_NAME); mistake, say what Source Not Found error:
/ / Compiled from InvocationTargetException.java (version 1.5: 49.0, super bit)
public class java.lang.reflect.InvocationTargetException extends java.lang.Exception {

/ / Method descriptor # 8 () V
/ / Stack: 3, Locals: 1
protected InvocationTargetException ();
0 aload_0 [this]
1 invokespecial java.lang.Exception () [1]
4 new java.lang.RuntimeException [2]
7 dup
8 ldc [3]
10 invokespecial java.lang.RuntimeException (java.lang.String) [4]
13 athrow
Line numbers:
[Pc: 0, line: 5]
Local variable table:
.......

Baffled, please help us to see how the matter?
Reply:
Android development environment ADT17 later, to refer to a jar, add a reference to the object in addition to before, you need to select the package in the Order and Export.

Specifically, is this: Select the Project -> Java Build Path-> Select Label Order and Export-> select the class did not find the jar package or project contains -> click OK.

See if it is the cause of this?
Reply:
Android development environment ADT17 later, to refer to a jar, add a reference to the object in addition to before, you need to select the package in the Order and Export.

Specifically, is this: Select the Project -> Java Build Path-> Select Label Order and Export-> select the class did not find the jar package or project contains -> click OK.

See if it is the cause of this?
Reply:
Sure enough, this is the problem, like all elected
Reply:
2nd floor badly ah, really suddenly resolved
Reply:

Reply:
GOOD V F
Reply:

Reply:
Powerful, really master ah

HttpURLConnection in connection.getInputStream () reported abnormal FileNotFoundException


            
The AVD test no problem. Times change to the device FileNotFound abnormalities frequently reported this exception. Help us to see.
Code is as follows:
 
public class HttpAssist {


public static String doPost (JSONObject json) throws IOException {
URL postUrl = new URL (Config.url);
HttpURLConnection connection = (HttpURLConnection) postUrl.openConnection ();
connection.setDoOutput (true);
connection.setDoInput (true);
connection.setRequestMethod ("POST");
connection.setUseCaches (false);

connection.connect ();
OutputStreamWriter out = new OutputStreamWriter (connection
. GetOutputStream ());
out.write (Config.getParameterName + "=" + json.toString ());
out.flush ();
out.close (); / / flush and close
BufferedReader reader = new BufferedReader (new InputStreamReader (connection.getInputStream (), "utf-8"));
String line = "";
String res = "";
while ((line = reader.readLine ())! = null) {
res + = line;
System.out.println (line);
}
reader.close ();
connection.disconnect ();

return res;
}
}


Abnormal follows:


Is not always reported, but often reported this exception. Investigation for a long time have not found something useful. You, to see you. . .
Reply:
Server daemon is not reported an error, such as a 500 error or something.
Reply:
Get current proposal before the judge responseCode 200.
Reply:
reference to the second floor birdsaction reply: Get current proposal before
judgment responseCode is 200
good my first try.
Reply:
This is your ip should be, you need this test within the LAN phone with this pc is using the same router!
Reply:
references, 4th Floor u011133213 reply:
you this ip is, it should be, you need this test phone with this pc is using the same router LAN !

Well yes. Otherwise not visit.
Reply:
Then you'll see the return code to determine the next state
Reply:
The same question, I also encountered this problem. And network access permissions are configured.

android client gets the version number apk files on the FTP server


            
I will now install APK files stored on an FTP server, check the FTP client on the mobile version number is higher than the version number of the mobile device, if there is a new version of the FTP, then download the apk to the mobile terminal, how to get on FTP The APK version number, FTP with only one apk installation file
Reply:
If you want to download the entire APK to determine the version number, the price is not too much points, phone traffic valuable ah.
Usually with a small text file or xml file to determine the version number.
Reply:
We are all on the server and put an xml file, and read this file to determine whether or not to upgrade
Reply:
Ah, I thought back to this idea of ​​a problem
I began to think after extracting apk file, reads the configuration file, but it does not seem to be read remotely
Reply:
Why not get hold of the interface it?
Reply:
The server supports HTTP, it is theoretically possible to support this feature.
Need to resolve their landlord zip format,
Then AndroidManifest.xml codecs, and then determine the version number.

Just download the stored data interval ZIP Index of area and AndroidManifest.xml.
Loss of flow is not.

In fact, the second floor is the most convenient way:
reference to the second floor cclovescw reply:
we are all on the server and put an xml file, and read this file to determine whether or not to upgrade
< / fieldset>
Reply:
Read xml configuration file, we are engaged in is so

Will write Android games efficiency with JBOX2D Why so low?


            
Although the configuration of the phone is not high, but also what to play 3D games without pressure.
Today, with JBOX2D wrote a test, that many small boxes collide, twelve Fortunately,
A number of multi-box, the card was terrible, I used "Android game development Guinness" in the program to run also,
Virtual machine or machines are very real card. Will be how to optimize?

There are Android game development engines should use what is good, COCOS2D looks like Apple's, I heard it pits Android version is not it? Hardly any tutorial.
Reply:
I also recently developed by JBOX2D found a simple little ball hits the wood game cards are almost as slow motion it. I do not know the reason Jbox2d, or SurfaceView thing, but I heard that Angry Birds is developed by JBox2D ah, it Zebu card ah? What is the reason? Great God needed to explain ah ・ ・ ・
Reply:
cited a floor xiaoxiaohude reply:
I also recently developed by JBOX2D found a simple little ball hits the small pieces of wood are card games, almost can be a slow motion up. I do not know the reason Jbox2d, or SurfaceView thing, but I heard that Angry Birds is developed by JBox2D ah, it Zebu card ah? What is the reason? Need to explain the great God ah ・ ・ ・

Later, I checked the documentation, that the right should be used BOX2D development, rather than JBOX2D, JBOX2D development JAVASE program Fortunately, mobile client program card was not, I thought I was wrong method, I got someone else's example program, are also is the card to death, Andrews famous game engine ANDENGINE use is BOX2D, rather than JBOX2D, angry birds should also BOX2D.
Reply:
Try this era there from a 2D flash game with box2d physics engine
Reply:
reference to the second floor u010250805 reply:
Later, I checked the documentation, that the right should be used BOX2D development, rather than JBOX2D, JBOX2D program also developed JAVASE Well, the mobile terminal program card was not, I thought I was wrong method, I got someone else's example program, are also terribly cards, Andrews famous game engine ANDENGINE use is BOX2D, rather than JBOX2D, angry birds should also BOX2D.

Ah, I am also new to these days ANDENGINE, the need to use the source code to compile the jar, and the need for ADT 17 or later, tangled, simply direct download a andengine.jar, is learning to use ・ ・ ・
Reply:
references, 4th Floor xiaoxiaohude reply:
Quote: references to the second floor u010250805 reply:

Later, I checked the documentation, that the right should be used BOX2D development, rather than JBOX2D, JBOX2D development JAVASE program Fortunately, mobile client program card was not, I thought I was wrong method, I got someone else's example program, are also is the card to death, Andrews famous game engine ANDENGINE use is BOX2D, rather than JBOX2D, angry birds should also BOX2D.

Ah, I am also new to these days ANDENGINE, the need to use the source code to compile the jar, and the need for ADT 17 or later, tangled, simply direct download a andengine.jar, is learning to use ・ ・ ・

What you learn Andengine teaching, I used Andengine authors recommended "Android Game Developer's Guide", found inside the book with older versions of Andengine, with many API are different now. Andengine I am helpless place is a different version of the API are not the same, and even the version do not know.
Reply:
references, 5th Floor u010250805 reply:
Quote: references to the 4th floor xiaoxiaohude reply:

Quote: references to the second floor u010250805 reply:

Later, I checked the documentation, that the right should be used BOX2D development, rather than JBOX2D, JBOX2D development JAVASE program Fortunately, mobile client program card was not, I thought I was wrong method, I got someone else's example program, are also is the card to death, Andrews famous game engine ANDENGINE use is BOX2D, rather than JBOX2D, angry birds should also BOX2D.

Ah, I am also new to these days ANDENGINE, the need to use the source code to compile the jar, and the need for ADT 17 or later, tangled, simply direct download a andengine.jar, is learning to use ・ ・ ・

What you learn Andengine teaching, I used Andengine authors recommended "Android Game Developer's Guide", found inside the book with older versions of Andengine, with many API are different now. Andengine I am helpless place is a different version of the API are not the same, and even the version do not know.

I see this a few days learning tutorial:
http://blog.csdn.net/cen616899547/article/category/1269391

Android system and the corresponding Action broadcasting rights


            
Who android common system broadcasts Action and the corresponding privileges \

Reply:
Permission is not required to receive the broadcast, as long as that class inherit a broadcast receiver on the line, and then to determine which broadcast through action, and then react
Reply:
cited a floor ouyangfan54 reply:
is not required to receive broadcast rights, as long as that class inherit a broadcast receiver on the line, and then to determine which through action broadcast, and then react


For example, I get the system boot, the system shuts down the screen to get
So not all need permission to do?
Reply:
reference to the second floor siyehua reply:
Quote: references to a floor ouyangfan54 reply:

Permission is not required to receive the broadcast, as long as that class inherit a broadcast receiver on the line, and then to determine which broadcast through action, and then react


For example, I get the system boot, the system shuts down the screen to get
So not all need permission to do?

System boot, the screen will be issued to close these are broadcast, you simply can not operate issued by the broadcast, if you want to operate it would need permission, but the operation is not related with the radio, you only need to add a configuration file in the list of those authority on the line
Reply:
reference to the third floor ouyangfan54 reply:
Quote: references to the second floor siyehua reply:

Quote: references to a floor ouyangfan54 reply:

Permission is not required to receive the broadcast, as long as that class inherit a broadcast receiver on the line, and then to determine which broadcast through action, and then react


For example, I get the system boot, the system shuts down the screen to get
So not all need permission to do?

System boot, the screen will be issued to close these are broadcast, you simply can not operate issued by the broadcast, if you want to operate it would need permission, but the operation is not related with the radio, you only need to add a configuration file in the list of those authority on the line


I know ah, now I just want those tables and corresponding privileges Action

Seek guidance on the issue of developing Android APP


            
I think in college rookie 一枚 APP is kind of like the development of a micro-channel APP as I do not want because it is self detours I just wanted to ask what you want to develop an Android APP need to learn that their knowledge will be better APP There java database there anything? Now we are going to learn a complete javase the school did not know what I thought I was after reading javase learning database and then what should I learn? ? 3 css framework of what is still seeking guidance, etc. Thank you! !
Reply:
Students, you want to develop android APP and you also said to be direct, then do not do what so many useless java database ah what css what three frameworks, do not require you to figure out your goal is to develop android APP, then you have to do now is learn a little basic android app development technology
1, pre android application development environment to build, Eclipse + ADT ---- lot of this information online, Baidu Google a lot.
2, to understand the basics of android application development ------ Internet has recommended that look a little android SDK API Guides, API demos, or buy books on the android development example look
3, heat enough, just start writing your application, express your ideas in the world of code, so you upgrade the fastest, most direct, efficiency is highest. ---- The first two steps to spend time not too long, a week is sufficient. This stage, is developed while studying, do not know will not be used directly to find information, you can use the digest, which do not produce results yet?
There is a need to adhere Yeah ~ Finally, I wish you success!

has a black screen after ubuntu 11.04 start android 4.0 emulator


            
Command
wbhuang @ ubuntu: ~ / software / android-sdk-linux / tools $ / emulator-avd android-14
.After starting the simulator, the simulator has not reflected on a black screen, what would be the reason?

PS:
I created AVD as follows:
1, first check the target,
wbhuang @ ubuntu: ~ / software / android-sdk-linux / tools $ / android list
.Available Android targets:
----------
id: 1 or "android-14"
Name: Android 4.0
Type: Platform
API level: 14
Revision: 3
Skins: WXGA720, HVGA, WVGA854, QVGA, WXGA800, WQVGA432, WSVGA, WQVGA400, WVGA800 (default)
ABIs: armeabi-v7a
----------
....

2 Create AVD
wbhuang @ ubuntu: ~ / software / android-sdk-linux / tools $ / android create avd - force-n android-14 - target 1
.
3, start AVD
wbhuang @ ubuntu: ~ / software / android-sdk-linux / tools $ / emulator-avd android-14
.Then the following message appears
emulator: emulator window was out of view and was recentered

4, the next screen appears simulator, but the system has not up on a black screen, and even these few start android character interface could not see.


Where is wrong? Seeking heroes look, thank!

Reply:
I also happen, the landlord should find the reason of it, said that under the reasons for it, but also to facilitate future have a friend the same problem.
Reply:
cited a floor xyh666168 reply:
I also happen, the landlord should find the cause of it, said that under the reasons for it, but also to facilitate future have the same Friends of the problem.


4.0 The question you like another version
Reply:
I have encountered, sometimes restart drinks Well, not on another version of what junk stuff have to use this
Reply:
Do not use 4.0, start slow death, but also the card, I have used 2.3
Reply:
Skins election HVGA
Reply:
Meanwhile start twice on it, obviously lock up
Reply:
Solved yet? Seeking to share!
Reply:
To start the simulator twice to succeed

Seeking direct installation without prompting android apk code


            
Because the development of the software needs to be updated, the need for direct download and then install the software background, because when you install the apk there will be prompted to install, and now does not want to prompt the user to achieve the installation process, you heroes how to do it?
Reply:
You have to do what the Trojans?
Reply:
Look install apk piece of source code, specifically did not make
Reply:
Evil ・ ・ ・
Reply:
Still feel better ~ ~ reminder installed without the user's knowledge, the landlord wanted to phone virus?
Reply:
It is impossible to see the document
Reply:
Either, you start to install the software first obtain permission to install software background, but can not cover the installation yourself
Reply:
The reply was deleted at the moderator 2011-07-11 11:11:56

Reply:
Impossible. . Do not try it. .
See the documentation to know.
In fact, I've thought about this issue before. . .
Reply:
Asked this same question.

But different is, I was in it to install window pops up, but step by step after the operation is complete, gave me a hint failed to install the application

This problem does not know who the deities met.

Call setup code:

 
Uri uri = Uri.fromFile (new File (apkName));

Intent intent = new Intent (Intent. ACTION_VIEW);

intent.setDataAndType (uri, "application / vnd.android.package-archive");

startActivity (intent);



Reply:
To solve this problem contact me here is not convenient
Reply:
The main one is to do an updated version of the software is sometimes the case do not want to prompt the user

Reply:
Trojans do not so evil that too. . . .

Reply:
reference to the 10th floor xinqiqi123 reply:
To resolve this issue contact me, here is inconvenient


Big God
Reply:
Landlord please contact me: QQ: 724380361
Reply:
I want to achieve when you install an apk file, apk package to install another call, because my program to rely on other programs, so I want the other apk package, playing together with my program, and then install, can achieve?
Reply:
I also want to ask this question
Reply:
Solving ah, I need this project also hurts the egg ah ~
Reply:
qiujie ....

ADT how to avoid each run are opening a new simulator


            
I sometimes run ADT will open a new simulator, rather than open one. Any other way to run it every time do not open a new simulator?
Reply:
That is a problem because your program, right? Otherwise, he would open the original simulator, see if there is an error message, posted about

About listview and checkbox in focus


            
I want to achieve when I click listview, checkbox on the tick,
Then click the checkbox when it tick. . .
But now found not ah. .
How this break? ?
Reply:
Listview event line is not listening.
Reply:
Remove the checkbox click event, and then open the listview click event listener listview event, regardless of the point where it can make checkbox checked, an attribute checkbox is set to true

Android source code when running on eclipse error


            
Learning to develop Android, when running in eclipse download the source code when prompted following error, it is not know how to do, please help

[2013-12-11 21:38:04 - MediaPlayerProject] Unable to resolve target 'android-4'
[2013-12-11 21:38:24 - MediaPlayerProject] ------------------------------
[2013-12-11 21:38:24 - MediaPlayerProject]! Android Launch
[2013-12-11 21:38:24 - MediaPlayerProject] The connection to adb is down, and a severe error has occured
.[2013-12-11 21:38:24 - MediaPlayerProject] You must restart adb and Eclipse
.[2013-12-11 21:38:24 - MediaPlayerProject] Please ensure that adb is correctly located at 'C: \ Users \ 571864 \ android-sdks \ platform-tools \ adb.exe' and can be executed

Reply:
Virtual machine is not connected to it.
Reply:
Seems to be, how to solve ah?
Reply:
Why is it always being given, depressed dead, the enthusiasm for the program are slowly weakening, why eclipse running on the source, not the wrong, is that wrong, depressed!
Reply:
The workaround is to restart the adb and eclipse and android virtual machine
Reply:
You must restart adb and Eclipse.
Please ensure that adb is correctly located at 'C: \ Users \ 571864 \ android-sdks \ platform-tools \ adb.exe' and can be executed
.
The landlord, note the error message ah!
Make sure you have the sdk and jdk environment variable configuration to
Once configured, open the Task Manager to see if there adb.exe process, any kill, then restart Eclipse
Reply:
references, 5th Floor ncepu307 reply:
You must restart adb and Eclipse
.Please ensure that adb is correctly located at 'C: \ Users \ 571864 \ android-sdks \ platform-tools \ adb.exe' and can be executed
.
The landlord, note the error message ah!
Make sure you have the sdk and jdk environment variable configuration to
Once configured, open the Task Manager to see if there adb.exe process, any kill, then restart Eclipse


Right - generally kill abd can be a ~
Reply:
Agreed to the fifth floor, or look adb 5037 port has not been occupied
Reply:
SDK is not a failure, there is no 'android-4', 1.6 for SDK
Reply:
Without this version of the emulator or device
Reply:
Today, the beginning rerun tips Could not find ChinaWeather.apk!
How is this going to rebuild it? But I follow online, could not find how rebuild the
Reply:
I have often encountered this problem, so I generally solved:
1 restart eclipse
2 Double-click adb.exe
3 confirmed with 360 mobile phone connections intact assistant
Reply:
[2013-12-12 11:31:12 - ChinaWeather] ------------------------------
[2013-12-12 11:31:12 - ChinaWeather]! Android Launch
[2013-12-12 11:31:12 - ChinaWeather] adb is running normally
.[2013-12-12 11:31:12 - ChinaWeather] Could not find ChinaWeather.apk
!
This prompted many online methods do not work, how to do. .

In android listview, how can I display different types of item,


posts by cunlingwang edited 2013-01-22 17:42:58
Shaped like the phone's design interface, seekbar or button, I used the three forms, but do not know how to make the display in onCreated wrote, basically FC.



Here is rewritten BaseAdapter

 

class MyAdapter extends BaseAdapter {
Context mContext;
/ / LinearLayout linearLayout = null;
LayoutInflater inflater;
/ / TextView tex;

final int TYPE_SWITCH = 0;
final int TYPE_SEEKBAR = 1;
final int TYPE_BUTTON = 2;
final int TYPE_CHECKBOX = 3;

public MyAdapter (Context context) {

mContext = context;
inflater = LayoutInflater.from (mContext);
/ / Inflater = (LayoutInflater) getSystemService (Context.LAYOUT_INFLATER_SERVICE);
}

@ Override
public int getCount () {
/ / TODO Auto-generated method stub
return mData.size ();}

/ / Each convert view will call this method to get the current view style
needed@ Override
public int getItemViewType (int position) {
/ / TODO Auto-generated method stub
int p = position% 4;
if (p == 0)
return TYPE_SWITCH;
else if (p == 1)
return TYPE_SEEKBAR;
else if (p == 4)
return TYPE_SEEKBAR_RGB;
else if (p == 2)
return TYPE_BUTTON;
else if (p == 3)
return TYPE_CHECKBOX;
else
return TYPE_SEEKBAR;
}

@ Override
public int getViewTypeCount () {
/ / TODO Auto-generated method stub
return 1;
}

@ Override
public Object getItem (int arg0) {
/ / TODO Auto-generated method stub
return mData.get (arg0);
}

@ Override
public long getItemId (int position) {
/ / TODO Auto-generated method stub
return position;
}

@ Override
public View getView (int position, View convertView, ViewGroup parent) {
/ / TODO Auto-generated method stub

viewHolder_switch holder_switch = null;
viewHolder_seekbar holder_seekbar = null;
viewHolder_button holder_button = null;

int type = getItemViewType (position);

if (convertView == null)
{
Log.e ("convertView =", "NULL");

switch (type)
{
case TYPE_SWITCH:


holder_switch = new viewHolder_switch ();
convertView = inflater.inflate (R.layout.listview_switch_row, parent, false);
/ /
holder_switch.img = (ImageView) convertView.findViewById (R.id.img_sw);
holder_switch.title = (TextView) convertView.findViewById (R.id.title_sw);
holder_switch.info = (TextView) convertView.findViewById (R.id.info_sw);
Log.e ("convertView =", "NULL TYPE_SWITCH");

/ / Map myItem = getItem (position);

holder_switch.img.setBackgroundResource (R.drawable.power_ico_50dp);
holder_switch.title.setText (led_opt [position]);
holder_switch.info.setText (led_optContext [position]);
holder_switch.Switch.setChecked (true);

convertView.setTag (holder_switch);
break;
case TYPE_SEEKBAR:
convertView = inflater.inflate (R.layout.listview_seekbar_row, parent, false);

holder_seekbar = new viewHolder_seekbar ();
holder_seekbar.img = (ImageView) convertView.findViewById (R.id.img_sb);
holder_seekbar.title = (TextView) convertView.findViewById (R.id.title_sb);
holder_seekbar.info = (TextView) convertView.findViewById (R.id.info_sb);
Log.e ("convertView =", "NULL TYPE_SEEKBAR");
holder_seekbar.img.setBackgroundResource (R.drawable.rgb_ico_50dp);
holder_seekbar.title.setText (led_opt [position]);
holder_seekbar.info.setText (led_optContext [position]);

convertView.setTag (holder_seekbar);
break;
case TYPE_BUTTON:

convertView = inflater.inflate (R.layout.listview_button_row, parent, false);
holder_button = new viewHolder_button ();
holder_button.img = (ImageView) convertView.findViewById (R.id.img_btn);
holder_button.title = (TextView) convertView.findViewById (R.id.title_btn);
holder_button.info = (TextView) convertView.findViewById (R.id.info_btn);
Log.e ("convertView =", "NULL TYPE_BUTTON");

holder_button.img.setBackgroundResource (R.drawable.dream_ico_50dp);
holder_button.title.setText (led_opt [position]);
holder_button.info.setText (led_optContext [position]);

convertView.setTag (holder_button);
break;
}
} Else {
/ / There convertView, Belong, do not get the layout
switch (type)
{
case TYPE_SWITCH:
holder_switch = (viewHolder_switch) convertView.getTag ();
Log.e ("!!!!!! ConvertView =", "NULL TYPE_SWITCH");
break;
case TYPE_SEEKBAR:
holder_seekbar = (viewHolder_seekbar) convertView.getTag ();
Log.e ("!!!!!! ConvertView =", "NULL TYPE_SEEKBAR");
break;
case TYPE_BUTTON:
holder_button = (viewHolder_button) convertView.getTag ();
Log.e ("!!!!!! ConvertView =", "NULL TYPE_BUTTON");
break;
}
}
return convertView;
}
}

class viewHolder_switch {

/ ** Photo ID * /
private ImageView img;

/ ** Title * /
private TextView title;

/ ** Contents * /
private TextView info;
/ ** Switch * /
private Switch Switch;
}
class viewHolder_seekbar {

/ ** Photo ID * /
private ImageView img;

/ ** Title * /
private TextView title;

/ ** Contents * /
private TextView info;

private SeekBar sb;
}

class viewHolder_button
{
private ImageView img;

/ ** Title * /
private TextView title;

/ ** Contents * /
private TextView info;

/ ** Button name * /
private String btnText;
}





 

MyAdapter listAdapter;

protected void onCreate (Bundle savedInstanceState) {
/ / SetTheme (16974123);
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);

{
ListView lv = (ListView) this.findViewById (R.id.listview_home);




listAdapter = new MyAdapter (this);
lv.setAdapter (listAdapter);
}
}




The question now is how to make this list contains three layouts and displays, do not know how to write a reference to the many, many of them are consistent layout for each item, this is not the same, I do not know how to start.
Reply:
holder set the content code was put out if else, can not be executed only if there

Reply:
cited a floor whq1982 reply:
holder set the content code was put out if else, can not be executed


Thank you. Above has been changed, but how to build an ArrayList <> What type of can put three different types are put into?
Please know who gets advice.
Reply:
getViewTypeCount If 3, 3 can be placed on different item.
At the same time this getView to distinguish between these three Item, respectively, to load different xml files.
Reply:
This is an example I

http://download.csdn.net/detail/piaohong/5020778
Reply:
reference to the third floor liusha0225 reply:
getViewTypeCount If 3, you can place three different item.
At the same time this getView to distinguish between these three Item, respectively, to load different xml files.


Yes, it is like this, how is now the main problem in the Activity display.
Reply:
references, 4th Floor piaohong reply:
me this is an example

http://download.csdn.net/detail/piaohong/5020778


Thank you, I refer to.
Reply:
references, 4th Floor piaohong reply:
me this is an example

http://download.csdn.net/detail/piaohong/5020778



Your example is feasible, but I think: we are generally used to write my above this practice, do not do this right? So it seems a little backward. Ha ha.
Just seen an example with perferenceActivity, the seekbar can not drag, it can not add the big picture on this page, so there is no use.
Reply:
ArrayList

class MyObject {
int resId;
......
......
}
Reply:
reference to the 7th floor cunlingwang reply:
references, 4th Floor piaohong reply: I've got this example

http://download.csdn.net/detail/piaohong/5020778


Your example is feasible, but I think: we are generally used to write my above this practice, do not do this right? So it seems a little backward. Ha ha.
Just seen an example with perferenceActivity, the seekbar can not drag, it can not add on this page ......


I told you that the wording of that example what is the difference?
Improvements to the viewHolder_switch viewHolder_seekbar so you kind of wording for each different list item must define a viewHolder. I engage in a ViewHolder fit all the different list items

Also added a class ListItem (encapsulates a Map and mType), as is to solve the "how to build a ArrayList <> What can these three types are put into different types of"


Reply:
reference to the second floor cunlingwang reply:
cited a floor whq1982 reply: holder set the content of the code was put out if else, can not be executed only if there

Thank you. Above has been changed, but how to build an ArrayList <> What type of can put three different types are put into?
Please know who gets advice.

With the parent class \ subclass be all right
Reply:
reference to the 9th floor piaohong reply:
reference to the 7th floor cunlingwang reply: Quote, 4th Floor piaohong reply: I've got this example

http://download.csdn.net/detail/piaohong/5020778


Your example is feasible, but I think: we are generally used to write my above this practice, do not do this right? So it seems a little backward. Ha ha.
Just seen an example with perferenceActivity ......


First of gratitude, your example, as you said, there can be adapted to a variety of types. Very good, in fact, the essence is the same. Reference to your example, the problem is now solved.

Reply:
Here is modified according to your views. No major changes.
Interface implemented as follows: Three types



 

public class MainActivity extends Activity {

private final int TYPE_SWITCH = 0;
private final int TYPE_SEEKBAR = 1;
private final int TYPE_BUTTON = 2;


private static final String [] led_opt = {
"Jiangsu", "Guangzhou", "Xinjiang" and "Taiwan"
};
private static final String [] led_optContext = {
"East China", "located in the southeast coast," "a distant place", "across the sea"
};

List > mData = new ArrayList > ();
MyAdapter listAdapter;


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

{
ListView lv = (ListView) this.findViewById (R.id.listview_home);

Map map;
/ *
* Power Switch
* /
map = new HashMap ();
map.put ("img", R.drawable.power_ico_50dp);
map.put ("title", led_opt [0]);
map.put ("info", led_optContext [0]);
mData.add (map);

map = new HashMap ();
map.put ("img", R.drawable.white_ico_50dp);
map.put ("title", led_opt [1]);
map.put ("info", led_optContext [1]);
mData.add (map);

map = new HashMap ();
map.put ("img", R.drawable.rgb_ico_50dp);
map.put ("title", led_opt [2]);
map.put ("info", led_optContext [2]);
mData.add (map);

map = new HashMap ();
map.put ("img", R.drawable.dream_ico_50dp);
map.put ("title", led_opt [3]);
map.put ("info", led_optContext [3]);
mData.add (map);

listAdapter = new MyAdapter (this);
lv.setAdapter (listAdapter);
}
}

........................
........................


 
............
............

/ **
* Customize a Adapter (implements ListAdapter Interface)
*
* @ Author Administrator
*
* /
class MyAdapter extends BaseAdapter {

LayoutInflater inflater = null;

public MyAdapter (Context context) {

this.inflater = LayoutInflater.from (context);
/ / Inflater = (LayoutInflater) getSystemService (Context.LAYOUT_INFLATER_SERVICE);
}

@ Override
public int getCount () {
/ / TODO Auto-generated method stub
return mData.size ();}

/ / Each convert view will call this method to get the current view style
needed@ Override
public int getItemViewType (int position) {
/ / TODO Auto-generated method stub
int p = position% 4;
if (p == 0)
return TYPE_SWITCH;
else if (p == 1)
return TYPE_SEEKBAR;
else if (p == 2)
return TYPE_SEEKBAR;
else if (p == 3)
return TYPE_BUTTON;
else
return 0;
}

@ Override
public int getViewTypeCount () {
/ / TODO Auto-generated method stub
return 3;
}

@ Override
public Object getItem (int position) {
/ / TODO Auto-generated method stub
/ / Return mData.get (arg0);
return position;
}

@ Override
public long getItemId (int position) {
/ / TODO Auto-generated method stub
return position;
}

@ Override
public View getView (int position, View convertView, ViewGroup parent) {
/ / TODO Auto-generated method stub

viewHolder_switch holder_switch = null;
viewHolder_seekbar holder_seekbar = null;
viewHolder_button holder_button = null;

int type = getItemViewType (position);

if (convertView == null)
{
Log.e ("convertView =", "NULL");

switch (type)
{
case TYPE_SWITCH:


holder_switch = new viewHolder_switch ();
convertView = inflater.inflate (R.layout.listview_switch_row, parent, false);
/ / ConvertView = inflater.inflate (R.layout.listview_switch_row, null);
/ /
holder_switch.img = (ImageView) convertView.findViewById (R.id.img_sw);
holder_switch.title = (TextView) convertView.findViewById (R.id.title_sw);
holder_switch.info = (TextView) convertView.findViewById (R.id.info_sw);
Log.e ("convertView =", "NULL TYPE_SWITCH");

convertView.setTag (holder_switch);


break;
case TYPE_SEEKBAR:


convertView = inflater.inflate (R.layout.listview_seekbar_row, parent, false);

holder_seekbar = new viewHolder_seekbar ();
holder_seekbar.img = (ImageView) convertView.findViewById (R.id.img_sb);
holder_seekbar.title = (TextView) convertView.findViewById (R.id.title_sb);
holder_seekbar.info = (TextView) convertView.findViewById (R.id.info_sb);
Log.e ("convertView =", "NULL TYPE_SEEKBAR");


convertView.setTag (holder_seekbar);
break;
case TYPE_BUTTON:

convertView = inflater.inflate (R.layout.listview_button_row, parent, false);
holder_button = new viewHolder_button ();
holder_button.img = (ImageView) convertView.findViewById (R.id.img_btn);
holder_button.title = (TextView) convertView.findViewById (R.id.title_btn);
holder_button.info = (TextView) convertView.findViewById (R.id.info_btn);
Log.e ("convertView =", "NULL TYPE_BUTTON");



convertView.setTag (holder_button);
break;
}
} Else {
/ / There convertView, Belong, do not get the layout
switch (type)
{
case TYPE_SWITCH:
holder_switch = (viewHolder_switch) convertView.getTag ();
Log.e ("!!!!!! ConvertView =", "NULL TYPE_SWITCH");
break;
case TYPE_SEEKBAR:
holder_seekbar = (viewHolder_seekbar) convertView.getTag ();
Log.e ("!!!!!! ConvertView =", "NULL TYPE_SEEKBAR");
break;
case TYPE_BUTTON:
holder_button = (viewHolder_button) convertView.getTag ();
Log.e ("!!!!!! ConvertView =", "NULL TYPE_BUTTON");
break;
}
}

/ / Set the resource
switch (type)
{
case TYPE_SWITCH:
holder_switch.img.setBackgroundResource ((Integer) mData.get (position) get ("img").);
holder_switch.title.setText ((String) mData.get (position) get ("title").);
holder_switch.info.setText ((String) mData.get (position) get ("info").);
/ / Holder_switch.Switch.setChecked (true);
break;
case TYPE_SEEKBAR:

holder_seekbar.img.setBackgroundResource ((Integer) mData.get (position) get ("img").);
holder_seekbar.title.setText ((String) mData.get (position) get ("title").);
holder_seekbar.info.setText ((String) mData.get (position) get ("info").);

break;
case TYPE_BUTTON:
holder_button.img.setBackgroundResource ((Integer) mData.get (position) get ("img").);
holder_button.title.setText ((String) mData.get (position) get ("title").);
holder_button.info.setText ((String) mData.get (position) get ("info").);
break;
}

return convertView;
}
}

/ / Controls the layout of each resource
class viewHolder_switch {
/ ** Layout ID * /
public int layoutID;

/ ** Photo ID * /
public ImageView img;

/ ** Title * /
public TextView title;

/ ** Contents * /
public TextView info;
/ * Switch * /
public Switch Switch;



}

class viewHolder_seekbar {
/ ** Layout ID * /
public int layoutID;

/ ** Photo ID * /
public ImageView img;

/ ** Title * /
public TextView title;

/ ** Contents * /
public TextView info;

public SeekBar sb;

}

class viewHolder_button
{

private int layoutID;

private ImageView img;

/ ** Title * /
private TextView title;

/ ** Contents * /
private TextView info;

/ ** Button name * /
private Button button;


}
}


Reply:
listen seekBar button controls how these did not
Reply:
I want to know the above demo use?