+ Ответить в теме
Показано с 1 по 8 из 8
  1. #1
    Senior Member bboylalu is on a distinguished road
    Регистрация
    05.06.2010
    Адрес
    Iasi, Romania
    Сообщений
    315

    Question 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)

  2. #2
    Member mik_os is on a distinguished road
    Регистрация
    05.03.2010
    Адрес
    Ukraine
    Сообщений
    66

    По умолчанию

    ImageView bar = (ImageView) findViewById(R.id.bar);
    I think this is the problem. You are trying to get instance of object before it was created (setContentView(R.layout.main) ).

  3. #3
    Senior Member bboylalu is on a distinguished road
    Регистрация
    05.06.2010
    Адрес
    Iasi, Romania
    Сообщений
    315

    По умолчанию

    The problem was from main.xml, where I had
    Код:
    android:onClick="rotate"
    and I thought to replace it with a listener in the java script and... it worked...
    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)

  4. #4
    Junior Member Dexter Fox is on a distinguished road
    Регистрация
    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.

  5. #5
    Senior Member mortiis is on a distinguished road
    Регистрация
    08.03.2010
    Сообщений
    190

    По умолчанию

    Цитата Сообщение от Dexter Fox Посмотреть сообщение
    Android is the market name for the Microsoft / Google collaboration.
    What collaboration are you referring to?

  6. #6
    Senior Member bboylalu is on a distinguished road
    Регистрация
    05.06.2010
    Адрес
    Iasi, Romania
    Сообщений
    315

    По умолчанию

    Цитата Сообщение от Dexter Fox Посмотреть сообщение
    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.
    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)

  7. #7
    Senior Member bboylalu is on a distinguished road
    Регистрация
    05.06.2010
    Адрес
    Iasi, Romania
    Сообщений
    315

    По умолчанию

    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)

  8. #8
    Senior Member Double is on a distinguished road
    Регистрация
    03.03.2010
    Адрес
    The Netherlands
    Сообщений
    192

    По умолчанию

    Why does it only work on MDPI screens? if you just use dip unit's, it should scale pretty well.


 

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)

     

Метки этой темы

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

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

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения