, 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!
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
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.
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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 FragmentActivity sub Fragment included in FragmentTabHost not display expert answers to solve
Download address http://pan.baidu.com/s/1c0vMr3i
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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
/ ** * 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
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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
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?
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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!
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?
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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!
Development with eclipse android, the source code has been downloaded well, how construction can ah? Novice seeking advice ah
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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
The finger guessing game and computer mora computer punch: player punches: scissors stone cloth determine winners and losers: Congratulations, you win! Unfortunately, you lose! sides tie!
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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.
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
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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
Multi-page biography value bundle is certainly good, write it again on the line, why should intent exist?
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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
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.
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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. . .
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; }
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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!
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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.
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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!
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?
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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.
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;
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 {
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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:
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:
Button also view it Reply: The findviewbyid and setonclick into PlaceholderFragment in the onCreateView. Reply:
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.
Recent wanted a similar word lock screen software! ! There are a large source of cattle have provided it Guiqiu! ! !
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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:
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:
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 {
@ 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 () {
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
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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
public Button register; public ToggleButton marriged; public RadioButton male; public EditText username, password; public Spinner position; public CheckBox reading, swimming;
android: text = "@ string / cancel" android: id = "@ + id / cancel" android: layout_width = "wrap_content" android: layout_height = "wrap_content" style = "android:? attr / borderlessButtonStyle" />
android: text = "@ string / register" android: id = "@ + id / register" android: layout_width = "wrap_content" android: layout_height = "wrap_content" style = "android:? attr / borderlessButtonStyle" />
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.
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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 {
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:
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
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.
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);
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; } }
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) -> Reply: Paste the error log. . 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:
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:
This is very evident in the main thread for network operation caused. Create a new thread, the network operations carried out into this thread.
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
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:
This is very evident in the main thread for network operation caused. Create a new thread, the network operations carried out into this thread.
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
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?
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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:
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.
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? ?
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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:
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. .
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 ()}};
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!
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) -> Reply: Seeking answers ah ah ah
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! ! !
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! 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?
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.
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) -> Reply:
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:
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