android - How to set a different java file as launcher -
i new android , have created class in android project other default mainactivity class , want start project file. here added manifest file:
<activity android:name="com.example.surfaceview.surfaceviewexample" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.surfaceview" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity>
and class created:
public class surfaceviewexample extends activity implements ontouchlistener { ourview v; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); v=new ourview(this); setcontentview(v); v.setontouchlistener(this); } @override protected void onpause() { // todo auto-generated method stub super.onpause(); v.pause(); } @override protected void onresume() { // todo auto-generated method stub super.onresume(); v.resume(); } public class ourview extends surfaceview implements runnable{ thread t = null; surfaceholder holder; boolean isitok=false; public ourview(context context) { super(context); holder=getholder(); } @override public void run() { while(isitok){ if(holder.getsurface().isvalid()){ continue; } canvas c = holder.lockcanvas(); c.drawargb(255, 155, 155, 10);//canvas backgroundu boyama holder.unlockcanvasandpost(c); } } public void pause(){ //pause thread isitok=false; while(true){ try{ t.join(); }catch(interruptedexception e){ e.printstacktrace(); } break; } t=null; } public void resume(){ //resume thread isitok=true; t=new thread(this); //this parameter means use run method //which inside class t.start(); } } @override public boolean ontouch(view v, motionevent me) { return false; } }
but application not start. think problem might in line inside intent filter:
<action android:name="android.intent.action.surfaceview" />
can me this?
thanks
update manifest following code activity. should launch activity.
<activity android:name="com.example.surfaceview.surfaceviewexample" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity>
i hope helps.
Comments
Post a Comment