2010-10-29 6 views
0

S'il vous plaît aidez-moi Dans mon projet quand je suis en commençant une nouvelle activité, il se bloqueprob à démarrer une nouvelle activité

public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.shortnews); 
    showNewsListView = (ListView)findViewById(R.id.shortnewslistview); 
    ShortNewsListAdapter listAdapter = new ShortNewsListAdapter(this); 
    showNewsListView.setAdapter(listAdapter); 
    showNewsListView.setOnItemClickListener(new OnItemClickListener(){ 

    public void onItemClick(AdapterView<?> arg0, View arg1, int position, 
    long arg3) { 
    newspostion = position; 
    Log.v("status ","tab on position"+position); 
     //showProgressDialog(true); 
    try { 
    Intent myIntent = new Intent(FirstTab.this, NewsWebView.class); 
    FirstTab.this.startActivity(myIntent); 

    } catch (Exception e) { 
    Log.v("error","error in starting new activity"); 
    e.printStackTrace(); 
    } 

    } 
    }); 
    getUrlData(baseUrl); 
    } 

et im ajouter cette partie dans le fichier manifiest aussi

<activity android:name="NewsWebView" android:label="WebView"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
</activity> 

c'est une vue web Je veux montrer

public void onCreate(Bundle icicle) { 
    super.onCreate(icicle); 

    setContentView(R.layout.webview); 

    final String mimeType = "text/html"; 
    final String encoding = "utf-8"; 

    WebView wv; 

    wv = (WebView) findViewById(R.id.wv1); 
    wv.loadData("www.gmail.com", mimeType, encoding); 

} 

Connexion

10-29 13:10:15.784: VERBOSE/status(203): tab on position0 
10-29 13:10:15.784: INFO/ActivityManager(53): Starting activity: Intent { cmp=org.nuvus/.NewsWebView } 
10-29 13:10:15.814: DEBUG/PhoneWindow(203): couldn't save which view has focus because the focused view [email protected] has no id. 
10-29 13:10:16.764: INFO/ActivityManager(53): Displayed activity org.nuvus/.NewsWebView: 925 ms (total 925 ms) 
10-29 13:10:16.794: INFO/AndroidRuntime(203): AndroidRuntime onExit calling exit(0) 
10-29 13:10:16.904: INFO/ActivityManager(53): Process org.nuvus (pid 203) has died. 
10-29 13:10:16.924: INFO/WindowManager(53): WIN DEATH: Window{438425d8 org.nuvus/org.nuvus.Main paused=true} 
10-29 13:10:16.924: INFO/WindowManager(53): WIN DEATH: Window{438e15c8 org.nuvus/org.nuvus.NewsWebView paused=false} 
10-29 13:10:17.064: WARN/UsageStats(53): Unexpected resume of com.android.launcher while already resumed in org.nuvus 
10-29 13:10:17.144: WARN/InputManagerService(53): Got RemoteException sending setActive(false) notification to pid 203 uid 10027 
10-29 13:13:45.264: DEBUG/dalvikvm(102): GC freed 7488 objects/406792 bytes in 313ms 
10-29 13:10:16.794: INFO/AndroidRuntime(203): AndroidRuntime onExit calling exit(0) 
+0

utilisez-vous tabHost dans votre application –

+0

oui im ​​en utilisant TabHost et là je veux si je clique sur dans un onglet im montrant une vue de la liste et dans la touche listview je veux montrer le webview – neeraj

Répondre

0

le code ci-dessus est tellement brouillé. ne peut pas comprendre correctement. Vous devez mentionner la nouvelle activité que vous essayez d'ouvrir dans votre Manifest.xml. Alors vérifiez d'abord cela, l'avez-vous mentionné?

+0

Edited this (au moins un peu) pour vous, au cas où vous voudriez toujours y répondre. Mais gardez un œil sur la date, il a presque un an. –

Questions connexes