public class MainActivity extends Activity { private final String[] m = {"com.sina.weibo.InterestProductList", "com.sina.weibo.WBArticalEditActivity", "com.sina.weibo.ShootingPopActivity", "com.sina.weibo.photoalbum.VideoAlbumActivity", "com.sina.weibo.photoalbum.camera.CameraActivity", "com.sina.weibo.photoalbum.camera.CameraAdapterActivity", "com.sina.weibo.photoalbum.video.VideoCutActivity", "com.sina.weibo.photoalbum.video.edit.VideoEditActivity", "com.sina.weibo.photoalbum.LocalVideoPlayerActivity", "com.sina.weibo.photoalbum.LocalVideoPlayerTempActivity", "com.sina.weibo.photoalbum.camera.CameraProxyActivity", "com.tencent.connect.common.AssistActivity", "com.sina.weibo.SmsCodeLoginActivity", "com.sina.weibo.SmsCodeLogin", "com.sina.weibo.UpdatePasswordActivity", "com.sina.weibo.UserLoginEntranceActivity", "com.sina.weibo.WaterMarkEditActivity", "com.sina.weibo.SettingsPref", "com.sina.weibo.SettingsMainActivity", "com.sina.weibo.SettingsLanguageActivity", "com.sina.weibo.page.FollowGroupSelectActivity", "com.sina.weibo.SettingsImageActivity", "com.sina.weibo.SettingsAudioActivity", "com.sina.weibo.SilentTimeActivity", "com.sina.weibo.RemindFrequencyActivity", "com.sina.weibo.RemindRelationActivity", "com.sina.weibo.weiyou.DMSingleChatActivity", "com.sina.weibo.MessageGroupMemberManageActivity", "com.sina.weibo.MessageGroupManageSizeActivity", "com.sina.weibo.weiyou.DMGroupChatActivity", "com.sina.weibo.weiyou.DMGroupNoticeActivity", "com.sina.weibo.weiyou.DMChatSettingActivity", "com.sina.weibo.AccountManager", "com.sina.weibo.weiyou.DMMessageMsgBoxActivity", "com.sina.weibo.MessageBoxSettingActivity", "com.sina.weibo.FriendCircleMembersAddSearchActivity", "com.sina.weibo.GroupMembersAddSearchActivity", "com.sina.weibo.page.MyInfoActivity2", "com.sina.weibo.page.MyInfoTabActivity", "com.sina.weibo.page.EditUserInfoActivity", "com.sina.weibo.page.EditUserWorkInfoActivity", "com.sina.weibo.page.EditUserEducationInfoActivity", "com.sina.weibo.FillInfoActivity", "com.sina.weibo.page.UserTopicAttentionList", "com.sina.weibo.browser.WeiboBrowser", "com.sina.weibo.browser.WeiboBrowserForGuide", "com.sina.weibo.ReadModeActivity", "com.sina.weibo.PrivacyAndSafeActivity", "com.sina.weibo.FontSizeSettingActivity", "com.weibo.mobileads.view.FlashAdActivity", "com.sina.weibo.ExceptionDialogActivity", "com.sina.weibo.PayConfirmOrderActivity", "com.sina.weibo.DomainRetriveActivity", "com.sina.weibo.MailRetriveActivity", "com.sina.weibo.AboutActivity", "com.sina.weibo.ChoiceActivity", "com.sina.weibo.MoreItemsActivity", "com.sina.weibo.AEditUserInfo", "com.sina.weibo.page.AEditText", "com.sina.weibo.RegisterHomeActivity", "com.sina.weibo.ForgetPwdActivity", "com.sina.weibo.RegisterSquareActivity", "com.sina.weibo.SkinPreviewActivity", "com.sina.weibo.MessageContactActivity", "com.sina.weibo.SearchGroupChatAndFansActivity", "com.sina.weibo.SSOLoginActivity", "com.sina.weibo.SSOAccountListActivity", "com.sina.weibo.SSOAuthorizeActivity", "com.sina.weibo.ProjectModeActivity", "com.sina.weibo.POIListActivity", "com.sina.weibo.ChooseShareScopeActivity", "com.sina.weibo.ChooseContactsInSearchActivity", "com.sina.weibo.photoalbum.PicFilterActivity", "com.sina.weibo.photoalbum.ImagePreviewActivity", "com.sina.weibo.photoalbum.PicCropActivity", "com.sina.weibo.photoalbum.Pic9cutCropActivity", "com.sina.weibo.Pic9cutGameActivity", "com.sina.weibo.UserGuideContactActivity", "com.sina.weibo.UserGuideCategoryDetail", "com.sina.weibo.photoalbum.FilterMarketActivity", "com.sina.weibo.photoalbum.VideoEffectStoreActivity", "com.sina.weibo.photoalbum.VideoMusicStoreActivity", "com.sina.weibo.EditSourceActivity", "com.sina.weibo.AttachAppManagementActivity", "com.sina.weibo.AttachAppDetailInfoActivity", "com.sina.weibo.FixedCarshActivity", "com.sina.weibo.NoNetActivity", "com.sina.weibo.LogFeedbackActivity", "com.sina.weibo.LogFeedbackUnicomActivity", "com.sina.weibo.WebWeiboActivity", "com.sina.weibo.DetailLogActivity", "com.sina.weibo.DetailLogItemActivity", "com.sina.weibo.SelectCountryActivity", "com.sina.weibo.VerificationCodeActivity", "com.sina.weibo.NewInterestPeopleActivity", "com.sina.weibo.YouMayKnowActivity", "com.sina.weibo.NewRegistContact", "com.sina.weibo.FriendCircleFeedGuideActivity", "com.sina.weibo.SpecialFollowFeedGuideActivity", "com.sina.weibo.HotCmtAndForwardActivity", "com.sina.weibo.QRCodeGuideActivity", "com.sina.weibo.InfoPageBackGuideActivity", "com.weibo.mobileads.view.AdActivity", "com.sina.qrcode.MyQRcodeActivity", "com.sina.popupad.PopupActivity", "com.sina.weibo.browser.InfoPageActivity", "com.sina.weibo.RemindSettingsActivity", "com.sina.weibo.RemindInnerSettingsActivity", "com.sina.weibo.RemindNoDisturbSettingsActivity", "com.sina.weibo.RemindSettingGuideActivity", "com.sina.weibo.MessageStrangerGuideActivity", "com.sina.weibo.page.SquareActivity", "com.sina.weibo.LikeListActivity", "com.sina.weibo.ContactsSearchResultActivity", "com.sina.weibo.PrivateSearchFanResultActivity", "com.sina.weibo.page.TopicSuggestionActivity", "com.sina.weibo.page.AtSuggestionActivity", "com.sina.weibo.AddFriendActivity", "com.sina.weibo.appmarket.activity.HomePageAppActivity", "com.sina.weibo.appmarket.activity.HomePageWeiGameActivity", "com.sina.weibo.appmarket.activity.DownloadMainActivity", "com.sina.weibo.appmarket.activity.WeiboDownloadAppActivity", "com.sina.weibo.appmarket.activity.SubjectActivity", "com.sina.weibo.appmarket.activity.SubjectDetailActivity", "com.sina.weibo.appmarket.activity.AppListActivity", "com.sina.weibo.appmarket.activity.AppSearchPageActivity", "com.sina.weibo.appmarket.activity.CategoryAppActivity", "com.sina.weibo.appmarket.activity.ReportActivity", "com.sina.weibo.appmarket.activity.AppIgnoredPageActivity", "com.sina.weibo.appmarket.activity.AppUpdatePageActivity", "com.sina.weibo.appmarket.activity.AppInstalledPageActivity", "com.sina.weibo.appmarket.activity.MyGamePageActivity", "com.sina.weibo.appmarket.activity.BigPicActivity", "com.sina.weibo.appmarket.shell.DialogActivity", "com.alipay.android.app.pay.MiniLaucherActivity", "com.alipay.android.app.ui.quickpay.window.MiniPayActivity", "com.alipay.android.app.ui.quickpay.window.MiniWebActivity", "com.alipay.sdk.auth.AuthActivity", "com.sina.weibo.terminal.TerminalActivity", "com.sina.weibo.terminal.Term", "com.sina.weibo.terminal.TermPreferences", "com.sina.memory.NewProjectModeActivity", "com.sina.weibo.exlibs.NewProjectModeActivityPreLoading", "com.sina.weibo.LogFileReadActivity", "com.facebook.LoginActivity", "com.sina.weibo.WeiboGuideActivity", "com.sina.weibo.GroupManageActivity", "com.sina.weibo.GroupMembersAddActivity", "com.sina.weibo.media.player.VideoPlayerActivity", "com.sina.weibo.media.player.MusicListActivity", "com.sina.weibo.page.MyGroupFollowersActivity", "com.sina.weibo.page.MyFollowersSearchActivity", "com.sina.weibo.page.MyGroupFollowSearchActivity", "com.sina.weibo.page.MyFollowSearchResultActivity", "com.sina.weibo.EggBoardActivity", "com.sina.weibo.SharePrivateMessageActivity", "com.sina.weibomonitor.view.ExDialog", "com.sina.weibo.NetWorkAnalyseActivity", "com.sina.weibo.VisitorMainTabActivity", "com.sina.weibo.VisitorOverseaSignUpActivity", "com.sina.weibo.VisitorGetAccountActivity", "com.sina.weibo.VisitorSignUpActivity", "com.sina.weibo.VisitorLoginActivity", "com.sina.weibo.LogFeedbackTrafficActivity", "com.sina.weibo.LogDnsListActivity", "com.sina.weibo.VisitorHomeActivity", "com.sina.weibo.VisitorSearchActivity", "com.sina.weibo.VisitorMoreActivity", "com.sina.weibo.VisitorMessageActivity", "com.sina.weibo.VisitorMeActivity", "com.sina.weibo.WaterMarkContentEditActivity", "com.sina.weibo.wbc.UploadQueueActivity", "com.sina.weibo.wlan.WifiAuthActivity", "com.sina.weibo.ShareModuleActivity", "com.sina.weibo.GroupAtSuggestionActivity", "com.sina.weibo.MyJoinGroupsManageActivity", "com.sina.weibo.MyJoinGroupListActivity", "com.sina.weibo.hc.DeviceListActivity", "com.sina.weibo.hc.DeviceDetailActivity", "com.sina.weibo.hc.HealthDataActivity", "com.sina.weibo.hc.HealthDevelopingActivity", "com.sina.weibo.hc.HealthUserPreviewActivity", "com.sina.weibo.hc.HealthUserSettingActivity", "com.sina.weibo.hc.tracking.TrackingActivity", "com.sina.weibo.hc.tracking.MyTrackListActivity"}; private TextView view, viewResult ; private Spinner spinner; private ArrayAdapter<String> adapter; private Button bt; private String uactivity = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); view = (TextView) findViewById(R.id.textView1); spinner = (Spinner) findViewById(R.id.Spinner01); bt = (Button)findViewById(R.id.request); bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if(uactivity != null) { // String stringUrl = "http://127.0.0.1:9527/si?cmp=com.sina.weibo_" + uactivity; // String stringUrl = "http://127.0.0.1:9527/login?callback=xxx"; String stringUrl = "http://127.0.0.1:9527/query?appid=com.sina.weibo"; ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected()) { new DownloadWebpageTask().execute(stringUrl); } else { viewResult.setText("No network connection available."); } } } }); viewResult = (TextView)findViewById(R.id.result); adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,m); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(new SpinnerSelectedListener()); spinner.setVisibility(View.VISIBLE); } class SpinnerSelectedListener implements OnItemSelectedListener{ public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { view.setText("选择未导出Activity:\n"+m[arg2]); uactivity = m[arg2]; } public void onNothingSelected(AdapterView<?> arg0) { } } public class DownloadWebpageTask extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... urls) { // TODO Auto-generated method stub // params comes from the execute() call: params[0] is the url. try { return downloadUrl(urls[0]); } catch (IOException e) { return "Unable to retrieve web page. URL may be invalid."; } } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub viewResult.setText(result); } // Given a URL, establishes an HttpUrlConnection and retrieves // the web page content as a InputStream, which it returns as // a string. private String downloadUrl(String myurl) throws IOException { // Only display the first 500 characters of the retrieved // web page content. InputStream in = null; int len = 500; try { URL url = new URL(myurl); Log.d("heen","url is "+myurl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("referer", "http://www.sina.com"); conn.setDoInput(true); // Starts the query conn.connect(); String response = conn.getResponseMessage(); Log.d("heen", "The response is: " + response); in = conn.getInputStream(); String content = readIt(in, len); return content; // Makes sure that the InputStream is closed after the app is // finished using it. } catch(IOException ex) { ex.printStackTrace(); return null; } finally { if (in != null) { in.close(); } } } // Reads an InputStream and converts it to a String. public String readIt(InputStream stream, int len) throws IOException, UnsupportedEncodingException { Reader reader = null; reader = new InputStreamReader(stream, "UTF-8"); char[] buffer = new char[len]; reader.read(buffer); return new String(buffer); } } }