Package Problem Bluetooth..

T

Timo5791

Neues Mitglied
0
Hallo bin neu hier und auch neu beim programmieren mit Android/Java/Processing. Hab ein Beispiel Programm gefunden das ich ausprobieren wollte. Es handelt sich um eine Bluetoothverbindung Handy zu einem Arduino Board. Die Libary heißt Ketai, das Beispiel ist von O. Heddergott

Ich bekomme die Fehlermeldung :

Only a type can be imported. android.os.Bundle resolves to a package
Only a type can be imported. android.content.Intent resolves to a package

Ich benutze Windows XP, Processing 2.0.1, Android SDK API 10, JAVA SDK 32Bit 7.

AndroidManifest.xml:
Code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="">
<uses-sdk android:minSdkVersion="10"/>
<application android:debuggable="true" android:icon="@drawable/icon" android:label="">
<activity android:name="">
<intent-filter><action android:name="android.intent.action.MAIN"/><category android:name="android.intent.category.LAUNCHER"/></intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.BLUETOOTH"/><uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.INTERNET"/></manifest>


ketai.pde :

Code:
 import android.content.Intent;
import android.os.Bundle;
import ketai.net.bluetooth.*;
import ketai.ui.*;
import ketai.net.*;


PFont fontMy;

boolean bReleased = true; //no permament sending when finger is tap
boolean isConfiguring = true;
String info = "";

KetaiBluetooth bt;

KetaiList klist;

ArrayList<String> devicesDiscovered = new ArrayList();

//********************************************************************

// The following code is required to enable bluetooth at startup.

//********************************************************************

void onCreate(Bundle savedInstanceState)
{
     super.onCreate(savedInstanceState);
     bt = new KetaiBluetooth(this);
}


void onActivityResult(int requestCode, int resultCode, Intent data) 
{
    bt.onActivityResult(requestCode, resultCode, data);
}


void setup()

{ 
  size(displayWidth, displayHeight);
  frameRate(10);
  orientation(PORTRAIT);
  background(0);

//start listening for BT connections
  bt.start();

//at app start select device...
  isConfiguring = true;

//font size
  fontMy = createFont("SansSerif", 40);
  textFont(fontMy);
}


void draw()

{
//at app start select device
  if (isConfiguring)

    {
      ArrayList<String> names;
      background(78, 93, 75);
      klist = new KetaiList(this, bt.getPairedDeviceNames());
      isConfiguring = false;
    }
else
    {
      background(0,50,0);
        if((mousePressed) && (bReleased == true))
        {
//send with BT
          byte[] data = {'s','w','i','t','c','h','\r'};
          bt.broadcast(data);
//first tap off to send next message
          bReleased = false;
        }

      if(mousePressed == false)

        {
          bReleased = true; //finger is up
        }

//print received data

    fill(255);
    noStroke();
    textAlign(LEFT);
    text(info, 20, 104);
  }

}


void onKetaiListSelection(KetaiList klist)

{
  String selection = klist.getSelection();
  bt.connectToDeviceByName(selection);
//dispose of list for now
  klist = null;
}


//Call back method to manage data received

void onBluetoothDataEvent(String who, byte[] data)
{
    if (isConfiguring)
    return;
//received
    info += new String(data);
//clean if string to long
    if(info.length() > 150)
      info = "";

}
würde mich sehr freuen wenn mir jemand weiterhelfen könnte.
Timo
 
Fehlt hier nicht der Package-Name ganz oben ?

package com.example.dein_package
 

Ähnliche Themen

S
Antworten
4
Aufrufe
4.443
mblaster4711
mblaster4711
M
  • myoggradio
Antworten
4
Aufrufe
912
myoggradio
M
W
  • WuDiDong
Antworten
3
Aufrufe
767
jogimuc
J
Zurück
Oben Unten