当前位置:  编程技术>移动开发
本页文章导读:
    ▪could not change executable permissions on the application        could not change executable permissions on the application. I could solve it erasing an application that I had previously uploaded using the same Bundle Identifier (xcode get's confused doing the chmod).  Try checking the log from xCode Organizer (Yo.........
    ▪ 打开activity,封锁后返回会结果        打开activity,关闭后返回会结果原理图: 1)main.xml 就是把上面的左边的那个布局画出来 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:la.........
    ▪ 起动模式详解       启动模式详解配置: 在AndroidManifest.xml中找到<activity/>并在里面配上android:launchMode="启动模式"  如: <activity android:name="com.njupt.luanchmode.Main2Activity" android:label="B界面"android:launchMode="singleIn.........

[1]could not change executable permissions on the application
    来源: 互联网  发布时间: 2014-02-18
could not change executable permissions on the application.

I could solve it erasing an application that I had previously uploaded using the same Bundle Identifier (xcode get's confused doing the chmod). 

Try checking the log from xCode Organizer (Your device's Name -> Console) you should get information from that log.

because i already have the same app using the same bundle identifier installed on the phone. 

- what you need to do is to delete all those apps on your iphone which is using the same bundle identifier name


    
[2] 打开activity,封锁后返回会结果
    来源: 互联网  发布时间: 2014-02-18
打开activity,关闭后返回会结果

原理图:



1)main.xml

就是把上面的左边的那个布局画出来

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    
    <TextView 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="用户名"
        />

    <EditText 
        android:id="@+id/et_username"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        />
    
    <Button 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="get"
        android:text="获取"
        />
</LinearLayout>


2)main2.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    

    <ListView 
        android:id="@+id/listview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        />
</LinearLayout>


3)MainActivity

package com.njupt.openactivityforresult;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;

public class MainActivity extends Activity {

	private EditText et_username;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		
		et_username = (EditText) findViewById(R.id.et_username);
	}
	
	public void get(View v){
		
		Intent intent = new Intent(this,Main2Activity.class);
		
		startActivityForResult(intent,100);
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
	    
		if(requestCode == 100){
			if(data != null){
				String username = data.getStringExtra("username");
				et_username.setText(username);
			}
		}
	}
	
	@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;
	}

}

4)Main2Activity

package com.njupt.openactivityforresult;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class Main2Activity extends Activity {

	private ListView listview;
	private MyBaseAdapter adapter;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main2);
		
		listview = (ListView) findViewById(R.id.listview);
		
		adapter = new MyBaseAdapter();
		listview.setAdapter(adapter);
		listview.setOnItemClickListener(new MyOnItemClickListener());
	}
	
	private class MyOnItemClickListener implements OnItemClickListener{
		
		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position,
				long id) {
			
			//在listview中获取某一item的方法1:
//			Intent intent = new Intent();
//			String username = (String) adapter.getItem(position);
//			intent.putExtra("username", username);
//			setResult(200,intent);
//			finish();
			
			//在listview中获取某一item的方法2:
			String username = (String) parent.getItemAtPosition(position);
			Intent intent = new Intent();
			intent.putExtra("username",username);
			setResult(200, intent);
			finish();
		}
	}
	private class MyBaseAdapter extends BaseAdapter{
		String[] names = new String[]{"章泽天","章泽天1","章泽天2","章泽天3","章泽天4"};
		
		public int getCount() {
			return names.length;
		}
		
		@Override
		public Object getItem(int position) {
			return names[position];
		}
		
		@Override
		public long getItemId(int position) {
			return position;
		}
		
		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			
			TextView tv = new TextView(getApplicationContext());
			tv.setText(names[position]);
			tv.setTextSize(25);
			tv.setTextColor(Color.GREEN);
			return tv;
		}
	}
}


5)AndroidManifest.xml

还是那一句话,最后别忘了在清单文件中吧Main2Activity注册上

<activity android:name="com.njupt.openactivityforresult.Main2Activity" android:label="选择联系人"/>



    
[3] 起动模式详解
    来源: 互联网  发布时间: 2014-02-18
启动模式详解

配置:

在AndroidManifest.xml中找到<activity/>并在里面配上android:launchMode="启动模式" 

如:

<activity android:name="com.njupt.luanchmode.Main2Activity" android:label="B界面"android:launchMode="singleInstance" />


常见类型(个人理解):

 1)standard:不改变操作序列 .什么叫操作序列,例如你先进入A,在进入B,接着又进入A,最后又进入B。

那么你的操作序列就是A ----- >> B ------ >> A -------->>B。所以退出时的顺序就是反过来以后的结果

B------->>A------->>B------->>A

 2)singleTop:合并相邻的重复项

 3)singleTask:合并重复项

 4)singleInstance:始终只保留最新的那一个 


原理图:

  1)standard:


2)singleTop


3)singleTask


4)singleInsatnce




实现如下:

1、main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    
    <TextView 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="A界面"
        />
    
    <Button 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="打开A界面"
        android:onClick="open1"
        />
    
    <Button 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="打开B界面"
        android:onClick="open2"
        />
</LinearLayout>

2、MainActivity

package com.njupt.luanchmode;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;

public class MainActivity extends Activity {

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

	public void open1(View v){
		Intent intent = new Intent(this,MainActivity.class);
		
		startActivity(intent);
	}
	
	public void open2(View v){
		Intent intent = new Intent(this,Main2Activity.class);
		
		startActivity(intent);
	}
	
	@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;
	}

}

3、main2.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    
    <TextView 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="B界面"
        />
    
    <Button 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="打开A界面"
        android:onClick="open1"
        />
    
    <Button 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="打开B界面"
        android:onClick="open2"
        />
</LinearLayout>

4、Main2Activity

package com.njupt.luanchmode;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class Main2Activity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	    
		setContentView(R.layout.main2);
	}
	
	public void open1(View v){
		Intent intent = new Intent(this,MainActivity.class);
		
		startActivity(intent);
	}
	
	public void open2(View v){
		Intent intent = new Intent(this,Main2Activity.class);
		
		startActivity(intent);
	}
	
}



    
最新技术文章:
▪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