+ Ответить в теме
Показано с 1 по 8 из 8
- 18.08.2010 01:30 #1
Programming in Android
Hello guys. I have a little problem with an application I'm developing. It used to work up to some point (no idea of what I added that it made it stop working) until it stared FC-ing. If anyone is willing to throw a short look over it and tell me where I'm mistaking, please do it. Also, I would like this thread to continue with apps developer's questions and answers. Thanks
Код:package com.android.clapperboard; import android.app.Activity; import android.os.Bundle; import android.graphics.Typeface; import android.widget.TextView; import android.widget.Button; import android.widget.ImageView; import android.graphics.Bitmap; import android.graphics.BitmapFactory; public class Clapperboard extends Activity { int state = 0; Button screws; ImageView bar = (ImageView) findViewById(R.id.bar); Bitmap bar_down = BitmapFactory.decodeResource(getResources(), R.drawable.bar_down); Bitmap bar_up = BitmapFactory.decodeResource(getResources(), R.drawable.bar_up); /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); screws = (Button) findViewById(R.id.screws); Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/LCD #.ttf"); TextView tv = (TextView) findViewById(R.id.lcd_font); tv.setTypeface(tf); } public void rotate() { switch (state) { case 0: bar.setImageBitmap(bar_down); state = 1; case 1: bar.setImageBitmap(bar_up); state = 0; } } }No brain farts
!
Devices:
Samsung Galaxy Lite Spica I5700 - CyanogenMod 7.1
Samsung Wave S8500 - Android FroYo 2.2.1 (from Samsung Galaxy S)/ Bada OS 1.2 (S8500XEKC1)
-
- 18.08.2010 02:59 #2
I think this is the problem. You are trying to get instance of object before it was created (setContentView(R.layout.main) ).ImageView bar = (ImageView) findViewById(R.id.bar);
- 18.08.2010 03:03 #3
The problem was from main.xml, where I had
and I thought to replace it with a listener in the java script and... it worked...Код:android:onClick="rotate"
I still don't understand why...No brain farts
!
Devices:
Samsung Galaxy Lite Spica I5700 - CyanogenMod 7.1
Samsung Wave S8500 - Android FroYo 2.2.1 (from Samsung Galaxy S)/ Bada OS 1.2 (S8500XEKC1)
-
- 19.08.2010 11:08 #4Junior Member
- Регистрация
- 17.08.2010
- Адрес
- United States
- Сообщений
- 5
Android is the market name for the Microsoft / Google collaboration. You use Google tools specifically for that niche. If you had in mind to make apps for handheld devices, then yeah, Java. If you want to learn Java, get the NetBeans IDE download with the JavaSE bundle. Add the JavaME plug-in. Java is a vast subject, start off with the Sun tutorials.
- 19.08.2010 11:46 #5Senior Member
- Регистрация
- 08.03.2010
- Сообщений
- 190
- 19.08.2010 12:56 #6
I am not a developer, I am just a geek wannabe. I just have a degree in programming from high school, in C++ (bulls***... what I learnt, I did it by myself), so there is absolutely no money or pride involved. I'm just trying to make an app which first of all I will use, then any of you might find it helpful (just saying). Again... what's Microsoft's part in here
)?
No brain farts
!
Devices:
Samsung Galaxy Lite Spica I5700 - CyanogenMod 7.1
Samsung Wave S8500 - Android FroYo 2.2.1 (from Samsung Galaxy S)/ Bada OS 1.2 (S8500XEKC1)
- 02.09.2010 09:58 #7
Guys, I can't help you with Spica, but you might find the app I developed useful (at least I can share it with you
). You can download it from here. If you find it useful or find bugs etc., please let me know
.
No brain farts
!
Devices:
Samsung Galaxy Lite Spica I5700 - CyanogenMod 7.1
Samsung Wave S8500 - Android FroYo 2.2.1 (from Samsung Galaxy S)/ Bada OS 1.2 (S8500XEKC1)
- 03.09.2010 01:53 #8Senior Member
- Регистрация
- 03.03.2010
- Адрес
- The Netherlands
- Сообщений
- 192
Информация о теме
Пользователи, просматривающие эту тему
Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)


LinkBack URL
About LinkBacks
Ответить с цитированием



Социальные закладки