[error]View requires API level 3 (current min is 1):

A HorizontalScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects. A child that is often used is a LinearLayout in a horizontal orientation, presenting a horizontal array of top-level items that the user can scroll through.

The TextView class also takes care of its own scrolling, so does not require a HorizontalScrollView, but using the two together is possible to achieve the effect of a text view within a larger container.

HorizontalScrollView only supports horizontal scrolling. For vertical scrolling, use either ScrollView or ListView.

solution:

Right click on the project folder > Android tools > Clear Link Markers

“Run Android Lint” makes some markers and the markers cause this error.

Android adb “Unable to open sync connection!”

solution: disable and reenable:

Settings > Applications > Development > USB debugging

R.sytleable

<?xml version=”1.0″ encoding=”utf-8″?>
<resources>
<declare-styleable name=”MyView”>
<attr name=”textColor” format=”color” />
<attr name=”textSize” format=”dimension” />
</declare-styleable>
</resources>

float textSize = a.getDimension(R.styleable.MyView_textSize, 36 );

MyView 就是定义在<declare-styleable name=”MyView “></declare-styleable> 里的 名字,获取里面属性用 名字_ 属性 连接起来就可以.

annotation jar用处

Android 在xml布局配置文件中给Button按钮添加事件

<Button
android:text=”Button01″
android:id=”@+id/Button01″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:onClick=”myClickH1″
/>

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);      }

    public void myClickHandler01(View v){
setTitle(“myClick1”);
}

 

[error]Re-installation failed due to different application signatures

It happens because keystores on your laptop and original pc are different. it’s called debug.keystrore and located in %USER_HOME%/.android/ folder. TO be more specific it happens because eclipse tries to push apk with reinstall key. So you have two options:

  1. Share debug.keystore between various development pc’s
  2. Manually uninstall your apk from device ( using adb )

The simplest way is to Uninstall the application from your mobile if you load it already.

case expression must be constant expression [error]

In a regular Android project, constants in the resource R class are declared like this:

public static final int main=0x7f030004;

However, as of ADT 14, in a library project, they will be declared like this:

public static int main=0x7f030004;

In other words, the constants are not final in a library project. Therefore your code would no longer compile.

The solution for this is simple: Convert the switch statement into an if-else statement:

Eclipse can automatically convert from a switch statement to an if-else statement. Just place the caret on the switch keyword and invoke Quick Fix (Ctrl-1 on Windows and Linux, Cmd-1 on Mac), then select “Convert ‘switch’ to ‘if-else’.

Android VM Won’t let us allocate xx bytes

Memory issues

Have you tried the android:largeHeap="true" in the Manifest.xml?

【error】Android java.lang.runtimeexception unable to start activity componentinfo

java.lang.runtimeexception unable to start activity componentinfo xx:java.lang.NullPointerException

Some stupid mistakes:

declare onclicklistenser of one button, but without define it in onclick().

【error】Android: Error inflating class

android.view.InflateException: Binary XML file line #46: Error inflating class

  • out of memory exception, maybe because of the background of the view.
  • LayoutInflater tries to load classes defined in android.widget by default, by parsing XML files. 
  •  inner classes
    • the reason is that $ is an illegal character in XML tags.
      <view class="com.grafightscratch.ochemmer.MoleculeTablet$MoleculeTabletView" />
    • inner class needs to be declared as static
      public static class  myWebView extends WebView

Reason: Use the wrong viewclass:

<com.example.ct.CanvasView
android:id=”@+id/canvasView”
android:layout_width=”match_parent”
android:layout_height=”wrap_content” />

 

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

John's Weblog

Just another WordPress.com weblog

I Am That I Am

Chasing tomorrow's sunrise.