2014-09-12 113 views
1

我正在研究一個應用程序,當您在主頁按鈕上向上滑動時,應用程序將打開。我還有其他所有事情都是通過下注代碼來完成在主頁按鈕部分上的刷卡操作。我該怎麼做呢? 任何幫助將是驚人的。如何在首頁按鈕上滑動打開滑動抽屜

這裏是我的Java代碼,如果需要的話:

package com.d4a.toolbelt; 

import android.app.Activity; 
import android.content.ComponentName; 
import android.content.Intent; 
import android.net.Uri; 
import android.os.Bundle; 
import android.view.Menu; 
import android.view.MenuItem; 
import android.view.View; 

public class QuickLaunch extends Activity { 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_quick_launch); 
    } 

    /** Called when the user clicks the music button */ 
    public void music(View view) { 
     Intent intent = new Intent("android.intent.action.MUSIC_PLAYER"); 
     startActivity(intent); 


    } 





/** Called when the user clicks the play button */ 
public void play(View view) { 
    Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.vending"); 
    startActivity(launchIntent); 
    } 



/** Called when the user clicks the web button */ 
public void web(View view) { 
    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://google.com/")); 
     startActivity(browserIntent); 

} 

     /** Called when the user clicks the email button */ 
public void email(View view) { 
    Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.email"); 
    startActivity(intent); 

} 

/** Called when the user clicks the sms button */ 
public void chat(View view) { 
    Intent intent = new Intent(Intent.ACTION_MAIN); 
intent.setComponent(new ComponentName("com.d4a.sms","de.ub0r.android.smsdroid.ConversationListActivity")); 
intent.putExtra("grace", "Hi"); 
startActivity(intent); 


} 


/** Called when the user clicks the settings button */ 
public void settings(View view) { 
    Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.settings"); 
    startActivity(intent); 

} 




/** Called when the user clicks the camara button */ 
public void cam(View view) { 
    Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); 
    startActivityForResult(intent, 0); 

} 

/** Called when the user clicks the video camara button */ 
public void video_cam(View view) { 
    Intent intent = new Intent("android.media.action.VIDEO_CAPTURE"); 
    startActivityForResult(intent, 0); 

} 
} 

萬分感謝提前傢伙!

回答

1

我想通了,你需要這行代碼在清單:

<intent-filter> 
      <action android:name="android.intent.action.ASSIST" /> 
      <category android:name="android.intent.category.DEFAULT"/> 
     </intent-filter> 

由於家裏發射器是開源的我得到了我的答案,我希望這可以幫助了別人誰是我的鞋