Activity Intent 'source not found'

aquarium1974

Aktives Mitglied
Hallo Java-Freunde,

schönen ersten Mai wünsch ich.
Ich hab hier ein Problem mit Android und komm nicht weiter. Alles googlen hat nix gebracht.

Folgendes:
Ich versuche aus einer Activity eine neue Activity zu starten. Dabei bekomme ich den Fehler "source not found". Quelle irgendwie nicht gefunden, klar. Aber ich komm nich drauf.

Hier ein Auszug aus der aufrufenden Klasse Test1Activity:
Java:
if (v == buttonJetztDatum) {
			setzeDatum();
		} else if (v == buttonJetztUhrzeit) {
			setzeUhrzeit();
		} else if (v == buttonBeweisfoto) {
//			macheFoto();
			Intent intent = new Intent(this, Foto.class);
//			Intent intent = new Intent(Intent.ACTION_DIAL);
			startActivity(intent);
		} else if (v == buttonSenden) {
			sendeMitteilung();
		} else if (v == jpgView) {
//			zeigeFoto();
//			zeigeFoto();

		}

Ich will einen Intent starten, der aus der Klasse Foto. class heraus starten soll. Dann bekomme ich den oben genannten Fehler.

Die Foto.class sieht so aus:
Java:
package com.android.test1;

import java.io.File;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Button;
import android.widget.Toast;

public class Foto extends Activity{
//	private Test1Activity hauptklasse;
//	public Foto(Test1Activity hauptklasse) {
//		this.hauptklasse = hauptklasse;
//	
//	
//	
//	}
	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.meldender);
		Intent intent = new Intent(Intent.ACTION_DIAL);
		startActivity(intent);
	}
	
		

	public void zeigeFoto() {
		try {
			File videoFile2Play = new File("/sdcard/park/foto/foto.jpg");
			Intent i = new Intent();
			i.setAction(android.content.Intent.ACTION_VIEW);
			i.setDataAndType(Uri.fromFile(videoFile2Play), "image/jpg");
			startActivity(i);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
//			toast("Kein Bild vorhanden!");
		}

	}

	//	public void macheFoto() {
		strJetztUhrzeit = strJetztUhrzeit.replaceAll("\\D", ""); // \D:
		// ersetze
		// alle
		// Nicht-Zahlen
		// durch
		// ""
		// :
		// in
		// Zeitangabe
		// läßt
		// sich
		// nicht
		// in
		// Dateinamen
		// übernehmen
		// [url=http://docs.oracle.com/javase/1.4.2/docs/api/java/util/regex/Pattern.html#sum]Pattern (Java 2 Platform SE v1.4.2)[/url]

		// strKennzeichen = edittextKennzeichen.getText().toString();
		// strKennzeichen = strKennzeichen.toUpperCase();

		loescheFoto(fileFotoGespiegelt);
		loescheFoto(fileFoto);
		Uri outputFileUri = Uri.fromFile(fileFotoGespiegelt);
		Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
		intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
		startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
		this.setResult(CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE, intent);
		strFilename = "foto";

	void loescheFoto(File file) {

	}

	void spiegelnBild() {

	}

}

Und hier noch der Auszug aus der manfest.xml:
Java:
<activity android:name="com.android.test1.Foto">
			<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
			<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
			<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
			<uses-permission android:name="android.permission.READ_PHONE_STATE" />
		</activity>

Ich habe der Activity Foto.class mehr Rechte gegeben als sie eigentlich braucht (denke ich) um auszuschließen das es daran liegt.
Wenn ich den Intent Foto.class gegen Intent.ACTION_DIAL tausche wird die Telefontastatur aufgerufen. Starte ich über den ersten Intent die Foto.class-Activity gehts in die Hose.... Bei Foto.class gibt es den Fehler 'source not found'.

Hab schon zu Build-Path etc. gesucht aber das scheint mir nicht das richtige zu sein....


Soweit zu Problem.

Eigentlich will ich aus der aufrufenden Klasse Test1Activity die Kamera aktivieren....
Alles in einer Quatsch-Klasse zusammen gibt keine Probleme, wenn ich es aufteilen will klemmts...... :( :bahnhof:


Kann mir jemand einen Tipp geben?

AQ1974



P.S.: Schönen ersten Mai noch.......
 
Zuletzt bearbeitet von einem Moderator:

Robokopp

Bekanntes Mitglied
Ist die TestActivity im Manifest angemeldet?
Beim Intentaufruf dürfte soweit alles stimmen. Genau so hab ich es auch verwendet und bei meiner App klappt es ohne Probleme.

Wahrscheinlich läuft in der onCreate() Methode deiner Testklasse was schief, aber die hast du ja nicht gepostet, also kann man nur vermuten.

Vlt solltest du auch mal die komplette LogCat Meldung des Fehlers posten.
 

aquarium1974

Aktives Mitglied
Wobei wir beim nächsten Problem wären:

Wie logge ich denn die LogCat?
Irgendwie habe ich das nicht geraftt, Log.e, Log.c(x,y) y ist auch noch Boolean..., hä?

Kannst du mir einge gute Seite dazu sagen?

Danke!!!!!
AQ1974
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
W JSONARRAY per Intent an andere Activity übergeben und umwandeln ggbf. Android & Cross-Platform Mobile Apps 1
M Activity einer anderen App mit result Android & Cross-Platform Mobile Apps 2
CT9288 Methode von Fragment durch Activity rufen scheitert Android & Cross-Platform Mobile Apps 7
ruutaiokwu Android Daten von "Activity A" nach "Activity B" umleiten? Android & Cross-Platform Mobile Apps 13
L Android Lockscreen-Sperrmuster activity verwenden Android & Cross-Platform Mobile Apps 1
J Android App stürzt ab wenn neue activity gestartet Android & Cross-Platform Mobile Apps 6
D Android Activity wechseln per Button Android & Cross-Platform Mobile Apps 3
P Android Android-App Crash - Unable to start activity ComponentInfo Android & Cross-Platform Mobile Apps 2
S Neue Activity lässt sich nicht starten Android & Cross-Platform Mobile Apps 28
B Android Activity nach gedrückte Returntaste weiterlaufen lassen Android & Cross-Platform Mobile Apps 2
J Probleme mit ViewPager und Activity Android & Cross-Platform Mobile Apps 1
B Android In einem View der ersten Activity zweite anzeigen Android & Cross-Platform Mobile Apps 2
G Accelerometer ohne Activity Android & Cross-Platform Mobile Apps 8
J Android BroadcastHandler extends BroadcastReceiver; auf Activity zugreifen? Android & Cross-Platform Mobile Apps 5
K Android Übergeordnete Activity herausfinden? Android & Cross-Platform Mobile Apps 7
W Android Designfrage / Layout / Activity / Fragments Android & Cross-Platform Mobile Apps 2
B Login Activity Android & Cross-Platform Mobile Apps 1
M Android Suche Activity/View Namen Android & Cross-Platform Mobile Apps 1
K Unbekannte Menge von Daten (Strings oder Ints) an Activity übergeben Android & Cross-Platform Mobile Apps 0
M Fehler ohne Sinn? java.lang.RuntimeException: Unable to start activity ComponentInfo Android & Cross-Platform Mobile Apps 11
S Android Eclipse erstellt keine main Activity Android & Cross-Platform Mobile Apps 4
B java.lang.RuntimeException: Unable to start activity ComponentInfo Android & Cross-Platform Mobile Apps 2
K Android Activity for result aus Dialog Android & Cross-Platform Mobile Apps 1
S Android "Weiches wechseln" zwischen Views in einer Activity Android & Cross-Platform Mobile Apps 3
D Android Activity mit mehreren Views "spliten" Android & Cross-Platform Mobile Apps 10
G Activity-Wechsel bitte ohne Notification Android & Cross-Platform Mobile Apps 6
G eine Methode einer anderen Activity aufrufen Android & Cross-Platform Mobile Apps 9
D Android Neue Activity im TabWidget laden Android & Cross-Platform Mobile Apps 8
S Android In Service überprüfen ob eine Activity gebunden ist? Android & Cross-Platform Mobile Apps 6
T Android Activity finished testen Android & Cross-Platform Mobile Apps 5
T Activity / Application fundamentals Android & Cross-Platform Mobile Apps 4
M Activity wechseln aus List View mit Android & Cross-Platform Mobile Apps 2
G extends Activity für Berechnungen? Android & Cross-Platform Mobile Apps 7
G Daten von einer Activity zur nächsten übergeben Android & Cross-Platform Mobile Apps 6
G selbes Menü auf jeder Activity Android & Cross-Platform Mobile Apps 4
C Activity ohne Aktion starten Android & Cross-Platform Mobile Apps 8
C Android Kommunikation zwischen Service und Activity Android & Cross-Platform Mobile Apps 8
Maxim6394 [ Android ] Activity ändern Android & Cross-Platform Mobile Apps 9
A Android Activity Variablen-Initialisierung Android & Cross-Platform Mobile Apps 8
A Beenden einer 2ten Activity Android & Cross-Platform Mobile Apps 3
W Standard Gallery Activity? Android & Cross-Platform Mobile Apps 22
schlingel Android: Overlay in Activity Android & Cross-Platform Mobile Apps 3
G Activity beenden Android & Cross-Platform Mobile Apps 2
N Intent und finish() Problem Android & Cross-Platform Mobile Apps 5
ms_cikar Thread / Intent als externe klasse Android & Cross-Platform Mobile Apps 1
B Android Open Folder Intent? Android & Cross-Platform Mobile Apps 3
G Broadcast Intent action ausählen Android & Cross-Platform Mobile Apps 2
T HttpConnection error connect(Unknown Source) Android & Cross-Platform Mobile Apps 2

Ähnliche Java Themen

Neue Themen


Oben