Android应用程序打开和关闭

时间:2016-01-30 05:07:04

标签: android build android-logcat

我一直试图制作一个php POST应用程序一段时间,但我使用的所有示例都不起作用。下面这个是我必须工作的最近的,但应用程序打开和关闭海峡。 LOGCAT说

01-30 15:33:38.032 20535-20750/system_process W/ActivityManager: Unable to start service Intent { cmp=tv.gamepop.remote.logger/.RegistrationService } U=0: not found

01-30 15:33:38.502 20535-20778/system_process D/InputMethodManagerService: ime_enabled = false is same as last value, no change

01-30 15:33:38.502 20535-20778/system_process W/InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 5223 uid 10026

我的代码

package au.com.industryresponsetraining.post;

import android.os.Bundle;
import android.view.View;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpResponse;
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.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import android.app.Activity;
import android.os.AsyncTask;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Toast;

public class Main extends Activity implements OnClickListener{

    private EditText value;
    private Button btn;
    private ProgressBar pb;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.home_layout);
        value=(EditText)findViewById(R.id.editText1);
        btn=(Button)findViewById(R.id.button1);
        pb=(ProgressBar)findViewById(R.id.progressBar1);
        pb.setVisibility(View.GONE);
        btn.setOnClickListener(this);
    }

    public void onClick(View v) {
        // TODO Auto-generated method stub
        if(value.getText().toString().length()<1){

            // out of range
            Toast.makeText(this, "please enter something", Toast.LENGTH_LONG).show();
        }else{
            pb.setVisibility(View.VISIBLE);
            new MyAsyncTask().execute(value.getText().toString());
        }


    }

    private class MyAsyncTask extends AsyncTask<String, Integer, Double>{

        @Override
        protected Double doInBackground(String... params) {
            // TODO Auto-generated method stub
            postData(params[0]);
            return null;
        }

        protected void onPostExecute(Double result){
            pb.setVisibility(View.GONE);
            Toast.makeText(getApplicationContext(), "command sent", Toast.LENGTH_LONG).show();
        }
        protected void onProgressUpdate(Integer... progress){
            pb.setProgress(progress[0]);
        }

        public void postData(String valueIWantToSend) {
            // Create a new HttpClient and Post Header
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost("http://industeryresponsetraning.com.au/mdt/add.php");

            try {
                // Add your data
                List nameValuePairs = new ArrayList();
                nameValuePairs.add(new BasicNameValuePair("name", valueIWantToSend));
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                // Execute HTTP Post Request
                HttpResponse response = httpclient.execute(httppost);

            } catch (ClientProtocolException e) {
                // TODO Auto-generated catch block
            } catch (IOException e) {
                // TODO Auto-generated catch block
            }
        }

    }
}

和我的清单

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="au.com.industryresponsetraining.post">
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".Main"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

任何帮助都可以帮助我实现这一目标

从开放到关闭的完整logcat

 -30 16:51:20.831 12994-13018/system_process W/ActivityManager: No content provider found for permission revoke: file:///data/local/tmp/au.com.industryresponsetraining.post
01-30 16:51:20.831 12994-13018/system_process W/ActivityManager: No content provider found for permission revoke: file:///data/local/tmp/au.com.industryresponsetraining.post
01-30 16:51:20.831 12994-13018/system_process I/PackageManager: Copying native libraries to /data/app-lib/vmdl203661240
01-30 16:51:20.861 12994-13018/system_process D/dalvikvm: GC_EXPLICIT freed 574K, 25% free 5967K/7920K, paused 20ms+0ms, total 30ms
01-30 16:51:20.881 12994-13018/system_process D/dalvikvm: GC_FOR_ALLOC freed 387K, 22% free 6189K/7920K, paused 10ms, total 10ms
01-30 16:51:20.921 12994-13018/system_process D/dalvikvm: GC_FOR_ALLOC freed 1122K, 20% free 6402K/7920K, paused 10ms, total 10ms
01-30 16:51:20.941 12994-13018/system_process D/dalvikvm: GC_FOR_ALLOC freed 980K, 20% free 6409K/7920K, paused 10ms, total 10ms
01-30 16:51:20.971 12994-13018/system_process D/dalvikvm: GC_FOR_ALLOC freed 982K, 19% free 6417K/7920K, paused 20ms, total 20ms
01-30 16:51:21.011 12994-13009/system_process I/ActivityManager: Force stopping au.com.industryresponsetraining.post appid=10068 user=-1: uninstall pkg
01-30 16:51:21.011 12994-13009/system_process I/ActivityManager: Setting mBooting value to false, currently mBooted = true
01-30 16:51:21.031 12994-13018/system_process I/PackageManager: Package au.com.industryresponsetraining.post codePath changed from /data/app/au.com.industryresponsetraining.post-1.apk to /data/app/au.com.industryresponsetraining.post-2.apk; Retaining data and using new
01-30 16:51:21.051 12994-13018/system_process D/dalvikvm: GC_EXPLICIT freed 1040K, 19% free 6436K/7920K, paused 0ms+0ms, total 20ms
01-30 16:51:21.051 12994-13018/system_process I/PackageManager: Running dexopt on: au.com.industryresponsetraining.post
01-30 16:51:21.361 12994-13018/system_process W/PackageManager: Code path for pkg : au.com.industryresponsetraining.post changing from /data/app/au.com.industryresponsetraining.post-1.apk to /data/app/au.com.industryresponsetraining.post-2.apk
01-30 16:51:21.361 12994-13018/system_process W/PackageManager: Resource path for pkg : au.com.industryresponsetraining.post changing from /data/app/au.com.industryresponsetraining.post-1.apk to /data/app/au.com.industryresponsetraining.post-2.apk
01-30 16:51:21.371 12994-13009/system_process I/ActivityManager: Force stopping au.com.industryresponsetraining.post appid=10068 user=-1: update pkg
01-30 16:51:21.371 12994-13009/system_process I/ActivityManager: Setting mBooting value to false, currently mBooted = true
01-30 16:51:21.411 12994-13018/system_process I/ActivityManager: Force stopping au.com.industryresponsetraining.post appid=10068 user=0: pkg removed
01-30 16:51:21.431 12994-13009/system_process I/ActivityManager: Setting mBooting value to false, currently mBooted = true
01-30 16:51:21.441 12994-13032/system_process I/InputReader: Reconfiguring input devices.  changes=0x00000010
01-30 16:51:21.451 12994-12994/system_process D/BackupManagerService: Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:au.com.industryresponsetraining.post flg=0x4000010 (has extras) }
01-30 16:51:21.461 12994-13009/system_process I/ActivityManager: Start proc com.android.musicfx for broadcast com.android.musicfx/.Compatibility$Receiver: pid=18301 uid=10001 gids={50001, 3003, 3002}
01-30 16:51:21.471 12994-13010/system_process W/LocationProviderProxy-fused: com.google.android.gms resolves service com.android.location.service.FusedLocationProvider, but has wrong signature, ignoring
01-30 16:51:21.471 12994-13010/system_process W/RecognitionManagerService: no available voice recognition services found for user 0
01-30 16:51:21.481 12994-13032/system_process I/InputReader: Reconfiguring input devices.  changes=0x00000010
01-30 16:51:21.511 12994-12994/system_process D/BackupManagerService: Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:au.com.industryresponsetraining.post flg=0x4000010 (has extras) }
01-30 16:51:21.591 12994-13006/system_process I/ActivityManager: Delay finish: com.bluestacks.home/.KeyMappingDownloader$PackageModifiedRecevier
01-30 16:51:21.591 12994-13065/system_process I/ActivityManager: Resuming delayed broadcast
01-30 16:51:21.611 12994-13065/system_process I/ActivityManager: Start proc com.android.keychain for broadcast com.android.keychain/.KeyChainBroadcastReceiver: pid=18328 uid=1000 gids={41000, 1028, 1015, 1023, 3002, 3001, 3003}
01-30 16:51:21.641 12994-13138/system_process I/ActivityManager: Killing 15779:com.google.android.gms.wearable/u0a19 (adj 15): empty #6
01-30 16:51:21.681 12994-13018/system_process D/dalvikvm: GC_EXPLICIT freed 1836K, 24% free 6073K/7952K, paused 0ms+0ms, total 220ms
01-30 16:51:21.731 12994-13005/system_process I/ActivityManager: Start proc com.google.android.partnersetup for broadcast com.google.android.partnersetup/.RlzPingBroadcastReceiver: pid=18345 uid=10018 gids={50018, 3003}
01-30 16:51:21.751 12994-13287/system_process I/ActivityManager: Delaying start of: ServiceRecord{329f6078 u0 com.google.android.gms/.wearable.service.WearableControlService}
01-30 16:51:21.771 12994-13196/system_process I/ActivityManager: Start proc com.google.android.gms.wearable for service com.google.android.gms/.wearable.service.WearableControlService: pid=18363 uid=10019 gids={50019, 3003, 1007, 1028, 1015, 1023, 3002, 3001, 3007, 2001, 3006}
01-30 16:51:21.771 12994-13006/system_process I/ActivityManager: Killing 16205:android.process.media/u0a12 (adj 15): empty #6
01-30 16:51:21.771 12994-13006/system_process I/ActivityManager: Delay finish: com.google.android.gms/.app.receiver.SystemBroadcastReceiver
01-30 16:51:21.861 12994-13221/system_process I/ActivityManager: Resuming delayed broadcast
01-30 16:51:21.861 12994-13006/system_process I/ActivityManager: Delay finish: com.bluestacks.home/.KeyMappingDownloader$PackageModifiedRecevier
01-30 16:51:21.871 12994-13139/system_process I/ActivityManager: Resuming delayed broadcast
01-30 16:51:21.891 12994-13139/system_process I/ActivityManager: Start proc com.svox.pico for broadcast com.svox.pico/.VoiceDataInstallerReceiver: pid=18386 uid=10047 gids={50047, 1028, 1015, 1023}
01-30 16:51:21.891 12994-13194/system_process I/ActivityManager: Killing 18328:com.android.keychain/1000 (adj 15): empty #6
01-30 16:51:21.901 12994-13006/system_process I/ActivityManager: Killing 18301:com.android.musicfx/u0a1 (adj 15): empty #6
01-30 16:51:22.031 12994-13218/system_process I/ActivityManager: Start proc com.android.musicfx for broadcast com.android.musicfx/.Compatibility$Receiver: pid=18408 uid=10001 gids={50001, 3003, 3002}
01-30 16:51:22.031 12994-13005/system_process I/ActivityManager: Delay finish: com.android.musicfx/.Compatibility$Receiver
01-30 16:51:22.041 12994-13065/system_process I/ActivityManager: Resuming delayed broadcast
01-30 16:51:22.051 12994-13138/system_process I/ActivityManager: Delay finish: com.google.android.gms/.app.receiver.SystemBroadcastReceiver
01-30 16:51:22.061 12994-13218/system_process I/ActivityManager: Killing 16173:com.android.vending/u0a16 (adj 15): empty #6
01-30 16:51:22.101 12994-13287/system_process I/ActivityManager: Resuming delayed broadcast
01-30 16:51:22.121 12994-13287/system_process D/dalvikvm: GC_FOR_ALLOC freed 1055K, 25% free 6018K/7952K, paused 10ms, total 10ms
01-30 16:51:22.161 12994-13065/system_process I/ActivityManager: Delay finish: com.google.android.gms/.auth.be.account.AccountStatusChecker$InitializeReceiver
01-30 16:51:22.181 12994-13005/system_process I/ActivityManager: Resuming delayed broadcast
01-30 16:51:22.361 12994-13218/system_process I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=au.com.industryresponsetraining.post/.Main} from pid 18407
01-30 16:51:22.361 12994-13218/system_process D/ActivityManager: TopActivityInfo, pkgName: au.com.industryresponsetraining.post activityName: au.com.industryresponsetraining.post.Main callingPackage: null  bstSpecialAppKeyboardHandlingEnabled = false
01-30 16:51:22.371 12994-13218/system_process D/ActivityManager: Showing guidance for pkgName: au.com.industryresponsetraining.post
01-30 16:51:22.391 12994-13218/system_process D/dalvikvm: GC_FOR_ALLOC freed 567K, 25% free 5984K/7952K, paused 20ms, total 20ms
01-30 16:51:22.391 12994-13218/system_process I/dalvikvm-heap: Grow heap (frag case) to 5.993MB for 124212-byte allocation
01-30 16:51:22.421 12994-13008/system_process D/dalvikvm: GC_FOR_ALLOC freed 9K, 25% free 6096K/8076K, paused 30ms, total 30ms
01-30 16:51:22.421 12994-13221/system_process D/ActivityManager: TopActivityInfo, pkgName: au.com.industryresponsetraining.post activityName: au.com.industryresponsetraining.post/.Main callingPackage:   bstSpecialAppKeyboardHandlingEnabled = false
01-30 16:51:22.431 12994-13221/system_process D/ActivityManager: Showing guidance for pkgName: au.com.industryresponsetraining.post
01-30 16:51:22.451 12994-13221/system_process I/ActivityManager: Start proc au.com.industryresponsetraining.post for activity au.com.industryresponsetraining.post/.Main: pid=18445 uid=10068 gids={50068, 3003}
01-30 16:51:22.461 12994-13196/system_process D/WindowManager: in computeScreenConfigurationLocked() -- hardKeyboardAvailable :true  mHardKeyboardAvailable :true   mHardKeyboardEnabled :true
01-30 16:51:22.541 12994-13013/system_process D/WindowManager: Sending appClickStats request with data: [package=au.com.industryresponsetraining.post, appname=Post, appver=1.0, clickloc=system_server]
01-30 16:51:22.551 12994-13218/system_process I/ActivityManager: Process au.com.industryresponsetraining.post (pid 18445) has died.
01-30 16:51:22.551 12994-13218/system_process D/ActivityManager: TopActivityInfo, pkgName: au.com.industryresponsetraining.post activityName: au.com.industryresponsetraining.post/.Main callingPackage:   bstSpecialAppKeyboardHandlingEnabled = false
01-30 16:51:22.551 12994-13218/system_process D/ActivityManager: Showing guidance for pkgName: au.com.industryresponsetraining.post
01-30 16:51:22.571 12994-13218/system_process I/ActivityManager: Start proc au.com.industryresponsetraining.post for activity au.com.industryresponsetraining.post/.Main: pid=18465 uid=10068 gids={50068, 3003}
01-30 16:51:22.581 12994-13005/system_process D/WindowManager: in computeScreenConfigurationLocked() -- hardKeyboardAvailable :true  mHardKeyboardAvailable :true   mHardKeyboardEnabled :true
01-30 16:51:22.621 12994-13006/system_process I/ActivityManager: Process au.com.industryresponsetraining.post (pid 18465) has died.
01-30 16:51:22.621 12994-13006/system_process D/ActivityManager: TopActivityInfo, pkgName: au.com.industryresponsetraining.post activityName: au.com.industryresponsetraining.post/.Main callingPackage:   bstSpecialAppKeyboardHandlingEnabled = false
01-30 16:51:22.621 12994-13006/system_process D/ActivityManager: Showing guidance for pkgName: au.com.industryresponsetraining.post
01-30 16:51:22.641 12994-13006/system_process I/ActivityManager: Start proc au.com.industryresponsetraining.post for activity au.com.industryresponsetraining.post/.Main: pid=18482 uid=10068 gids={50068, 3003}
01-30 16:51:22.651 12994-13138/system_process D/WindowManager: in computeScreenConfigurationLocked() -- hardKeyboardAvailable :true  mHardKeyboardAvailable :true   mHardKeyboardEnabled :true
01-30 16:51:22.691 12994-13139/system_process I/ActivityManager: Process au.com.industryresponsetraining.post (pid 18482) has died.
01-30 16:51:22.691 12994-13139/system_process W/ActivityManager: Force removing ActivityRecord{3293342c u0 au.com.industryresponsetraining.post/.Main t4}: app died, no saved state
01-30 16:51:22.691 12994-13139/system_process D/ActivityManager: TopActivityInfo, pkgName: com.bluestacks.gamepophome activityName: com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_ callingPackage:   bstSpecialAppKeyboardHandlingEnabled = false
01-30 16:51:22.701 12994-13139/system_process D/ActivityManager: Showing guidance for pkgName: com.bluestacks.gamepophome
01-30 16:51:22.701 12994-13139/system_process D/WindowManager: in computeScreenConfigurationLocked() -- hardKeyboardAvailable :true  mHardKeyboardAvailable :true   mHardKeyboardEnabled :true
01-30 16:51:23.241 12994-13194/system_process W/InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@3272635c attribute=null, token = android.os.BinderProxy@3298c86c
01-30 16:51:23.241 12994-13218/system_process I/ActivityManager: Setting mBooting value to false, currently mBooted = true
01-30 16:51:23.531 12994-13008/system_process D/WindowManager: topDisplayedActivityInfo, appToken: Token{328c98a4 ActivityRecord{3286cc18 u0 com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_ t1}}
01-30 16:51:23.531 12994-13008/system_process D/WindowManager: topDisplayedActivityInfo, appToken: Token{328c98a4 ActivityRecord{3286cc18 u0 com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_ t1}}
01-30 16:51:30.911 12994-13005/system_process I/ActivityManager: Killing 18345:com.google.android.partnersetup/u0a18 (adj 15): empty #6
01-30 16:51:32.091 12994-13032/system_process I/InputReader: Reconfiguring input devices.  changes=0x00000010
01-30 16:51:32.111 12994-13221/system_process D/dalvikvm: GC_FOR_ALLOC freed 1351K, 25% free 6058K/8076K, paused 20ms, total 20ms
01-30 16:51:32.121 12994-13221/system_process I/ActivityManager: Start proc com.android.vending for broadcast com.android.vending/com.google.android.finsky.receivers.PackageMonitorReceiver$RegisteredReceiver: pid=18591 uid=10016 gids={50016, 3003, 1028, 1015, 1023}
01-30 16:51:32.181 12994-13010/system_process W/LocationProviderProxy-fused: com.google.android.gms resolves service com.android.location.service.FusedLocationProvider, but has wrong signature, ignoring
01-30 16:51:32.211 12994-13138/system_process I/ActivityManager: Start proc android.process.media for content provider com.android.providers.downloads/.DownloadProvider: pid=18623 uid=10012 gids={50012, 1028, 1015, 1023, 1024, 2001, 3003, 3007}
01-30 16:51:32.221 12994-13139/system_process I/ActivityManager: Killing 18408:com.android.musicfx/u0a1 (adj 15): empty #6
01-30 16:51:32.221 12994-13139/system_process I/ActivityManager: Killing 18386:com.svox.pico/u0a47 (adj 15): empty #7
01-30 16:51:34.281 12994-13032/system_process E/InputDispatcher: Motion event has invalid pointer count 0; value must be between 1 and 16.
01-30 16:51:34.431 12994-13032/system_process E/InputDispatcher: Motion event has invalid pointer count 0; value must be between 1 and 16.
01-30 16:51:34.481 12994-13287/system_process I/ActivityManager: Process com.bluestacks.gamepophome (pid 13219) has died.
01-30 16:51:34.481 12994-13138/system_process I/WindowState: WIN DEATH: Window{3298c9a8 u0 com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_}
01-30 16:51:34.481 12994-13287/system_process D/ActivityManager: TopActivityInfo, pkgName: com.bluestacks.gamepophome activityName: com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_ callingPackage:   bstSpecialAppKeyboardHandlingEnabled = false
01-30 16:51:34.491 12994-13287/system_process D/ActivityManager: Showing guidance for pkgName: com.bluestacks.gamepophome
01-30 16:51:34.511 12994-13287/system_process I/ActivityManager: Start proc com.bluestacks.gamepophome for activity com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_: pid=18679 uid=10026 gids={50026, 3003, 1028, 1015, 1023, 3002}
01-30 16:51:34.551 12994-13194/system_process D/WindowManager: in computeScreenConfigurationLocked() -- hardKeyboardAvailable :true  mHardKeyboardAvailable :true   mHardKeyboardEnabled :true
01-30 16:51:34.691 12994-13006/system_process W/ActivityManager: Unable to start service Intent { cmp=tv.gamepop.remote.logger/.RegistrationService } U=0: not found
01-30 16:51:35.101 12994-13221/system_process D/InputMethodManagerService: ime_enabled = false is same as last value, no change
01-30 16:51:35.101 12994-13221/system_process W/InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 13219 uid 10026
01-30 16:51:35.111 12994-13008/system_process I/ActivityManager: Displayed com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_: +620ms
01-30 16:51:35.111 12994-13008/system_process D/WindowManager: topDisplayedActivityInfo, appToken: Token{328c98a4 ActivityRecord{3286cc18 u0 com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_ t1}}
01-30 16:51:35.111 12994-13008/system_process D/WindowManager: topDisplayedActivityInfo, appToken: Token{328c98a4 ActivityRecord{3286cc18 u0 com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_ t1}}
01-30 16:51:35.311 12994-13008/system_process D/WindowManager: topDisplayedActivityInfo, appToken: Token{328c98a4 ActivityRecord{3286cc18 u0 com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_ t1}}
01-30 16:51:35.471 12994-13005/system_process I/ActivityManager: Setting mBooting value to false, currently mBooted = true

布局

<?xml version="1.0" encoding="utf-8"?>
<RelstiveLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"
        android:text="Enter Something Below:"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView1"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="30dp"
        android:ems="10"
        android:hint=""
        >

        <requestFocus />
    </EditText>

    <ProgressBar
        android:id="@+id/progressBar1"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/editText1"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="24dp" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView1"
        android:layout_alignRight="@+id/editText1"
        android:layout_below="@+id/progressBar1"
        android:layout_marginTop="24dp"
        android:text="Submit"
        android:onClick="showZiare"/>
</RelstiveLayout>

编辑:删除进度条以后认为是问题后更新了logcat

运行中的Logcat

01-30 18:47:00.159 28194-28275/system_process E/InputDispatcher: Motion event has invalid pointer count 0; value must be between 1 and 16.
01-30 18:47:00.249 28194-28275/system_process E/InputDispatcher: Motion event has invalid pointer count 0; value must be between 1 and 16.
01-30 18:47:00.309 28194-28452/system_process I/ActivityManager: Process com.bluestacks.gamepophome (pid 28457) has died.
01-30 18:47:00.309 28194-28301/system_process I/WindowState: WIN DEATH: Window{32996a98 u0 com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_}
01-30 18:47:00.309 28194-28452/system_process D/ActivityManager: TopActivityInfo, pkgName: com.bluestacks.gamepophome activityName: com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_ callingPackage:   bstSpecialAppKeyboardHandlingEnabled = false
01-30 18:47:00.309 28194-28452/system_process D/ActivityManager: Showing guidance for pkgName: com.bluestacks.gamepophome
01-30 18:47:00.339 28194-28452/system_process I/ActivityManager: Start proc com.bluestacks.gamepophome for activity com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_: pid=30555 uid=10026 gids={50026, 3003, 1028, 1015, 1023, 3002}
01-30 18:47:00.359 28194-28301/system_process D/WindowManager: in computeScreenConfigurationLocked() -- hardKeyboardAvailable :true  mHardKeyboardAvailable :true   mHardKeyboardEnabled :true
01-30 18:47:00.489 28194-28301/system_process W/ActivityManager: Unable to start service Intent { cmp=tv.gamepop.remote.logger/.RegistrationService } U=0: not found
01-30 18:47:00.579 28194-28301/system_process D/dalvikvm: GC_FOR_ALLOC freed 1196K, 21% free 6200K/7832K, paused 20ms, total 20ms
01-30 18:47:00.969 28194-28207/system_process D/WindowManager: topDisplayedActivityInfo, appToken: Token{32928b38 ActivityRecord{32928a0c u0 com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_ t1}}
01-30 18:47:00.989 28194-28207/system_process I/ActivityManager: Displayed com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_: +660ms
01-30 18:47:00.999 28194-28207/system_process D/WindowManager: topDisplayedActivityInfo, appToken: Token{32928b38 ActivityRecord{32928a0c u0 com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_ t1}}
01-30 18:47:01.009 28194-28452/system_process D/InputMethodManagerService: ime_enabled = false is same as last value, no change
01-30 18:47:01.009 28194-28452/system_process W/InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 28457 uid 10026
01-30 18:47:01.199 28194-28207/system_process D/WindowManager: topDisplayedActivityInfo, appToken: Token{32928b38 ActivityRecord{32928a0c u0 com.bluestacks.gamepophome/tv.gamepop.home.GamePopMain_ t1}}
01-30 18:47:02.799 28194-28416/system_process I/ActivityManager: Setting mBooting value to false, currently mBooted = true

调试控制台(如果有帮助)

Target device: emulator-5554
No apk changes detected since last installation, skipping installation of C:\Users\Shane\AndroidStudioProjects\Post\app\build\outputs\apk\app-debug.apk
Force stopping package: au.com.industryresponsetraining.post
DEVICE SHELL COMMAND: am force-stop au.com.industryresponsetraining.post
Launching application: au.com.industryresponsetraining.post/au.com.industryresponsetraining.post.Main.
DEVICE SHELL COMMAND: am start -D -n "au.com.industryresponsetraining.post/au.com.industryresponsetraining.post.Main" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet.
Client not ready yet.
Client not ready yet.
Client not ready yet.
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=au.com.industryresponsetraining.post/.Main }

Waiting for process: au.com.industryresponsetraining.post
Client not ready yet.
Client not ready yet.
Connected to the target VM, address: 'localhost:9514', transport: 'socket'
Disconnected from the target VM, address: 'localhost:9514', transport: 'socket'

1 个答案:

答案 0 :(得分:2)

问题是因为你拼错了RelativeLayout到&#34; RelstiveLayout&#34;并且在Android中没有可用的类具有这样的名称,即应用程序在启动后立即崩溃。

更改

Dim OrigCode, ModifiedCode as string
OrigCode = GetGoogleCodeFromURL  ' get the code
ModifiedCode = OrigCode.Replace("XXXXXXX","ZZZZZZ")

Dim MyHTML as string = "<head>...</head><body><h1>Hello World!</h1><p>&nbsp;</p>" & _
                           ModifiedCode & "<p>&nbsp;</p><p>That's it.</p>"

$config['log_threshold'] = [log_level ranges 0-4];

那就是它。

另外作为旁注也这样做,因为它对你的情况没用,你在Activity本身中实现了OnClickListner。 从布局文件的按钮部分

<RelstiveLayout

删除

布局xml中的

<RelativeLayout 属性用于按钮。

你很高兴去:)