当前位置: 编程技术>移动开发
本页文章导读:
▪make sdk 时的异常 make sdk 时的错误
编译sdk
$make sdk
前面一直都很正常,到生成doc的时候报错:
Docs droiddoc: out/target/common/docs/services
javadoc: error – In doclet class DroidDoc, method start has thrown an exception java.lang.reflect.........
▪ 4.9 动态平添/删除的Spinner菜单-ArrayLi与Widget的依赖性 4.9 动态添加/删除的Spinner菜单--ArrayLi与Widget的依赖性
package com.chaowen;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Ad.........
▪ Camer使用中去掉GPS按钮和前置摄像头切换按钮 Camer应用中去掉GPS按钮和前置摄像头切换按钮
找到ui目录下的CameraHeadUpDisplay类,然后注释掉下面的代码:private GpsIndicator mGpsIndicator;
mGpsIndicator = new GpsIndicator(
context, (IconListPref.........
[1]make sdk 时的异常
来源: 互联网 发布时间: 2014-02-18
make sdk 时的错误
编译sdk
$make sdk
前面一直都很正常,到生成doc的时候报错:
Docs droiddoc: out/target/common/docs/services
javadoc: error – In doclet class DroidDoc, method start has thrown an exception java.lang.reflect.InvocationTargetException
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for sun.util.resources.OpenListResourceBundle not found
1 error
make: *** [out/target/common/docs/services-timestamp] Error 45
解决办法:在/home/peipei/froyo/build/core/droiddoc.mk:line158加 -XDignore.symbol.file \
我本来在改动的地方加了注释# mayq,重新编译的时候居然出现语法错误,看来是我写错了,于是我把注释去了,就好了。
[2] 4.9 动态平添/删除的Spinner菜单-ArrayLi与Widget的依赖性
来源: 互联网 发布时间: 2014-02-18
4.9 动态添加/删除的Spinner菜单--ArrayLi与Widget的依赖性
package com.chaowen; import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; public class Ex04_09_add_Spinner extends Activity { /** Called when the activity is first created. */ private static final String[] countriesStr={"北京","上海","天津","重庆"}; private TextView myTextView; private EditText myEditText; private Button myButton_add; private Button myButton_remove; private Spinner mySpinner; private ArrayAdapter<String> adapter; private List<String> allCountries; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); allCountries=new ArrayList<String>(); for (int i = 0; i < countriesStr.length; i++) { allCountries.add(countriesStr[i]); } //new ArrayAdapter对象并将allCountries传入 adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,allCountries); adapter.setDropDownViewResource(android.R.layout.simple_spinner_item); //以findViewById()取得对象 myTextView=(TextView)findViewById(R.id.myTextView); myEditText=(EditText)findViewById(R.id.myEditText); myButton_add=(Button)findViewById(R.id.myButton_add); myButton_remove=(Button)findViewById(R.id.myButton_remove); mySpinner=(Spinner)findViewById(R.id.mySpinner); //将ArrayAdapter添加Spinner对象中 mySpinner.setAdapter(adapter); //将myButton_add添加OnClickListener myButton_add.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View v) { String newCountry=myEditText.getText().toString(); //先比较添加的值是否已存在,不存在才可添加 for (int i = 0; i < adapter.getCount(); i++) { if(newCountry.equals(adapter.getItem(i))){ return; } } if(!newCountry.equals("")){ //将值添加至adapter adapter.add(newCountry); //取得添加的值的位置 int position=adapter.getPosition(newCountry); mySpinner.setSelection(position); //将myEditText清空 myEditText.setText(""); } } }); //将myButton_remove添加OnClickListener myButton_remove.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View v) { if(mySpinner.getSelectedItem()!=null){ //删除mySpinner的值 adapter.remove(mySpinner.getSelectedItem().toString()); //将myEditText清空 myEditText.setText(""); if(adapter.getCount()==0){ //将myTextView清空 myTextView.setText(""); } } } }); //将mySpinner添加OnItemSelectedListener mySpinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener(){ @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { //将所选mySpinner的值带入myTextView中 myTextView.setText(arg0.getSelectedItem().toString()); } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); } }
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/white" > <TextView android:id="@+id/myTextView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/title" android:textColor="@drawable/black" > </TextView> <EditText android:id="@+id/myEditText" android:layout_width="fill_parent" android:layout_height="wrap_content" > </EditText> <Button android:id="@+id/myButton_add" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="新增" > </Button> <Button android:id="@+id/myButton_remove" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="移除" > </Button> <Spinner android:id="@+id/mySpinner" android:layout_width="fill_parent" android:layout_height="wrap_content" > </Spinner> </LinearLayout>
[3] Camer使用中去掉GPS按钮和前置摄像头切换按钮
来源: 互联网 发布时间: 2014-02-18
Camer应用中去掉GPS按钮和前置摄像头切换按钮
找到ui目录下的CameraHeadUpDisplay类,然后注释掉下面的代码:
这样Camer应用就无法提供GPS功能了,呵呵。
找到Camer,VideoCamer,CamerHolder三个类,均做如下修改:
这样Camer应用就默认后置摄像头,无法切换摄像头了。
找到ui目录下的CameraHeadUpDisplay类,然后注释掉下面的代码:
private GpsIndicator mGpsIndicator; mGpsIndicator = new GpsIndicator( context, (IconListPreference) group.findPreference(CameraSettings.KEY_RECORD_LOCATION)); mIndicatorBar.addComponent(mGpsIndicator); GLRootView root = getGLRootView(); if (root != null) { synchronized (root) { mGpsIndicator.setHasSignal(hasSignal); } } else { mGpsIndicator.setHasSignal(hasSignal); }
这样Camer应用就无法提供GPS功能了,呵呵。
找到Camer,VideoCamer,CamerHolder三个类,均做如下修改:
//mNumberOfCameras = CameraHolder.instance().getNumberOfCameras(); mNumberOfCameras = 1;
这样Camer应用就默认后置摄像头,无法切换摄像头了。
最新技术文章: