Tuesday, April 29, 2014

Import cocos2d-x with Eclipse Android engineering problems


cocos2d-x 3.0beta2, guide Ruan Zhuo works appear
Unable to resolve target 'android-10' errors.

However proj.android \ project.properties file inside target.
target = android-16

,
Is consistent with the api leveal.
Then you can still packaged into APK, but run on the error. "Unfortunately, XXX run error"
Andrews did not study and development, has been stuck here, please predecessors taught me!
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->

ListView drop-down problem


listview default can not be pulled down. On some phones can be pulled down. Figure:


There are currently found in some models that can be pulled down seeking solutions.

Currently listview have tried all the basic attributes, there listview height wrote dead useless,
If you want to point to rewrite listview ideas, thank you. How could you ban pulldown.
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Nobody Mody. . Variety. .
Reply:
Can be pulled down, ah, why not drop down it? You are not setting can not be pulled down the
Reply:
The landlord says you can not be pulled down what ah mean?
ListView itself can not be pulled down, how you can.
Or say you do not want to be dragged down the overall make ListView? If so, you will not change, this root has a relationship models
Reply:
Not prohibited, it is a custom manufacturer - in fact, imitation ios
Reply:
Landlord. . . I encountered the same problem with you, I was able to pull down tests found listview, how can not be cut off, to rewrite it, and test models are coolpad Meizu, version 2.3 is on the low version, the landlord to solve the problem Why? ? ? ?

ViewPager can not be displayed


ViewPager FragmentActivity sub Fragment included in FragmentTabHost not display expert answers to solve

Download address http://pan.baidu.com/s/1c0vMr3i
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Their top nobody get over it
Reply:
Paste the code on the map to get hold of people to download something to help you test? Anyway, I will not do
Reply:
Your layout problems

fragment_1.xml
 xmlns: tools = "http://schemas.android.com/tools" 
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: orientation = "vertical">

android: id = "@ + id / main_title"
android: layout_width = "fill_parent"
android: layout_height = "wrap_content"
layout = "@ layout / tilte" />

android: id = "@ + id / main_view_pager"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: layout_gravity = "center"
android: flipInterval = "30"
android: persistentDrawingCache = "animation" />



Reply:
reference to the third floor hjywyj reply:
your layout problems

fragment_1.xml
 xmlns: tools = "http://schemas.android.com/tools" 
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: orientation = "vertical">

android: id = "@ + id / main_title"
android: layout_width = "fill_parent"
android: layout_height = "wrap_content"
layout = "@ layout / tilte" />

android: id = "@ + id / main_view_pager"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: layout_gravity = "center"
android: flipInterval = "30"
android: persistentDrawingCache = "animation" />


where the problem can be said about it?
Reply:
reference to the third floor hjywyj reply:
your layout problems

fragment_1.xml
 xmlns: tools = "http://schemas.android.com/tools" 
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: orientation = "vertical">

android: id = "@ + id / main_title"
android: layout_width = "fill_parent"
android: layout_height = "wrap_content"
layout = "@ layout / tilte" />

android: id = "@ + id / main_view_pager"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: layout_gravity = "center"
android: flipInterval = "30"
android: persistentDrawingCache = "animation" />


Thank you discovered the problem
Reply:
reference to the second floor Lee_shuo reply: posted code shown on
people get hold of something to help you download the test? Anyway, I will not do

I think so, I think that the main floor is the key code to learn, learn to paste the key code. .

How to move the program to the SD card code? Or ADB to move to SD card in the memory of a program .100 points. Highly enough of it ..


private void sss () {
PackageManager pm = this.getPackageManager ();
try {
/ / Get the hidden function
by reflection/ / GetDeclaredMethod () to get the class defines methods
Method movePackage = null;
Method [] methods = pm.getClass () getDeclaredMethods ();.
/ / Field
. / / Move_external_dedia = pm.getClass () getDeclaredField ("MOVE_EXTERNAL_MEDIA");
/ / Call the function, and to assign parameter, callback
AppsMoveObserver class upon completion of the call flowfor (int i = 0; i if (methods [i]. getName (). toString (). equals ("movePackage")) {
movePackage = methods [i];
}
}
movePackage.setAccessible (true);
movePackage.invoke ("com.tencent.qqgame",
new PackageMoveToMemoryObserver (), 2);
} Catch (Exception ex) {
ex.printStackTrace ();
}
}

class PackageMoveToMemoryObserver extends IPackageMoveObserver.Stub {

@ Override
public void packageMoved (String packageName, int returnCode)
throws RemoteException {
/ / TODO Auto-generated method stub

}

}


/ / IPackageMoveObserver.aidl
package android.content.pm;

/ **
* Callback for moving package resources from the Package Manager.
* @ Hide
* /
oneway interface IPackageMoveObserver {
void packageMoved (in String packageName, int returnCode);
}


Looking for a day post by reflex. Can move the program to the SD card .. erroneous results. Said
java.lang.IllegalArgumentException: expected receiver of type android.app.ApplicationPackageManager, but got java.lang.String
IPackageMoveObserver also defines a String. Could not be defined as android.app.ApplicationPackageManager
How to get it?

or ADB to move to a program in memory SD card
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
movePackage.invoke ("com.tencent.qqgame", new PackageMoveToMemoryObserver (), 2);
Changed movePackage.invoke (pm, "com.tencent.qqgame", new PackageMoveToMemoryObserver (), 1); try, that exception should not be reported, but it will not be successful is unknown
Reply:
What permissions ah

TabActivity banned, what should replace the?


The latest Android4.0 in, TabActivity not advocate the use of, from the official website to see that is to inherit FragmentActivity class, and import com.example.android.supportv4.R package, but I tried did not com.example.android.supportv4 . R package, I downloaded the SDK is complete, I do not know how to achieve the previous TabActivity method?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Really do not understand Google's official statement, is FragmentActivity out this new?
Reply:
Some people know, some people understand Android4.0 icecreame sandwich do not know trouble like this version upgrade brings how to solve, where to go to learn?
Reply:
I should learn to learn more usage now, to wait until almost the time to learn. Now learn. Real devices run 4.0 How many?
Reply:
Although not advocate using google, but TabActivity but still used, first with the right ~ ~ ~ ~
Reply:
The reply was deleted at 2011-11-23 10:47:07 moderator

Reply:
Really ... TabActivity Johnson, both from the layout of the building code or from the side, I personally do not recommend using, lz if that effect must be used ActivityGroup; Google's new mobile phone qq controls FragmentActivity effect is the tab switch inside the panorama wp7 little meaning if lz forward-compatible version without considering the issue, and that this control is really good. But Google said forward-compatible SDK somewhat tricky ...
Reply:
Do not advocate does not mean that can not ah. . . I remember 3.0 had fragment. . If you do not need a reason not to use FragmentActivity few phone is now 4.0 ah
Reply:
Landlord, you solve this problem? I encountered the same problem!

How to interface this picture set?


I hope to achieve the following interface, which concentrated Click on the photo above pictures can be displayed on the bottom of the corresponding larger image. While the top and bottom of the photo sets can be struck with the big picture around your finger. We ask, how to achieve it?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Turn around and then you can use viewpager Click thumbnail to get the id by id find Enlarge Image probably thinking this way
Reply:
The above line can Gallery, the following can be used ViewPager (embedded Fragment), the following display according Gallery Click above current location, you can refresh the display.
Reply:
In fact, the above effects can also be achieved by Gallery + ImageSwitcher may be a simple point.
Reply:
google gallery
Reply:
gallery now do not recommend the use of the recommended horizontalscrollview, use this function you can achieve it!
Reply:
Gallery + ImageSwitcher relatively simple
Reply:
We provide ideas are feasible. Results posted to the sub!

How to use elipse import existing source code


Development with eclipse android, the source code has been downloaded well, how construction can ah? Novice seeking advice ah
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
? Your next project or only a good source of resources, code? If the project directly elected import choose the right package explorer corresponding item on the list
Reply:
Amount, is a folder there. Settings assets bin gen res src
Reply:
. . . Hey, that should be the project of

Reply:
Appears invdid project description?
Reply:
Engineering errors dropdown menu src wrong is how ah? Seeking advice! ! Thank you very much

In main.xml added ID, how does not automatically generate R.java well?



 

xmlns: tools = "http://schemas.android.com/tools"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
>

android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: text = "@ string / promptTitle"
android: textSize = "40sp"
android: textColor = "# FF00FF"
android: textStyle = "bold"
android: layout_centerHorizontal = "true"
android: paddingLeft = "20dp"
android: paddingRight = "20dp"
android: layout_marginTop = "20dp"
android: layout_marginBottom = "20dp"
/>
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: text = "@ string / promptComPlay"
android: layout_below = "@ id / txtTitle"
android: layout_alignLeft = "@ id / txtTitle"
android: textSize = "20sp"
android: layout_marginBottom = "20sp"
/>
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: text = "@ string / promptMyPlay"
android: layout_below = "@ id / txtTitle"
android: layout_alignRight = "@ id / txtTitle"
android: textSize = "20sp"
android: layout_marginBottom = "20dp"
/>
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
project-> clean
Reply:
A clean aapt.exe encounter problems appeared to be close
And R.java also gone, Baidu did not answer for a long time

Reply:
We are uncertain about this issue, I re-built a project, put the item in the original XML copy over one by one, while the corresponding value will be good in the string, even better.

Why get network picture failed?


I get from the Internet to find the Android network picture of the code, you can run your own test again, (the picture url is http://www.baidu.com/img/baidu_sylogo1.gif).
But for a moment the image url, changed http://www.xzbicycle.com/xzmap/ibikegif.asp?id=10&flag=1, the result Bitmap is empty picture for failure, why ah? Which Great God help
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Is empty, then there should be a log of it. The best and most direct way to analyze the problem is to look at the log to identify the location of the source in question come from the log inverse.

Reply:
View LogCat
Reply:
@ Override
protected Bitmap doInBackground (String. .. urls) {
/ / TODO Auto-generated method stub
String url = urls [0];
Bitmap tmpBitmap = null;
try {
. InputStream is = new java.net.URL (url) openStream ();
tmpBitmap = BitmapFactory.decodeStream (is);
} Catch (Exception e) {
e.printStackTrace ();
Log.i ("test", e.getMessage ());
}
boolean hh = tmpBitmap == null;
Log.e ("image", hh + "!!!!!");
return tmpBitmap;
}

No exception error, just an empty display Bitmap
Reply:
Why is the url for a moment it would not be
Reply:
You return to the url seems to be a web page, which has a map, not a true picture of the address bar.
Reply:
url special characters need to transcode the browser automatically transcoding too, such as on the &? require transcoding
Reply:
Not the issue of access to data, and the feeling that the picture in question.
I've tested, even save the picture down into the resource file, R.drawable.xxx or not displayed
Reply:
How to do that, I tried a lot of ways will not work, the project to use the picture in the data, crazy
Reply:
url is not correct it, you are in for a try another URL
Reply:
url must be positioned to address the specific picture
Reply:
I am using the url Fiddler2 found, to refer to the picture data information, does not make sense to change url
Reply:
On Samsung phones can be tried by way of pictures, though I do not know why, thank you

intent in terms of traditional values ​​than the bundle a good place it?


Multi-page biography value bundle is certainly good, write it again on the line, why should intent exist?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
If only passing a string of it, what to write easy?
Reply:
bundle of complex data, intent simple data

How to package the data into the bean textView passed in another activity, and parse out


Main activity is a two list, click on the child table a package to be passed to the next acvitvty bean
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
With intent
Reply:
/ / Pass data using parameters
BundleIntent intent = new Intent ();
intent.setClass (MainActivity.this, TwoActivity.class);
Bundle bundle = new Bundle ();
bundle.putString ("name", "hello");
bundle.putString ("pwd", "123");
intent.putExtras (bundle);
startActivity (intent);
Another activity values:
Bundle bundle = this.getIntent () getExtras ();.
String strName = bundle.getString ("name");
String strPwd = bundle.getString ("pwd");
txtTitle.setText ("Welcome:" + strName + "pwd:" + strPwd);
Reply:
intent .. putExtra (name, value); another activity. . getIntent () getExtra (name);
Reply:
intent.setclass (a.class, b.class)

Android application startup problems from web


Start Android applications from the web, from online search results is plus scheme in activity in the intent-filter, is as follows:
 







Open the application of 8080/ZZZ/AAA/BBB.html: Web pages can then by XXX :/ / YYY in Web pages.

- But today I tried this way many times, are not open.
I doubt there is not a local website does not support, so he racks of servers, from web server test, but still unsuccessful;
I doubted was not some browsers do not support, but I tried Chrome, Opera, Samsung's own browser, Baidu browser, etc., or unsuccessful;
I suspect over the phone is not a problem, but I tried made several Samsung, a Motor X, or unsuccessful.
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
I had a go, the original XXX to lowercase, because js in XXX will turn into lowercase, uppercase if apk is, it will not match. . . Alas, the Internet is an example of harms. . .

android call webservice problem JAX-WS structure


The problem is that this method does not pass parameters can be properly called, but a but pass the Senate, the server will receive the parameter is null, read their online statement, but still not resolved. Passed parameter names are consistent, Please answer
Here is my call to port code
 
public String queryMsg (String nameSpace, String methodName, String endPoint, String [] values, String [] keys) {
SoapObject rpc = new SoapObject (nameSpace, methodName);
for (int i = 0; i rpc.addProperty (keys [i], values ​​[i]);
}
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope (
SoapEnvelope.VER11);
envelope.bodyOut = rpc;
envelope.dotNet = false;
HttpTransportSE transport = new HttpTransportSE (endPoint);
try {

/ / Call WebService

transport.call (null, envelope);

} Catch (Exception e) {

e.printStackTrace ();

}
/ / Get the returned data
SoapObject object = (SoapObject) envelope.bodyIn;
/ / Get the results returned
String result = object.getProperty (0) toString ();.
Log.i ("show", result);
return result;
}
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Today, this issue is considered completely resolved, have the same problem, you can leave a message
Reply:
How to solve? Please advise!
Reply:
Encountered the same problem, find the landlord let us know!
Reply:
The solution is to pass parameters are arg0, arg1 ...... agrn
Reply:
Me and my little partner shocked
Reply:
I arg0 nor ah!
Reply:
How to solve?
Reply:
Encountered the same problem, I tried using the parameter arg0, not seeking moderator enlighten me!

xamarin performance how?


As stated, xamarin performance how?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Based on mono, performance can be, but mostly in order to enhance versatility, appropriate to reduce some performance.
Reply:
The reply was deleted administrator at 2013-08-23 09:09:18

Reply:
They claim to native code is Bluff, and if the local machine code should be faster than JAVA,
Reply:
In addition, I hope he can provide free version that can compile a 32K, whoever ah, at least provide Personal Edition
Reply:

Reply:
Agreed to provide free or trial under the Personal Edition makes
Reply:
Unfortunately, there is no free version ah
Reply:
Free version, but is limited in size, which is the free version can only compile and run code that does not exceed a certain Size, you can not compile and run after more than
Reply:
There Personal Edition, which is Indie version, but also very expensive, $ 199, do not know whether it will cut prices in China
Reply:
About the performance, there will be little in the startup overhead - between 100ms to 1s, depending on the performance of the device, the device should now be spending the majority of the following should be 500ms, 500ms or less for most users are not feeling the differences,
After starting with basic Java should be similar, even if slow is extremely tiny
http://stackoverflow.com/questions/17134522/does-anyone-have-benchmarks-code-results-comparing-performance-of-android-ap
Discussed in more detail here
Reply:
Based on mono, performance can also be a free version, but is limited in size, which is the free version can only be compiled and run does not exceed a certain Size code, you can not compile and run after more than
Reply:
In fact, we do not need to have doubts about the performance of Xamarin, this based on the following:

1. Xamarin for ANDROID, IOS development tools are based on the native Android and IOS SDK API encapsulates only the syntax and data structures using C # language features.

2 In addition Xamarin is based framework MONO, MONO itself in the performance of non-Windows platforms is not much worse than C + +, such as domestic use MONO support
someone with C #Develop a sufficient and NGINX comparable WEB SERVER. Implements ASP.NET applications in non-Windows platforms seamlessly transplant operation.

3. Xamarin conducive to the emergence of mobile developers for a better understanding of the native SDK.

How to edit a Church seeking large helloworld project ah Andrews


beg
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Big Brother had no hands?
Reply:
eclipse
Reply:

Reply:
The easiest DEMO, configured to run directly Environment
Reply:
Nothing to say
Reply:
How you want to edit, revise the text you want, or style?
Reply:

Reply:
Links: http://pan.baidu.com/s/1mg2r9C8 Password: gwp2
With a rookie, met a fate, , refueling, instructional videos, do not mention it!

Strange! Native procedure call system () returns an error


Written part of Samsung mobile phones (such as S4, Note3) the Native program, the phone has successfully root, execute the command procedure used system functions, such as system ("pwd"), then to the adb shell, the first run su to get root privileges, then and then execute my native program, the results of the above system functions all return an error. If you do not get adb shell su, direct use of shell user, then the function of the system will not fail. Is it not as root shell? ? I do not know how it happened, really strange!
root is OK.
Have an expert to know why?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
NATIVE call your success? I call the original SDL, Curry appeared in an endless loop. AC Q: 1049568282
Reply:
Very strange, but later found to be copied to the bin / system / xbin following execution on OK.

A simple jump from sudu actuvity to aboutactivity, how to run the old error on the simulator?


posts by u014691260 on 2014-04-13 16:31:41 Edit
Always run directly error exit, check out the two xml, also identified in mainfest registered two activities. Back to see if the problem lies in the logcat oncreate method, I found that the shear exclude ab.setOnClickListener (new View.OnClickListener () {

@ Override
public void onClick (View v) {
/ / TODO Auto-generated method stub
switch (v.getId ()) {
case R.id.about_button:
Intent i = new Intent (SuDu.this, About.class);
startActivity (i);
break;
}
}
});
Cut the program can run, do not know what wrong. Also used SuDu class implements the onClick method, and then use this keyword to SuDu direct spread setOnClickListener method does not work, or can not run the same, cut aboutButton.setOnClickListener (new View.OnClickListener (this) can also be run.
Trouble to help me see, last night to check for syntax errors, the search still see the official documentation, get a few hours have not been resolved.
SuDu.java code:
package com.example.sudu;

import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.os.Build;
import android.view.View.OnClickListener;
import android.content.Intent;

public class SuDu extends ActionBarActivity
{

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

View aboutButton = findViewById (R.id.about_button);
aboutButton.setOnClickListener (new View.OnClickListener () {

@ Override
public void onClick (View v) {
/ / TODO Auto-generated method stub
switch (v.getId ()) {
case R.id.about_button:
Intent i = new Intent (SuDu.this, About.class);
startActivity (i);
break;
}
}
});


if (savedInstanceState == null) {
getSupportFragmentManager (). beginTransaction ()
. Add (R.id.container, new PlaceholderFragment ())
. Commit ();
}


}


@ Override
public boolean onCreateOptionsMenu (Menu menu) {

/ / Inflate the menu; this adds items to the action bar if it is present
.getMenuInflater () inflate (R.menu.su_du, menu);.
return true;
}

@ Override
public boolean onOptionsItemSelected (MenuItem item) {
/ / Handle action bar item clicks here. The action bar will
/ / Automatically handle clicks on the Home / Up button, so long
/ / As you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId ();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected (item);
}

/ **
* A placeholder fragment containing a simple view.
* /
public static class PlaceholderFragment extends Fragment {

public PlaceholderFragment () {
}

@ Override
public View onCreateView (LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate (R.layout.fragment_su_du, container, false);
return rootView;
}
}


}

<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Nobody to help lower it?
Reply:
Posted the wrong look.
Reply:
why can write View the types of controls it? How it feels is Button
Reply:
reference to the second floor yijiansandao reply:
posted the wrong look.

04-13 12:59:37.501: D / AndroidRuntime (1228): Shutting down VM
04-13 12:59:37.501: W / dalvikvm (1228): threadid = 1: thread exiting with uncaught exception (group = 0xb3aa4ba8)
04-13 12:59:37.511: E / AndroidRuntime (1228): FATAL EXCEPTION: main
04-13 12:59:37.511: E / AndroidRuntime (1228): Process: com.example.sudu, PID: 1228
04-13 12:59:37.511: E / AndroidRuntime (1228): java.lang.RuntimeException: Unable to start activity ComponentInfo {com.example.sudu / com.example.sudu.SuDu}: java.lang.NullPointerException
04-13 12:59:37.511: E / AndroidRuntime (1228): at android.app.ActivityThread.performLaunchActivity (ActivityThread.java: 2195)
04-13 12:59:37.511: E / AndroidRuntime (1228): at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java: 2245)
04-13 12:59:37.511: E / AndroidRuntime (1228): at android.app.ActivityThread.access $ 800 (ActivityThread.java: 135)
04-13 12:59:37.511: E / AndroidRuntime (1228): at android.app.ActivityThread $ H.handleMessage (ActivityThread.java: 1196)
04-13 12:59:37.511: E / AndroidRuntime (1228): at android.os.Handler.dispatchMessage (Handler.java: 102)
04-13 12:59:37.511: E / AndroidRuntime (1228): at android.os.Looper.loop (Looper.java: 136)
04-13 12:59:37.511: E / AndroidRuntime (1228): at android.app.ActivityThread.main (ActivityThread.java: 5017)
04-13 12:59:37.511: E / AndroidRuntime (1228): at java.lang.reflect.Method.invokeNative (Native Method)
04-13 12:59:37.511: E / AndroidRuntime (1228): at java.lang.reflect.Method.invoke (Method.java: 515)
04-13 12:59:37.511: E / AndroidRuntime (1228): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java: 779)
04-13 12:59:37.511: E / AndroidRuntime (1228): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java: 595)
04-13 12:59:37.511: E / AndroidRuntime (1228): at dalvik.system.NativeStart.main (Native Method)
04-13 12:59:37.511: E / AndroidRuntime (1228): Caused by: java.lang.NullPointerException
04-13 12:59:37.511: E / AndroidRuntime (1228): at com.example.sudu.SuDu.onCreate (SuDu.java: 27)
04-13 12:59:37.511: E / AndroidRuntime (1228): at android.app.Activity.performCreate (Activity.java: 5231)
04-13 12:59:37.511: E / AndroidRuntime (1228): at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java: 1087)
04-13 12:59:37.511: E / AndroidRuntime (1228): at android.app.ActivityThread.performLaunchActivity (ActivityThread.java: 2159)
04-13 12:59:37.511: E / AndroidRuntime (1228): ... 11 more
04-13 12:59:47.431: I / Process (1228): Sending signal PID:. 1228 SIG: 9
Is this
Reply:
reference to the third floor l515518205 reply:
Why can write View the types of controls it? How it feels is Button

Button also view it
Reply:
The findviewbyid and setonclick into PlaceholderFragment in the onCreateView.
Reply:
reference to the 6th floor hjywyj reply:
will findviewbyid and setonclick into PlaceholderFragment in the onCreateView.

Thank you, by the use of XML Button onClick call in methods to achieve it. Wait for the next cut to the place where you say to try.

On the lock screen technology! ! ! ! What a big cow. . .



Recent wanted a similar word lock screen software! !
There are a large source of cattle have provided it
Guiqiu! ! !






<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:


Since the sofa to sit! ! !
Reply:
Word lock screen, does the lock screen lets users back when the word back?
Reply:
Word lock screen, does the lock screen lets users back when the idea way back word ----
Reply:
reference to the second floor cclovescw reply:
word lock screen, does the lock screen lets users back when the word back?



Blessings ・ ・ ・ bit like, but not quite the unlock screen technology, seeking moderator sharing ・ ・ ・
Reply:
Watch the weather forecast I have a small demo lock screen. N years ago to help a person to do graduate design.
Reply:
references, 5th Floor cclovescw reply:
I have a lock screen when watching weather forecasts little demo. N years ago to help a person to do graduate design.

Moderators shared out to see the pictures!
Reply:
Ah locked easily register a broadcast on the line
Reply:
Listen and then start the Service
bootpublic class LockScreenService extends Service {

private Intent unlockIntent;
private KeyguardManager mKeyguardManager = null;
private KeyguardManager.KeyguardLock mKeyguardLock = null;

@ Override
public IBinder onBind (Intent intent) {
/ / TODO Auto-generated method stub
return null;
}

@ Override
public void onCreate () {
super.onCreate ();
unlockIntent = new Intent (LockScreenService.this,
LockScreenActivity.class);
unlockIntent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK);

/ * Register broadCastReceiver * /
IntentFilter filteron = new IntentFilter ("android.intent.action.SCREEN_ON");
IntentFilter filteroff = new IntentFilter ("android.intent.action.SCREEN_OFF");
registerReceiver (lockReceiver, filteroff);
registerReceiver (unlockReceiver, filteron);

}

@ Override
public void onDestroy () {
/ / TODO Auto-generated method stub
super.onDestroy ();
unregisterReceiver (lockReceiver);
unregisterReceiver (unlockReceiver);
startService (new Intent (LockScreenService.this, LockScreenService.class));
}
public int onStartCommand (Intent intent, int flags, int startId) {

return Service.START_STICKY;

}


private BroadcastReceiver lockReceiver = new BroadcastReceiver () {

@ Override
public void onReceive (Context context, Intent intent) {

}
};

private BroadcastReceiver unlockReceiver = new BroadcastReceiver () {

@ Override
public void onReceive (Context context, Intent intent) {
String action = intent.getAction ();
if (action.equals ("android.intent.action.SCREEN_OFF")
| | Action.equals ("android.intent.action.SCREEN_ON")) {
mKeyguardManager = (KeyguardManager) context
. GetSystemService (Context.KEYGUARD_SERVICE);
mKeyguardLock = mKeyguardManager.newKeyguardLock ("zdLock 1");
mKeyguardLock.disableKeyguard ();
startActivity (unlockIntent);

}
}
};
}
Reply:
reference to the 6th floor hjywyj reply:
Quote: references, 5th Floor cclovescw reply:

Watch the weather forecast I have a small demo lock screen. N years ago to help a person to do graduate design.

Moderators shared out to see the pictures!


See you every day online, you can go to apply for a moderator ah!
Reply:
references, 5th Floor cclovescw reply:
I have a lock screen when watching weather forecasts little demo. N years ago to help a person to do graduate design.


Powerful, but not a few days to become moderator, ah
Reply:
Reply 10 minutes a day can get really feel good ~ ~ ~ ~ ~ ~ ~ ~ ~
Reply:
references, 5th Floor cclovescw reply:
I have a lock screen when watching weather forecasts little demo. N years ago to help a person to do graduate design.

Hello, how can shield the home button it? The system is 2.3.x or 4.x for?

Php score seek to modify the contents of the file method apk


Php score seek to modify the contents of the file method
apkContents of the file to automatically modify the leaders inside the apk to help solve ah prawn
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
You say to the leadership of the medication the

Reply:
I went;. . It can do it?
Reply:
And your leadership that the drug can not stop.
Reply:
Has been resolved that the three steps to unpack package signatures

Android textbooks written in accordance with the error code, solving


Main Activity.
 
package com.yuyu.zujian;

import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.ToggleButton;

public class MainActivity extends Activity {

public Button register;
public ToggleButton marriged;
public RadioButton male;
public EditText username, password;
public Spinner position;
public CheckBox reading, swimming;

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

if (savedInstanceState == null) {
getFragmentManager (). beginTransaction ()
. Add (R.id.container, new PlaceholderFragment ())
. Commit ();
}

username = (EditText) findViewById (R.id.username01);
password = (EditText) findViewById (R.id.password);

male = (RadioButton) findViewById (R.id.male);

reading = (CheckBox) findViewById (R.id.reading);
swimming = (CheckBox) findViewById (R.id.swimming);

marriged = (ToggleButton) findViewById (R.id.marriged);

position = (Spinner) findViewById (R.id.position);
String [] str = {"CEO", "CFO", "PM"};
ArrayAdapter aa = new ArrayAdapter (this, android.R.layout.simple_spinner_item, str);
position.setAdapter (aa);

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

register.setOnClickListener (new OnClickListener () {
public void onClick (View v) {
Bundle b = new Bundle ();
b.putString ("username", "User Name:" + username.toString ());
b.putString ("password", "password:" + password.toString ());

if (male.isChecked ()) {
b.putString ("gender", "Gender: Male");
} Else {
b.putString ("gender", "Gender: Female");
}

String temp = "hobby";
if (reading.isChecked ()) {
temp + = "read";
}

if (swimming.isChecked ()) {
temp + = "swim";
}

b.putString ("hobby", temp);

if (marriged.isChecked ()) {
b.putString ("marriged", "Marital Status: Married");
} Else {
b.putString ("marriged", "Marital Status: Single");
}

b.putString ("position", "position:" + position.getSelectedItem () toString ().);

Intent intent = new Intent (MainActivity.this, ResultActivity.class);
intent.putExtra ("data", b);
startActivity (intent);
}

});
}
}



Corresponding xml:
 
xmlns: tools = "http://schemas.android.com/tools"
android: id = "@ + id/LinearLayout1"
android: layout_width = "match_parent"
android: layout_height = "match_parent"
android: orientation = "vertical"
android: paddingBottom = "@ dimen / activity_vertical_margin"
android: paddingLeft = "@ dimen / activity_horizontal_margin"
android: paddingRight = "@ dimen / activity_horizontal_margin"
android: paddingTop = "@ dimen / activity_vertical_margin">

android: id = "@ + id/TableLayout01"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: collapseColumns = "3"
android: stretchColumns = "1"
tools: ignore = "UselessParent">

android: id = "@ + id/tableRow1"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content">

android: text = "@ string / username"
android: id = "@ + id/TextView01"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />

android: labelFor = "@ + id/username01"
android: inputType = "text"
android: text = ""
android: id = "@ + id/username01"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />


android: id = "@ + id/tableRow2"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content">

android: text = "@ string / password"
android: id = "@ + id/TextView02"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />

android: labelFor = "@ + id / password"
android: text = ""
android: id = "@ + id / password"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: inputType = "textPassword" />


android: id = "@ + id/tableRow3"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content">

android: text = "@ string / sex"
android: id = "@ + id/TextView03"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />

android: id = "@ + id / gender_g"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content">

android: text = "@ string / man"
android: id = "@ + id / male"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />

android: text = "@ string / woman"
android: id = "@ + id / female"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />



android: id = "@ + id/tableRow4"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content">

android: text = "@ string / marry"
android: id = "@ + id/TextView04"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />

android: text = ""
android: id = "@ + id / marriged"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />


android: id = "@ + id/tableRow5"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content">

android: text = "@ string / hobby"
android: id = "@ + id / Thobby"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />

android: text = "@ string / reading"
android: id = "@ + id / reading"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />

android: text = "@ string / swimming"
android: id = "@ + id / swimming"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />


android: id = "@ + id/tableRow6"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content">

android: text = "@ string / position"
android: id = "@ + id/TextView05"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />

android: id = "@ + id / position"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" />


android: id = "@ + id/tableRow7"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content">


There are two problems:
1, in position.setAdapter (aa); Department certainly wrong, debug it, found all findViewById stuff is null. The stuff is defined in the main.xml.
2, register.setOnClickListener (new OnClickListener () {***} This function comes in on an error, try other projects, it seems as long as the call setOnClickListener go wrong, unreasonable ah, depressed.
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
What are you SDK 4.4 is a fragment of the right layout layout, so you have to do findview
in PlaceholderFragment inside of onviewcreateOr delete the following passage, not to commit fragment
 
if (savedInstanceState == null) {
getFragmentManager (). beginTransaction ()
. Add (R.id.container, new PlaceholderFragment ())
. Commit ();
}

Reply:
If you do not commit fragment layout file inside the things we should party to setContentView (R.layout.activity_main);
This layout file is loaded inside oh.
Reply:
Is there a function in mainActivity PlaceholderFragment, and too long, did not stick up before: as

 
@ Override
public boolean onCreateOptionsMenu (Menu menu) {

/ / Inflate the menu; this adds items to the action bar if it is present
.getMenuInflater () inflate (R.menu.main, menu);.
return true;
}

@ Override
public boolean onOptionsItemSelected (MenuItem item) {
/ / Handle action bar item clicks here. The action bar will
/ / Automatically handle clicks on the Home / Up button, so long
/ / As you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId ();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected (item);
}

/ **
* A placeholder fragment containing a simple view.
* /
public static class PlaceholderFragment extends Fragment {

public PlaceholderFragment () {
}

@ Override
public View onCreateView (LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate (R.layout.fragment_main, container, false);
return rootView;
}
}

Reply:
Follow the prompts two, delete the fragment_main files, all definitions are placed in the main document, you can.
4.4 SDK will also have two layout appears, is currently not clear relationship between the two can only delete one :) Thank you for another operation of the
Reply:
references, 4th Floor trueyu reply:
follow the prompts two, delete the fragment_main files, all definitions are placed in the main document, you can.
4.4 SDK will also have two layout appears, is currently not clear relationship between the two can only delete one :) Thank you for another operation a


fragment understanding is a component activity are recommended to achieve the 4.0 fragment later, so you can fit pad, you can go to the specific details read the official document

The most simple network communication failure, seeking reasons


Tablet Internet.
Android developers in learning. Want to try the most simple http traffic.

Now is running, the program will "Sorry, HttpGet has stopped running" Auto quit.
Ask you to help identify the error, or to run a successful and source http communications package!
Thank you!
This is part of the code, the following are the source package. What questions can go and see.
 
package com.example.aa;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
/ / Import android.content.DialogInterface.OnClickListener;

public class MainActivity extends Activity {
private TextView textView;
private Button get, post;
/ ** Called when the activity is first created. * /
@ Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);

textView = (TextView) findViewById (R.id.textView);
get = (Button) findViewById (R.id.get);
post = (Button) findViewById (R.id.post);

/ / Bind button listener
get.setOnClickListener (new OnClickListener () {
@ Override
public void onClick (View v) {
/ / Note: This can not be used ip 127.0.0.1 or localhost, Android emulator has its own as a localhost
Toast.makeText (MainActivity.this, "GET", Toast.LENGTH_LONG) show ();.
String uri = "http://192.168.0.101:80/";
textView.setText (get (uri));
}
});
/ / Bind button listener
post.setOnClickListener (new OnClickListener () {
@ Override
public void onClick (View v) {
Toast.makeText (MainActivity.this, "POST", Toast.LENGTH_LONG) show ();.
String uri = "http://192.168.0.101:80/";
textView.setText (post (uri));
}
});
}
/ **
* Send request to get access web
* @ Param uri web address
* @ Return response data
* /
private static String get (String uri) {
BufferedReader reader = null;
StringBuffer sb = null;
String result = "";
HttpClient client = new DefaultHttpClient ();
HttpGet request = new HttpGet (uri);
try {
/ / Send a request to obtain a response
HttpResponse response = client.execute (request);

/ / Request is successful
if (response.getStatusLine (). getStatusCode () == HttpStatus.SC_OK) {
reader = new BufferedReader (new InputStreamReader (response.getEntity () getContent ()).);
sb = new StringBuffer ();
String line = "";
String NL = System.getProperty ("line.separator");
while ((line = reader.readLine ())! = null) {
sb.append (line);
}
}
} Catch (ClientProtocolException e) {
e.printStackTrace ();
return "huai le!";
} Catch (IOException e) {
e.printStackTrace ();
return "huai le!";
}
finally {
try {
if (null! = reader) {
reader.close ();
reader = null;
}
} Catch (IOException e) {
e.printStackTrace ();
return "huai le!";
}
}
if (null! = sb) {
result = sb.toString ();
}

return result;
}
/ **
* Send a request to post, access web
* @ Param uri web address
* @ Return response data
* /
private static String post (String uri) {
BufferedReader reader = null;
StringBuffer sb = null;
String result = "";
HttpClient client = new DefaultHttpClient ();
HttpPost request = new HttpPost (uri);

/ / Save the parameters to be passed
List params = new ArrayList ();
/ / Add parameters
params.add (new BasicNameValuePair ("parameter", "send request to Post"));

try {
/ / Set the character set
HttpEntity entity = new UrlEncodedFormEntity (params, "utf-8");
/ / Request object
request.setEntity (entity);
/ / Send request
HttpResponse response = client.execute (request);

/ / Request is successful
if (response.getStatusLine (). getStatusCode () == HttpStatus.SC_OK) {
System.out.println ("post success");
reader = new BufferedReader (new InputStreamReader (response.getEntity () getContent ()).);
sb = new StringBuffer ();
String line = "";
String NL = System.getProperty ("line.separator");
while ((line = reader.readLine ())! = null) {
sb.append (line);
}
}
} Catch (ClientProtocolException e) {
e.printStackTrace ();
} Catch (IOException e) {
e.printStackTrace ();
}
finally {
try {
/ / Close the stream
if (null! = reader) {
reader.close ();
reader = null;
}
} Catch (IOException e) {
e.printStackTrace ();
}
}
if (null! = sb) {
result = sb.toString ();
}
return result;
}
}


This is my source, the package address:
http://pan.baidu.com/s/1jGE5kGY
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Paste the error log. .
Reply:
cited a floor jiaqiangm reply:
paste error log. .

02-08 20:34:18.700: D / AndroidRuntime (1487): Shutting down VM
02-08 20:34:18.700: W / dalvikvm (1487): threadid = 1: thread exiting with uncaught exception (group = 0x41490930)
02-08 20:34:18.710: E / AndroidRuntime (1487): FATAL EXCEPTION: main
02-08 20:34:18.710: E / AndroidRuntime (1487): android.os.NetworkOnMainThreadException
02-08 20:34:18.710: E / AndroidRuntime (1487): at android.os.StrictMode $ AndroidBlockGuardPolicy.onNetwork (StrictMode.java: 1117)
02-08 20:34:18.710: E / AndroidRuntime (1487): at libcore.io.BlockGuardOs.connect (BlockGuardOs.java: 84)
02-08 20:34:18.710: E / AndroidRuntime (1487): at libcore.io.IoBridge.connectErrno (IoBridge.java: 127)
02-08 20:34:18.710: E / AndroidRuntime (1487): at libcore.io.IoBridge.connect (IoBridge.java: 112)
02-08 20:34:18.710: E / AndroidRuntime (1487): at java.net.PlainSocketImpl.connect (PlainSocketImpl.java: 192)
02-08 20:34:18.710: E / AndroidRuntime (1487): at java.net.PlainSocketImpl.connect (PlainSocketImpl.java: 459)
02-08 20:34:18.710: E / AndroidRuntime (1487): at java.net.Socket.connect (Socket.java: 842)
02-08 20:34:18.710: E / AndroidRuntime (1487): at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket (PlainSocketFactory.java: 119)
02-08 20:34:18.710: E / AndroidRuntime (1487): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection (DefaultClientConnectionOperator.java: 144)
02-08 20:34:18.710: E / AndroidRuntime (1487): at org.apache.http.impl.conn.AbstractPoolEntry.open (AbstractPoolEntry.java: 164)
02-08 20:34:18.710: E / AndroidRuntime (1487): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open (AbstractPooledConnAdapter.java: 119)
02-08 20:34:18.710: E / AndroidRuntime (1487): at org.apache.http.impl.client.DefaultRequestDirector.execute (DefaultRequestDirector.java: 360)
02-08 20:34:18.710: E / AndroidRuntime (1487): at org.apache.http.impl.client.AbstractHttpClient.execute (AbstractHttpClient.java: 555)
02-08 20:34:18.710: E / AndroidRuntime (1487): at org.apache.http.impl.client.AbstractHttpClient.execute (AbstractHttpClient.java: 487)
02-08 20:34:18.710: E / AndroidRuntime (1487): at org.apache.http.impl.client.AbstractHttpClient.execute (AbstractHttpClient.java: 465)
02-08 20:34:18.710: E / AndroidRuntime (1487): at com.example.aa.MainActivity.get (MainActivity.java: 76)
02-08 20:34:18.710: E / AndroidRuntime (1487): at com.example.aa.MainActivity.access $ 1 (MainActivity.java: 68)
02-08 20:34:18.710: E / AndroidRuntime (1487): at com.example.aa.MainActivity $ 1.onClick (MainActivity.java: 50)
02-08 20:34:18.710: E / AndroidRuntime (1487): at android.view.View.performClick (View.java: 4204)
02-08 20:34:18.710: E / AndroidRuntime (1487): at android.view.View $ PerformClick.run (View.java: 17355)
02-08 20:34:18.710: E / AndroidRuntime (1487): at android.os.Handler.handleCallback (Handler.java: 725)
02-08 20:34:18.710: E / AndroidRuntime (1487): at android.os.Handler.dispatchMessage (Handler.java: 92)
02-08 20:34:18.710: E / AndroidRuntime (1487): at android.os.Looper.loop (Looper.java: 137)
02-08 20:34:18.710: E / AndroidRuntime (1487): at android.app.ActivityThread.main (ActivityThread.java: 5041)
02-08 20:34:18.710: E / AndroidRuntime (1487): at java.lang.reflect.Method.invokeNative (Native Method)
02-08 20:34:18.710: E / AndroidRuntime (1487): at java.lang.reflect.Method.invoke (Method.java: 511)
02-08 20:34:18.710: E / AndroidRuntime (1487): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java: 817)
02-08 20:34:18.710: E / AndroidRuntime (1487): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java: 584)
02-08 20:34:18.710: E / AndroidRuntime (1487): at dalvik.system.NativeStart.main (Native Method)
02-08 20:34:18.710: D / dalvikvm (1487): GC_CONCURRENT freed 316K, 17% free 5482K/6528K, paused 2ms +3 ms, total 26ms
Reply:
logcat Lane
Reply:
at com.example.aa.MainActivity.get (MainActivity.java: 76)

See this line
Reply:
HttpResponse response = client.execute (request);
Reply:
references, 4th Floor jiaqiangm reply:
at com.example.aa.MainActivity.get (MainActivity.java: 76)

See this line

To solve: Android4.0 after network connection is not allowed in the main thread
behttp://www.2cto.com/kf/201310/248730.html
Reply:
This is very evident in the main thread for network operation caused. Create a new thread, the network operations carried out into this thread.
Reply:
android 4.0 or later to access the network, you must use a new thread
Reply:
reference to the 7th floor ltl451011 reply:
This is very evident in the main thread for network operation caused. Create a new thread, the network operations carried out into this thread.


reference to the 8th floor wangmin06jb reply:
android 4.0 or later to access the network, you must use the new thread

So I ask why I write or not?
I want to achieve and get access to the network function method of web content.
For example
 String httpget (String targetURL) {
.....
.....
.....
return response;
}



Reply:
I do not write a bit messy code posted up hope Daniel can give the code, thank you!
Reply:
 new Thread (new Runnable () {

@ Override
public void run () {
/ / Get method, handler throws a result
}
}) Start ();.

Reply:
some code android network connection can not be placed in the main ui thread! Comes with android AsyncTask class to complete the asynchronous operation, or the other from a Thread to handle.
Reply:
The main thread is not blocked more than 5 seconds, http requests and the like should be another open thread.

Reply:
reference to the 9th floor netseif reply:
Quote: references to the 7th floor ltl451011 reply:

This is very evident in the main thread for network operation caused. Create a new thread, the network operations carried out into this thread.


reference to the 8th floor wangmin06jb reply:
android 4.0 or later to access the network, you must use the new thread

So I ask why I write or not?
I want to achieve and get access to the network function method of web content.
For example
 String httpget (String targetURL) {
.....
.....
.....
return response;
}



You need this method into a new thread or HandlerThread execution. Or use AsyncTask, run doInBackgroud in.

The modified Launcher start icon appears as a low-resolution issues


Hello everyone, recently modified Launcher, the Android 4.2 Launcher will separate out the compiled, installed on my phone (with a resolution of 1280 x 720, 4.7 inches), we found that the icon displays are low / medium resolution icon, looks very clear, but after I installed the millet desktop icons displayed on the normal and I have not changed Launcher redundant configuration, but can be modified to compile it. ask what configuration you also need to modify?



<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
I do not know whether you are compiling source code, if compiled in the source code, you need to launch 11 (N4), otherwise it can not reach a resolution of 720P
Reply:
cited a floor wypc520 reply:
not know whether you are in the source code compiled, if the source code to compile, you need to launch 11 (N4) Otherwise reach 720P resolution

I was alone out the Launcher code compiled in eclipse, in addition, launch11 (N4) What does this mean?
Reply:
Issues now loom temporarily not encountered such a problem
Reply:
Today it is accidental, the Internet actually found a solution, see link:
http://my.eoe.cn/cooker/archive/23185.html

The original reason targetSDK is not set. Then on the two pictures below, in order to record, want to give newcomers tips.



Here is the revised interface:

ubuntu android source code generated by the compiler can move it? ?


Look online said, fully compiled android 4.0 source code needs almost 100G space, I want them compiled after, put
Or upload your own mobile hard disk to network, share online to others,
1. But I do not know compiled files can not be moved,
2. There are other into a computer, the same effect can not be, or that the time needed to compile the kind of machine for the job? ?
3. There compiled files, is not all that out on the folder directory? ?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
1 can move
As long as the same operating environment (the same for each library version) no problem 2.
3 are out under
Reply:
cited a floor wypc520 reply:.
1 can move
As long as the same operating environment (the same for each library version) no problem 2.
3 are in out

Oh, this way, I am a novice, learning.
Thank you very much. .

NFC questions about the operation ...


 







android: resource = "@ xml / filter_nfc"
/>



 

<-! Capture anything using NfcF ->

android.nfc.tech.NfcA
android.nfc.tech.MifareClassic
android.nfc.tech.MifareUltralight







isNFC = getPackageManager () hasSystemFeature (PackageManager.FEATURE_NFC);.
if (isNFC) {
mAdapter = NfcAdapter.getDefaultAdapter (this);

mPendingIntent = PendingIntent.getActivity (this, 0,
new Intent (this, getClass ())
. AddFlags (Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
/ / Setup an intent filter for all MIME based dispatches
IntentFilter ndef = new IntentFilter (
NfcAdapter.ACTION_TECH_DISCOVERED);
ndef.addAction (NfcAdapter.ACTION_TAG_DISCOVERED);
try {
ndef.addDataType ("* / *");
} Catch (MalformedMimeTypeException e) {
Log.e ("NFCfail", "runtime Exception");
}

mFilters = new IntentFilter [] {ndef};

/ / Setup a tech list for all MifareClassic tags
mTechLists = new String [] [] {
new String [] {MifareClassic.class.getName ()},
new String [] {NfcA.class.getName ()}};

}




protected void onResume () {
super.onResume ();

if (isNFC && mAdapter.isEnabled ()) {

mAdapter.enableForegroundDispatch (this, mPendingIntent, mFilters,
mTechLists);
}


}



After induction card to get to the data in onNewIntent follows:
public void onNewIntent (Intent intent) {
String action = intent.getAction ();
/ / Action printout is: android.nfc.action.TECH_DISCOVERED

Tag tagFromIntent = intent.getParcelableExtra (NfcAdapter.EXTRA_TAG);
/ / TagFromIntent printout is: TAG: Tech [android.nfc.tech.NfcA]

The question is:
MifareClassic mfc = MifareClassic.get (tagFromIntent);
/ / Here mfc print output is null This is why

}


Thank you!

<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Seeking answers ah ah ah

SMS interception jar BroadcastReceiver


Seek expert to give pointers:

The following class inherits BroadcastReceiver, overloaded SmsReciver method, is to achieve the interception messaging functions. Intercept SMS functionality is achieved such calls,





Inside the xnl want this class, the code is

If not packaged into jar, run the project, recver method can be invoked via xml onReciver point, however, it com.example.duanxintest.SmsReciver packaged as the jar, run the project xml configuration unchanged, but did not perform SmsReciver. Tried many times, there is no error, please solve this problem teacher to solve, do not ask why I packaged as jar, because the company needs to be doing.

Thanks! ! !
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
I have tried, in time to play in the jar package also can perform. You look at the package path jar correctly?
Reply:
jar has been build into the apk there? check the build path eclipse
Reply:
Also estimated to import your jar package does not need to be applied in the project after the kick.
Reply:
After you have labeled jar package is also broadcast the need to register?
Reply:
Packaged into a jar path change?

Android How to delete a folder?


I want to delete all the files in a folder and its contents. If the file I just use file.delete (); deleted, but the folder does not know how to delete ah. I put all the contents inside the folder deleted, but that can not delete the folder itself, SD card which there has been an empty folder. Experts for advice how to solve this problem.

              

<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
 
02. Public static void delete (File file) {
03. If (file.isFile ()) {
. 04 file.delete ();
. 05 return;
06.}
07.
08. If (file.isDirectory ()) {
. 09 File [] childFiles = file.listFiles ();
10 if. (ChildFiles == null | | childFiles.length == 0) {
. 11 file.delete ();
. 12 return;
13.}
14.
. 15 for (int i = 0; i 16 delete (childFiles [i]);.
17.}
. 18 file.delete ();
19.}
20.}

Reply:
I do not understand why you can delete this approach? You also used. Delete () method to delete ah? I just started to try this method does not delete the folder ah? Is it because this method can only delete empty folders?
Reply:
reference to the second floor of the reply:
I do not understand why you can delete this approach? You also used. Delete () method to delete ah? I just started to try this method does not delete the folder ah? Is it because this method can only delete empty folders?

Yes, you can only delete empty folders ~
Reply:
Files and folders can be deleted
Reply:
I just tried it turned really like ah, blame me delete the stuff inside is no longer about trying to delete the folder. Thank you very much for helping two.
Reply:
Using a recursive method to delete a folder remember Results posted ah!
Reply:
delete (childFiles [i]);
Have
Reply:
delete (childFiles [i]);
There is this way?
Reply:
delete (childFiles [i]);. should be childFiles [i] delete
Reply:
delete (childFiles [i]); are recursive call