当前位置:  编程技术>移动开发
本页文章导读:
    ▪从本程序跳转到设立的无线和网络        从本程序跳转到设置的无线和网络                   Intent intent = new Intent();                 intent.setAction(Settings.ACTION_WIRELESS_SETTINGS);                 this.startActivity(intent); ......
    ▪ 在Tab View中平添MapView        在Tab View中添加MapView   Application outline Draw two empty tabs Show map on the first tab   1. Setup – obtain maps api key Follow Maps Add-On documentation, eventually you should obtain a key for your application. Your key is: 0pFtdSwta.........
    ▪ 手机拍照或选择相册,类似新浪微博的图片处理       手机照相或选择相册,类似新浪微博的图片处理 拍照的 btn1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File out .........

[1]从本程序跳转到设立的无线和网络
    来源: 互联网  发布时间: 2014-02-18
从本程序跳转到设置的无线和网络

 

                Intent intent = new Intent();

                intent.setAction(Settings.ACTION_WIRELESS_SETTINGS);

                this.startActivity(intent);


    
[2] 在Tab View中平添MapView
    来源: 互联网  发布时间: 2014-02-18
在Tab View中添加MapView

 

Application outline
  • Draw two empty tabs
  • Show map on the first tab


  •  

    1. Setup – obtain maps api key

    Follow Maps Add-On documentation, eventually you should obtain a key for your application.

    Your key is: 0pFtdSwta8EMTfArj32ycOw2kZg0LSEqa4fUGFA

    This key is good for all apps signed with your certificate whose fingerprint is:

    09:27:FE:8B:32:A5:AB:49:2A:30:97:0A:67:7A:EE:E2

    Here is an example xml layout to get you started on your way to mapping glory:

     

    <com.google.android.maps.MapView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="0pFtdSwta8EMTfArj32ycOw2kZg0LSEqa4fUGFA"/>
    

     

    Check out the API documentation for more information.

    2. Layout


    <?xml version="1.0" encoding="utf-8"?>
    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
       android:id="@android:id/tabhost"
       android:layout_width="fill_parent" android:layout_height="fill_parent">
       <LinearLayout android:orientation="vertical"
         android:layout_width="fill_parent" android:layout_height="fill_parent">
          <TabWidget android:id="@android:id/tabs"
             android:layout_width="fill_parent" android:layout_height="wrap_content"/>
          <FrameLayout android:id="@android:id/tabcontent"
             android:layout_width="fill_parent" android:layout_height="fill_parent">
              <RelativeLayout android:id="@+id/emptylayout1" android:orientation="vertical"
                 android:layout_width="fill_parent" android:layout_height="fill_parent"/>
              <TextView android:id="@+id/textview2"
                 android:layout_width="fill_parent"
                   android:layout_height="fill_parent"
                 android:text="Details Details Details Details"/>
          </FrameLayout>
       </LinearLayout>
    </TabHost>

     

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/maptablayout" android:orientation="vertical"
        android:layout_width="fill_parent" android:layout_height="fill_parent">
        <com.google.android.maps.MapView android:id="@+id/mapview"
           android:layout_width="fill_parent" android:layout_height="fill_parent"
           android:clickable="true"
            android:apiKey="0pFtdSwta8EMTfArj32ycOw2kZg0LSEqa4fUGFA"/>
    </RelativeLayout>

     

    Application code
    This would be application entry point after we'll enhance this code with more details
    package com.kroz.tag;
    
    import android.app.TabActivity;
    import android.content.Context;
    import android.content.Intent;
    import android.os.Bundle;
    import android.widget.FrameLayout;
    import android.widget.TabHost;
    import android.widget.TabHost.TabSpec;
    
    public class AppMain extends TabActivity  {
     TabHost mTabHost;
     FrameLayout mFrameLayout;
    
     /** Called when the activity is first created.*/
     @Override
     public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mTabHost = getTabHost();
        TabSpec tabSpec = mTabHost.newTabSpec("tab_test1");
        tabSpec.setIndicator("Map");
        Context ctx = this.getApplicationContext();
        Intent i = new Intent(ctx, MapTabView.class);
        tabSpec.setContent(i);
        mTabHost.addTab(tabSpec);
        mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Details").setContent(R.id.textview2));
        mTabHost.setCurrentTab(0);
     }
    }
     
    package com.kroz.tag;
    
    import android.os.Bundle;
    import com.google.android.maps.MapActivity;
    
    public class MapTabView extends MapActivity {
     @Override
     protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.maptabview);
     }
     @Override
     protected boolean isRouteDisplayed() {
       return false;
     }
    }
    
     
    Manifest (AndroidManifest.xml)

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="com.kroz.tag" android:versionCode="1" android:versionName="1.0">
     <application android:icon="@drawable/icon" android:label="@string/app_name">
        <uses-library android:name="com.google.android.maps"/>
        <activity android:name=".AppMain" android:label="@string/app_name">
           <intent-filter>
               <action android:name="android.intent.action.MAIN"/>
               <category android:name="android.intent.category.LAUNCHER"/>
           </intent-filter>
        </activity>
        <activity android:name="MapTabView" android:label="@string/mapview_name">
           <intent-filter>
              <category android:name="android.intent.category.EMBED"></category>
              <action android:name="android.intent.action.MAIN"></action>
           </intent-filter>
        </activity>
      </application>
     <uses-sdk android:minSdkVersion="3"/>
     <uses-permission android:name="android.permission.INTERNET"></uses-permission>
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
     <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></uses-permission>
    </manifest>
    

     

    Get example sources: http://www.kroztech.com/res/android_cookbook/src/MapTabViewDemo.zip

     

    转自:http://vkroz.wordpress.com/2009/07/03/programming-android-%E2%80%93-map-view-within-tab-view/

     


        
    [3] 手机拍照或选择相册,类似新浪微博的图片处理
        来源: 互联网  发布时间: 2014-02-18
    手机照相或选择相册,类似新浪微博的图片处理

    拍照的

    		btn1.setOnClickListener(new OnClickListener() {
    
    			@Override
    			public void onClick(View v) {
    
    				Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    
    				File out = new File(Environment.getExternalStorageDirectory(),
    						"camera.png");
    				Uri uri = Uri.fromFile(out);
    				intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    				xxActivity.startActivityForResult(intent, 3);
    							}
    		});

     

    相册

    	btn2.setOnClickListener(new OnClickListener() {
    
    			@Override
    			public void onClick(View v) {
    				Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    				intent.addCategory(Intent.CATEGORY_OPENABLE);
    				intent.setType("image/*");
    				intent.putExtra("crop", "true");
    				intent.putExtra("aspectX", 1);
    				intent.putExtra("aspectY", 1);
    				intent.putExtra("outputX", 80);
    				intent.putExtra("outputY", 80);
    				intent.putExtra("return-data", true);
    
    				xxActivity.startActivityForResult(intent, 2);
    							}
    		});

     

    处理的activity

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    		if (resultCode != RESULT_OK) {
    			return;
    		} else {
    
    			switch (requestCode) {
    			case 2:
    				Bitmap cameraBitmap = (Bitmap) data.getExtras().get("data");
    				Home.personalinfo.headbmp = cameraBitmap;
    				try {
    					String str = saveMyBitmap(cameraBitmap);
    				
    
    				} catch (IOException e) {
    					e.printStackTrace();
    				}
    
    				break;
    
    			/* 拍照后保存图片,并跳到裁剪功能 */
    			case 3:
    
    				new saveAsy().execute("");
    				break;
    			}
    
    		}
    		super.onActivityResult(requestCode, resultCode, data);
    	}

     saveAsy的方法

    	class saveAsy extends AsyncTask<String, Object, String> {
    
    
    
    
    
    		@Override
    		protected String doInBackground(String... str) {
    			dispathBitmap();
    			Intent intent = new Intent("com.android.camera.action.CROP");
    			try {
    				intent.setData(Uri
    						.parse(android.provider.MediaStore.Images.Media
    								.insertImage(getContentResolver(),
    										storageUrl+"/camera.png", null, null)));
    			} catch (FileNotFoundException e) {
    				e.printStackTrace();
    			}
    			intent.putExtra("crop", "true");
    			intent.putExtra("aspectX", 1);
    			intent.putExtra("aspectY", 1);
    			intent.putExtra("outputX", 80);
    			intent.putExtra("outputY", 80);
    			intent.putExtra("return-data", true);
    			startActivityForResult(intent, 2);
    
    			return "";
    		}
    
    		@Override
    		protected void onPostExecute(String bmp) {
    			super.onPostExecute(bmp);
    
    		}
    
    	}

     

    1 楼 yinhe625 2011-12-19  
    楼主代码好像不全阿,可否分享下demo?414602238@qq.com 感谢!

        
    最新技术文章:
    ▪Android开发之登录验证实例教程
    ▪Android开发之注册登录方法示例
    ▪Android获取手机SIM卡运营商信息的方法
    ▪Android实现将已发送的短信写入短信数据库的...
    ▪Android发送短信功能代码
    ▪Android根据电话号码获得联系人头像实例代码
    ▪Android中GPS定位的用法实例
    ▪Android实现退出时关闭所有Activity的方法
    ▪Android实现文件的分割和组装
    ▪Android录音应用实例教程
    ▪Android双击返回键退出程序的实现方法
    ▪Android实现侦听电池状态显示、电量及充电动...
    ▪Android获取当前已连接的wifi信号强度的方法
    ▪Android实现动态显示或隐藏密码输入框的内容
    ▪根据USER-AGENT判断手机类型并跳转到相应的app...
    ▪Android Touch事件分发过程详解
    ▪Android中实现为TextView添加多个可点击的文本
    ▪Android程序设计之AIDL实例详解
    ▪Android显式启动与隐式启动Activity的区别介绍
    ▪Android按钮单击事件的四种常用写法总结
    ▪Android消息处理机制Looper和Handler详解
    ▪Android实现Back功能代码片段总结
    ▪Android实用的代码片段 常用代码总结
    ▪Android实现弹出键盘的方法
    ▪Android中通过view方式获取当前Activity的屏幕截...
    ▪Android提高之自定义Menu(TabMenu)实现方法
    ▪Android提高之多方向抽屉实现方法
    ▪Android提高之MediaPlayer播放网络音频的实现方法...
    ▪Android提高之MediaPlayer播放网络视频的实现方法...
    ▪Android提高之手游转电视游戏的模拟操控
     


    站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3