Search Results

Search found 7 results on 1 pages for 'anta40'.

Page 1/1 | 1 

  • Simple reminder for Android

    - by anta40
    I'm trying to make a simple timer. package com.anta40.reminder; import java.util.Timer; import java.util.TimerTask; import android.app.Activity; import android.os.Bundle; import android.widget.RadioGroup; import android.widget.TabHost; import android.widget.TextView; import android.widget.RadioGroup.OnCheckedChangeListener; import android.widget.TabHost.TabSpec; public class Reminder extends Activity{ public final int TIMER_DELAY = 1000; public final int TIMER_ONE_MINUTE = 60000; public final int TIMER_ONE_SECOND = 1000; Timer timer; TimerTask task; TextView tv; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); timer = new Timer(); task = new TimerTask() { @Override public void run() { tv = (TextView) findViewById(R.id.textview1); tv.setText("BOOM!!!!"); tv.setVisibility(TextView.VISIBLE); try { this.wait(TIMER_DELAY); } catch (InterruptedException e){ } tv.setVisibility(TextView.INVISIBLE); } }; TabHost tabs=(TabHost)findViewById(R.id.tabhost); tabs.setup(); TabSpec spec = tabs.newTabSpec("tag1"); spec.setContent(R.id.tab1); spec.setIndicator("Clock"); tabs.addTab(spec); spec=tabs.newTabSpec("tag2"); spec.setContent(R.id.tab2); spec.setIndicator("Settings"); tabs.addTab(spec); tabs.setCurrentTab(0); RadioGroup rgroup = (RadioGroup) findViewById(R.id.rgroup); rgroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.om){ timer.schedule(task, TIMER_DELAY, 3*TIMER_ONE_SECOND); } else if (checkedId == R.id.twm){ timer.schedule(task, TIMER_DELAY, 6*TIMER_ONE_SECOND); } else if (checkedId == R.id.thm){ timer.schedule(task, TIMER_DELAY, 9*TIMER_ONE_SECOND); } } }); } } Each time I click a radio button, the timer should start, right? But why it doesn't start?

    Read the article

  • JSON parsing problem in BlackBerry

    - by anta40
    I'm working on how to parse Twitter's JSON response using JSON-ME. For example: [code] http://apiwiki.twitter.com/Twitter-Search-API-Method:-search foo({"results":[{"profile_image_url":"http://a3.twimg.com/profile_images/762620209/drama_queen-6989_normal.gif","created_at":"Thu, 01 Apr 2010 02:35:10 +0000","from_user":"TWEETSDRAMA","to_user_id":null,"text":"NEW Twitter Lists Widget - How to put it on your blog or site http://bit.ly/47NCi6","id":11401539152,"from_user_id":95081097,"geo":null,"iso_language_code":"en","source":"<a href="http://ping.fm/" rel="nofollow">Ping.fm</a>"}... (content truncated)[/code] Here's my method:[code] public void parseDataFromJSON(String strjson) throws JSONException { JSONTokener jtoken = new JSONTokener(strjson); JSONArray jsoarray = new JSONArray(jtoken); JSONObject jsobj = jsoarray.getJSONObject(0); tweeter_profile_image_url = jsobj.optString("profile_image_url"); tweeter_created_at = jsobj.optString("created_at"); tweeter_from_user = jsobj.optString("from_user"); tweeter_to_user_id = jsobj.optString("to_user_id"); tweeter_text = jsobj.optString("text"); tweeter_id = jsobj.optInt("id"); tweeter_from_user_id = jsobj.optInt("from_user_id"); tweeter_geo = jsobj.optString("geo"); tweeter_iso_language_code = jsobj.optString("iso_language_code"); tweeter_source = jsobj.optString("source") }[/code] When I ran it on the emulator, nothing was shown, so I inspected the debugger, and the output was: status: 200 content: {"results":[{"profile_image_url":"http://a1.twimg.com/profile_images/746683548/Photo_on_2010-..... --- OK, I got the JSON content org.json.me.JSONException: A JSONArray text must start with '[' at character 1 of {"results":[{"profile_image_url.... --- but somehow unable to processed it properly. So how to parse this correctly?

    Read the article

  • Run a JGNAT program?

    - by anta40
    I just installed JGNAT on Windows (gnat-gpl-2010-jvm-bin.exe) This is a sample code hello.adb from the included manual: with Ada.Text_IO; use Ada.Text_IO; procedure Hello is begin Put_Line ("Hello GNAT for the JVM."); end Hello; First, compile it: jvm-gnatmake hello.adb jvm-gnatcompile -c hello.adb jvm-gnatbind -x hello.ali jvm-gnatlink hello.ali Looks fine. So let's run it: java hello Exception in thread "main" java.lang.NoClassDefFoundError: jgnat/adalib/GNAT_libc at hello.main(hello.adb) Caused by: java.lang.ClassNotFoundException: jgnat.adalib.GNAT_libc at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more Any idea why?

    Read the article

  • #indent "off" in F#

    - by anta40
    I just started learning F#, and tried a code from the wiki: I prefer tabs to spaces, so I change the code a bit into this: #indent "off" open System open System.Windows.Forms let form = new Form(Visible=true, TopMost=true, Text="Welcome to F#") let label = let temp = new Label() let x = 3 + (4 * 5) temp.Text <- sprintf "x = %d" x temp form.Controls.Add(label) [<STAThread>] Application.Run(form) The output is: Microsoft (R) F# 2.0 Compiler build 4.0.30319.1 Copyright (c) Microsoft Corporation. All Rights Reserved. fstest2.fs(1,1): warning FS0062: This construct is for ML compatibility. Conside r using a file with extension '.ml' or '.mli' instead. You can disable this warn ing by using '--mlcompatibility' or '--nowarn:62'. fstest2.fs(9,2): error FS0010: Unexpected keyword 'let' or 'use' in expression. Expected 'in' or other token. fstest2.fs(13,1): error FS0597: Successive arguments should be separated by spac es or tupled, and arguments involving function or method applications should be parenthesized fstest2.fs(9,14): error FS0374: Invalid expression on left of assignment fstest2.fs(16,1): error FS0010: Unexpected identifier in definition Guess the error is somewhere in the let label block, but couldn't figure it out.

    Read the article

  • How to run Clojure tests on Windows?

    - by anta40
    I put Clojure in C:\clojure-1.1.0, and start the REPL by: java -cp clojure.jar clojure.main In \test\clojure\test_clojure, there are a bunch of test files. How to run these? For example, I tried: java -cp ......\clojure.jar clojure.main data_structures.clj And it didn't work.

    Read the article

  • How to put reminder in Blackberry calendar

    - by anta40
    I need to put several reminders in the BB calendar. The idea is several hours, or days before a promo expires, the alarm will remind it for you. Here's my code so far: long ONE_HOUR = 3600; long ONE_DAY = 24 * 3600; try { EventList eventList = (EventList)PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE); BlackBerryEvent bbEvent = (BlackBerryEvent) eventList.createEvent(); FavoritePromo promo; if (eventList.isSupportedField(BlackBerryEvent.ALARM)){ for (int x = 0; x < promos.size(); x++){ promo = (FavoritePromo) promos.elementAt(x); time = (StringUtil.strToDate(promo.getExpireDate())).getTime() - value; bbEvent.addString(BlackBerryEvent.SUMMARY, BlackBerryEvent.ATTR_NONE, promo.getTitle()); bbEvent.addDate(BlackBerryEvent.ALARM,0,time); bbEvent.commit(); } } } catch (PIMException e){ } Every time i run it, an "IllegalArgumentException" is always thrown. I'm not really sure what goes wrong here...

    Read the article

1